mplus {misty} | R Documentation |
Create, Run, and Print Mplus Models
Description
This wrapper function creates a Mplus input file, runs the input file by using
the mplus.run()
function, and prints the Mplus output file by using the
mplus.print()
function.
Usage
mplus(x, file = "Mplus_Input.inp", replace.inp = TRUE, data = NULL, mplus.run = TRUE,
show.out = FALSE, replace.out = c("always", "never", "modified"),
print = c("all", "input", "result"),
input = c("all", "default", "data", "variable", "define", "analysis",
"model", "montecarlo", "mod.pop", "mod.cov", "mod.miss",
"message"),
result = c("all", "default", "summary.analysis.short",
"summary.data.short", "random.starts", "summary.fit",
"mod.est", "fit", "class.count", "classif", "mod.result",
"total.indirect"),
exclude = NULL, variable = FALSE, not.input = TRUE, not.result = TRUE,
write = NULL, append = TRUE, check = TRUE, output = TRUE)
Arguments
x |
a character string containing the Mplus input text. |
file |
a character string indicating the name of the Mplus input
file with or without the file extension |
replace.inp |
logical: if |
data |
a matrix or data frame from which the variables names for
the subsection |
mplus.run |
logical: if |
show.out |
logical: if |
replace.out |
a character string for specifying three settings:
|
print |
a character vector indicating which results to show, i.e.
|
input |
a character vector specifiying Mplus input command sections
included in the output (see 'Details' in the |
result |
a character vector specifiying Mplus result sections included
in the output (see 'Details' in the |
exclude |
a character vector specifiying Mplus input command or result
sections excluded from the output (see 'Details' in the
|
variable |
logical: if |
not.input |
logical: if |
not.result |
logical: if |
write |
a character string naming a file for writing the output into
a text file with file extension |
append |
logical: if |
check |
logical: if |
output |
logical: if |
Details
- The
NAMES
Option in the
VARIABLE
section used to assign names to the variables in the data set can be specified by using...
and thedata
argument:Write Mplus Data File
: In the first step, the Mplus data file is written by using thewrite.mplus()
function, e.g.write.mplus(ex3_1, file = "ex3_1.dat")
.Specify Mplus Input
: In the second step, the Mplus input is specified as a character string. TheNAMES
option can be specified by using...
, e.g.,input <- 'DATA: FILE IS ex3_1.dat;\nVARIABLE: ...\nMODEL: y1 ON x1 x3;'
.Run Mplus Input
: In the third step, the Mplus input is run by using themplus()
function. Note that the argumentdata
needs to be specified given that theNAMES
option was specified by using...
in the previous step, e.g.,mplus(input, file = "ex3_1.inp", data = ex3_1)
Value
Returns an object of class misty.object
, which is a list with following
entries:
call |
function call |
type |
type of analysis |
x |
a character vector containing the Mplus input text |
args |
specification of function arguments |
input |
list with input command sections |
write |
write command sections |
result |
list with input command sections ( |
Author(s)
Takuya Yanagida
References
Muthen, L. K., & Muthen, B. O. (1998-2017). Mplus User's Guide (8th ed.). Muthen & Muthen.
See Also
read.mplus
, write.mplus
, mplus.print
,
mplus.update
, mplus.run
,
mplus.lca
Examples
## Not run:
#----------------------------------------------------------------------------
# Example 1: Write data, specify input, and run input
# Write Mplus Data File
write.mplus(ex3_1, file = "ex3_1.dat")
# Specify Mplus input, specify NAMES option
input1 <- '
DATA: FILE IS ex3_1.dat;
VARIABLE: NAMES ARE y1 x1 x3;
MODEL: y1 ON x1 x3;
OUTPUT: SAMPSTAT;
'
# Run Mplus input
mplus(input1, file = "ex3_1.inp")
#----------------------------------------------------------------------------
# Example 2: Alterantive specification using ... and the data argument
# Specify Mplus input, specify NAMES option by using ...
input2 <- '
DATA: FILE IS ex3_1.dat;
VARIABLE: ...
MODEL: y1 ON x1 x3;
OUTPUT: SAMPSTAT;
'
# Run Mplus input
mplus(input2, file = "ex3_1.inp", data = ex3_1)
## End(Not run)