predictive_view#
Align the observed and replicated answers for a single unit.
Parameters#
idata: xarray.DataTreeTree from
posterior_predictive()orprior_predictive(), with observed responses and its packaged design/support groups.block,item: str, int or NoneExactly one block ID or item ID. The selected unit must have one consistent response support.
Returns#
- xarray.DataTree
observed_data.response(obs)andposterior_predictive.response(chain, draw, obs)or its prior-predictive counterpart. They share the originalobsIDs.response_supportdescribes the selected unit’s category values or patterns.
Examples#
Use a fitted Model. The output below comes from the HEXACO TIRT example.
Select block B1 and verify that the observed and replicated responses share the same observation IDs.
import pyfcirt as fc
predictions = model.posterior_predictive(
draws=24,
random_seed=45,
store=False,
progressbar=False,
)
view = fc.predictive_view(predictions, block="B1")
observed = view.observed_data["response"]
replicated = view.posterior_predictive["response"]
print(observed.get_index("obs").equals(replicated.get_index("obs")))
True