prior_predictive#
- pyfcirt.prior_predictive(
- model: Model,
- *,
- draws=500,
- random_seed=None,
- save_responses=False,
- store=True,
Draw parameter values and responses from the model’s priors.
Parameters#
model: ModelPrepared model, which may be unfitted.
draws: intPositive number of prior draws. Default: 500.
random_seed: int or NoneReproducible seed.
save_responses: boolAlso keep replicated answers on the model when storing. Default:
False.store: boolStore requested groups in
model.idata. Default:True.
Returns#
- xarray.DataTree
priorhas parameter draws andprior_predictivehas simulated answers onchain,drawand batch-local response axes. Observed answers and design metadata are included when available. Replica draws are returned even whensave_responses=False.
Examples#
Inspect the dimensions of eight prior replicates for one item and three respondents.
import pyfcirt as fc
bundle = fc.load_example("simulated_mirt", model="DichotomousIRT", n_persons=3)
model = fc.Model(bundle.data)
prior = fc.prior_predictive(model, draws=8, random_seed=42, store=False)
view = fc.predictive_view(prior, item="I1")
print(dict(view.prior_predictive.response.sizes))
{'chain': 1, 'draw': 8, 'obs': 3}