load_example#
- pyfcirt.load_example(
- name: str,
- *,
- model,
- n_persons: int | None = None,
- random_seed: int | None = None,
- include_truth: bool = False,
Load a bundled dataset for a chosen measurement model.
Parameters#
name: strName in the dataset catalogue.
model: str, measurement specification or mappingCurrent measurement model. For mixed data, supply
{"fc": fc_model, "items": item_model}with one model per channel.n_persons: int or NoneNumber of people to retain.
Noneuses the resource’s default cohort. The full design and category scales are retained for any subset.random_seed: int or NoneWith explicit
n_persons, sample people without replacement. The seed is in[0, 2**32 - 1].Nonetakes the first source respondents.include_truth: boolInclude original generating values for simulated resources. Default:
False.
Returns#
- ExampleData
Fresh inputs, matched optional
person_dataandresponse_timestables, provenancemetadataand optionaltruth. The selected cohort filename is recorded inmetadata["selection"]["resource"]asn<N>.json.gz(for example,n100.json.gz). Passbundle.datatoModel.prepare(). Companion tables retain source row order, so match by ID.
Notes#
Generating values use the source model’s parameter names and scale. Empirical
resources return truth=None. The hexaco_fc3 resource also provides
one independent desirability score per statement in
bundle.data.statement_features, matched by statement_id. The
mgppm_groups resource provides respondent group labels in bundle.person_data.
Examples#
Observed comparisons#
import pyfcirt as fc
bundle = fc.load_example("tirt_study", model="TIRT", n_persons=3)
print(bundle.data.responses.frame.head(3).to_string(index=False))
person_id block_id statement_1 statement_2 response
P1 B1 S1 S2 0
P1 B1 S1 S3 1
P1 B1 S2 S3 1
Simulated responses with generating parameters#
bundle = fc.load_example(
"simulated_mirt",
model="DichotomousIRT",
n_persons=50,
include_truth=True,
)
print({axis: bundle.truth.sizes[axis] for axis in ("person", "item")})
{'person': 50, 'item': 8}