Extracts P(class | response vector) for each individual from an explicitly fitted person/item model.

posterior_class_probs(fit)

Arguments

fit

output from fit_person_lca()

Value

data.frame with columns P_gg, P_gk, P_kk (rows = individuals)

Examples

sim <- simulate_lca(n = 100, gk = 0.30, seed = 123, return_classes = TRUE)
fit <- fit_person_lca(sim$pre, sim$post)
posteriors <- posterior_class_probs(fit)
head(posteriors)
#>         P_gg      P_gk      P_kk
#> 1 1.00000000 0.0000000 0.0000000
#> 2 0.12903225 0.8709677 0.0000000
#> 3 0.01731602 0.1168831 0.8658009
#> 4 0.01731602 0.1168831 0.8658009
#> 5 0.12903225 0.8709677 0.0000000
#> 6 0.01731602 0.1168831 0.8658009