| latent_class_diagnostics | R Documentation |
Computes label-invariant posterior summaries of a fitted mixture model: the distribution of the occupied class count and the posterior probability that every pair of deciders belongs to the same class. It also returns the probability of every decider belonging to each relabeled class.
latent_class_diagnostics(object)
object |
[ |
A list with three elements:
occupancy: a data.frame with the columns n_classes and
probability, with one row for every number of classes from one to the
maximum number of classes of the model. It gives the share of draws in
which exactly n_classes classes contain at least one decider, so it
indicates how many classes the data support under the chosen prior. For
a fixed mixture, the sampler keeps all classes occupied.
co_clustering: a square matrix with one row and one column per
decider. Entry [i, j] is the share of draws in which deciders i and
j are in the same class, so it indicates whether two deciders behave
alike. It does not depend on how the classes are labeled.
membership: a matrix with one row per decider and one column per
class, class_1 to class_<maximum>. Entry [i, k] is the share of
draws in which decider i is in class k after relabeling, so it
answers which class a decider most likely belongs to.
Dahl2006RprobitB
\insertRefPapastamoulis2010RprobitB
\insertRefStephens2000RprobitB
set.seed(1)
model <- fit(
choice ~ x | 0, random_effects = "x", latent_class_effects = "x",
classes = 2, class_update = "dirichlet_process",
dgp_parameters = list(
beta = list(c(x = -1), c(x = 2)),
Omega = list(matrix(0.2), matrix(0.2)),
weights = c(0.6, 0.4)
),
n_occasions = 5,
chains = 1
)
diagnostics <- latent_class_diagnostics(model)
diagnostics$occupancy
diagnostics$co_clustering[1:5, 1:5]
head(diagnostics$membership)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.