View source: R/mx_switch_labels.R
mx_switch_labels | R Documentation |
The order of class labels in LCA is arbitrary. This can result in a phenomenon called 'label switching', where classes change places between replications of an analysis. This function attempts to re-order classes in a substantively meaningful way.
mx_switch_labels(x, param = "weights", decreasing = TRUE, order = NULL)
x |
An |
param |
The parameter by which to order the classes,
defaults to |
decreasing |
logical. Should the classes be sorted in increasing or decreasing order? Default: TRUE |
order |
Integer, indicating the ordering of classes. Ignored when NULL (default). |
The argument param
can accept either:
The default string "weights", in which classes are sorted by size.
The OpenMx
matrix indicator for a specific model parameter; e.g.,
the first mean is indicated by "M[1,1]"
. These indicators can be viewed
by running table_results(x, columns = NULL)
.
The letter indicating an OpenMx
model matrix, e.g., "M"
refers to
the matrix of means. To account for all elements of the matrix, Euclidean
distance to the origin is used.
An MxModel
with "tidySEM"
attribute: "mixture"
## Not run:
df <- iris[1:4]
names(df) <- letters[1:4]
res1 <- mx_profiles(data = df, classes = 2)
mx_switch_labels(res1, decreasing = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.