trait_summary#
- pyfcirt.trait_summary(
- data: Model,
- *,
- idata: xr.DataTree | None = None,
- by_group: bool = False,
- ci_prob: float = 0.95,
- ci_kind: Literal['hdi', 'eti'] = 'hdi',
- **summary_kwargs,
Summarize the population’s trait means, SDs and correlations.
Parameters#
data: ModelPrepared model and the people whose groups and predictors define the population.
idata: xarray.DataTree or NoneCompatible posterior.
Noneuses model samples.by_group: boolSeparate moments for each actual population group. Default:
False.ci_prob: floatCredible interval mass. Default: 0.95.
ci_kind: {“hdi”, “eti”}Highest density (default) or equal-tailed interval.
summary_kwargsArviZ summary options such as
coords,var_names,kindandround_to. If selecting sample states, use the originalchainanddrawlabels.
Returns#
- xarray.Dataset
population_meanandpopulation_sdhavetraitandsummarydimensions.trait_correlationaddstrait_aux. With groups selected,population_grouplabels the groups. Fixed moments have missing uncertainty.
Notes#
With predictors, marginal correlations incorporate differences in predicted means across the reference people as well as the conditional residual variation.
Examples#
Use a fitted Model. The output below comes from the HEXACO TIRT example.
Select correlations between Honesty–Humility and two other traits.
moments = model.trait_summary(kind="stats")
row = moments["trait_correlation"].sel(
trait="honestyhumility",
trait_aux=["agreeableness", "emotionality"],
summary=["mean", "hdi95_lb", "hdi95_ub"],
)
print(row.to_pandas().round(2).to_string())
summary mean hdi95_lb hdi95_ub
trait_aux
agreeableness 0.35 0.06 0.63
emotionality -0.01 -0.32 0.29