empirical_reliability#
Compute reliability from explicit score means and variances.
Parameters#
mean: xarray.DataArrayFinite final score means labelled by
personand optionallytrait.variance: xarray.DataArrayNonnegative final score variances with the same labels and dimensions. Use at least two respondents.
method: {“ratio”, “subtraction”}For score sample variance V and mean posterior variance U, use
V/(V+U)(default) or1-U/V.
Returns#
- xarray.Dataset
reliability,score_varianceandmean_posterior_varianceby trait when that dimension is present;n_personis a scalar count.
Examples#
Compute reliability for neuroticism from the TIRT posterior moments. Use the same call with labelled means and variances from another estimator.
import pyfcirt as fc
theta = model.idata.posterior["theta"].sel(trait="n")
mean = theta.mean(("chain", "draw"))
variance = theta.var(("chain", "draw"), ddof=1)
result = fc.empirical_reliability(mean, variance)
print(round(result.reliability.item(), 2))
0.77