| mx_switch_labels {tidySEM} | R Documentation | 
Switch LCA Class Labels
Description
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.
Usage
mx_switch_labels(x, param = "weights", decreasing = TRUE, order = NULL)
Arguments
| 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). | 
Details
The argument param can accept either:
- The default string "weights", in which classes are sorted by size. 
- The - OpenMxmatrix 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 - OpenMxmodel 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.
Value
An MxModel with "tidySEM" attribute: "mixture"
Examples
## 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)