Create syntax for a batch of mixture models
Dynamically creates syntax for a batch of mixture models, with intelligent
defaults. This function is a wrapper around mplusObject
, and
additional arguments can be passed to this function using ...
.
In all arguments to mplusObject
, a double space (“ ”) is
replaced with a newline character. This can be used to obtain nicely
formatted Mplus syntax.
In the arguments model_class_specific
and SAVEDATA
, the
character string “{C}” is substituted with the correct class number.
The character string “{filename_stem}” is substituted with the
filename stem, for example, to name savedata in line with the input files.
createMixtures( classes = 1L, filename_stem = NULL, model_overall = NULL, model_class_specific = NULL, rdata = NULL, usevariables = NULL, OUTPUT = "TECH11 TECH14;", SAVEDATA = "FILE IS {filename_stem}_{C}.dat; SAVE = cprobabilities;", ... )
classes |
A vector of integers, indicating which class solutions to
generate. Defaults to 1L. E.g., |
filename_stem |
Character. A stem for the automatically generated filenames of the syntax and data files. |
model_overall |
Character. Mplus syntax for the overall model (across classes). |
model_class_specific |
Character vector. Mplus syntax for the
class-specific model(s) of one or more categorical latent variables. Each
element of |
rdata |
Data.frame. An R dataset to be used for the model. |
usevariables |
Character vector, specifying the names of variables in the rdata object which should be included in the Mplus data file and model. |
OUTPUT |
Character. Syntax for Mplus' OUTPUT option. Highly recommended when determining the appropriate number of latent classes. TECH11 is required to obtain the VLMR-test; TECH14 is required for the BLR-test. |
SAVEDATA |
Character. Syntax for Mplus' savedata option. Highly recommended when conducting mixture models. The default option will often be adequate. |
... |
Additional arguments, passed to mplusObject, such as syntax for other Mplus options. |
None. Function is used for its side effects (generating syntax).
Caspar J. van Lissa
## Not run: createMixtures(classes = 1:3, filename_stem = "iris", rdata = iris) ## End(Not run) ## Not run: data <- read.table("http://statmodel.com/usersguide/chap8/ex8.13.dat")[,c(1:10)] names(data) <- c("u11", "u12", "u13", "u14", "u15", "u21", "u22", "u23", "u24", "u25") createMixtures( classes = 2, filename_stem = "dating", model_overall = "c2 ON c1;", model_class_specific = c( "[u11$1] (a{C}); [u12$1] (b{C}); [u13$1] (c{C}); [u14$1] (d{C}); [u15$1] (e{C});", "[u21$1] (a{C}); [u22$1] (b{C}); [u23$1] (c{C}); [u24$1] (d{C}); [u25$1] (e{C});" ), rdata = data, ANALYSIS = "PROCESSORS IS 2; LRTSTARTS (0 0 40 20); PARAMETERIZATION = PROBABILITY;", VARIABLE = "CATEGORICAL = u11-u15 u21-u25;" ) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.