API reference#

For a first fit, follow the Quick start. For R, see the R API reference.

Prepare data#

API

Purpose

fc.Model()

Start an analysis.

fc.load_example()

Load bundled data for an example or practice analysis.

model.add_fc()

Register a forced-choice design and its responses.

model.add_items()

Register a design and responses for binary or rating items.

model.prepare()

Validate the design and responses and prepare the model for fitting.

model.data_coverage()

Check numbers of respondents, administered units, answers, and missing responses.

model.response_data()

Inspect observed response records.

See observed response distributions for counts, proportions, and plots.

Configure and fit a model#

API

Purpose

model.summary()

Review the prepared model, its data, and its parameter settings.

model.set_priors()

Override selected default priors.

model.available_covariate_targets()

Find the parameters that can use covariates and the tables they need.

model.add_regressions()

Add covariates to trait scores or measurement parameters.

model.set_population()

Register the person table and group-specific trait distributions.

model.add_dif_terms()

Add respondent predictors to selected measurement parameters, with sample-size and group scaling for the default truncated L1 loading strength (experimental).

model.prior_predictive()

Check which response patterns the priors imply before fitting.

model.fit()

Fit the model and obtain posterior draws.

Check sampling and model fit#

API

Purpose

model.posterior_predictive()

Generate replicated responses to compare with observed answers.

fc.predictive_view()

Select observed and replicated answers for one block or item.

model.chi_ppp()

Run a posterior predictive check for categorical responses using a Pearson discrepancy.

fc.plot_ppp()

Plot results of the posterior predictive check.

model.residuals()

Calculate observed-minus-expected responses to locate discrepancies.

For convergence diagnostics, use ArviZ summary or rank and distribution plots with model.idata.

Compare models#

API

Purpose

model.log_likelihood()

Obtain pointwise log likelihoods for the observed responses.

fc.waic()

Estimate expected predictive accuracy from pointwise log likelihoods.

fc.dic()

Compute the deviance information criterion from pointwise log likelihoods.

Use the same observations and likelihood units when comparing models.

Interpret and report results#

API

Purpose

model.coef()

Summarize measurement parameters and their posterior uncertainty.

model.dif_summary()

Summarize posterior DIF contrasts between respondent profiles (experimental).

model.trait_summary()

Summarize population trait means, standard deviations, and correlations.

model.idata.posterior["theta"]

Access the posterior draws for each respondent’s trait scores.

fc.plot_ridge()

Plot the posterior distributions of selected trait scores.

model.information()

Evaluate how much measurement information the responses provide at a trait level.

model.reliability()

Estimate score reliability from posterior trait scores and their uncertainty.

Score new respondents or simulate data#

API

Purpose

model.score()

Estimate trait scores for new respondents using an existing calibration.

model.score_model()

Build a new-respondent scoring model for inspection or a chosen estimator.

model.simulate()

Generate responses using the current design and specified parameter source.

Save and reuse results#

API

Purpose

model.idata.to_netcdf()

Save posterior draws and stored analysis outputs.

model.attach_samples()

Attach saved posterior draws to a matching prepared model.

Advanced modeling#

Developer reference#

The parameter and coordinate contract describes prepared layouts, parameter identities and stored coordinates for integrations.

See troubleshooting for installation and runtime errors.