PreparedInputs.from_inputs#
- classmethod PreparedInputs.from_inputs(
- data: FCInput | ItemInput | tuple[FCInput | ItemInput, ...],
- *,
- population: PopulationSpec | None = None,
- person_data: DataFrame | None = None,
- regressions: str | Mapping | None = None,
- statement_data: DataFrame | None = None,
- item_data: DataFrame | None = None,
- pair_data: DataFrame | None = None,
- id_columns: Mapping | None = None,
- regression_options: Mapping | None = None,
- purpose: Literal['observed', 'generate'] = 'observed',
- theta_parameterization: Literal['centered', 'noncentered', 'conditional'] = 'centered',
- centered_traits: tuple | list | None = None,
- fixed_parameters: Dataset | None = None,
Validate and encode design declarations before building a probability graph.
Parameters#
data: FCInput, ItemInput or tuple of bothOne declaration per channel. A two-element tuple combines forced-choice and item responses.
population: PopulationSpec or NonePopulation groups and priors.
Noneuses one population with zero means and unit residual scales.person_data: pandas.DataFrame or NoneGroup labels or person features, one row per
person_id.regressions: str, mapping or NoneFormula lines such as
"theta ~ age"or a mapping of targets toRegressionspecifications.statement_data,item_data: pandas.DataFrame or NoneFormula inputs with one row per
statement_idoritem_id.pair_data: pandas.DataFrame or NoneFormula inputs keyed by
(block_id, statement_1, statement_2). Reversed pairs are aligned to design order without changing predictor values.id_columns: mapping or NoneAlternative key columns for
person,statement,itemorpair. The default uses the keys above.regression_options: mapping or NoneOptions for string formulas, including coefficient prior overrides. See add_regressions().
purpose: {“observed”, “generate”}Validate recorded answers (default), or prepare an unanswered generation schedule.
theta_parameterization: {“centered”, “noncentered”, “conditional”}Parameterization of person traits. The default is
"centered".centered_traits: tuple, list or NoneFor
"conditional", trait IDs to center; other traits are noncentered.Nonecenters FC-measured traits. An empty list centers none.fixed_parameters: xarray.Dataset or NoneFixed final values with the prepared coordinates and no
chainordrawaxis.
Returns#
- PreparedInputs
Validated design and response arrays, coordinates, identifying constraints and optional fitted predictor encoders. Pass the result to
fc.Model(prepared).
Notes#
Supply feature tables and their key-column options together with formula regressions. Person data can also be used for grouping without a regression.
Examples#
Prepare joint responses#
The bundled example supplies both channels for the same people. The dimensions below count people and distinct units.
import pyfcirt as fc
example = fc.load_example(
"mixed_measurement",
model={"fc": "MGPPM", "items": "GPCM"},
n_persons=5,
)
prepared = fc.PreparedInputs.from_inputs(example.data)
print({axis: prepared.constant_data.sizes[axis] for axis in ("person", "block", "item")})
{'person': 5, 'block': 4, 'item': 4}