Learn R Programming

misty (version 0.6.7)

mplus.run: Run Mplus Models

Description

This function runs a group of Mplus models (.inp files) located within a single directory or nested within subdirectories.

Usage

mplus.run(target = getwd(), recursive = FALSE, filefilter = NULL, show.out = FALSE,
          replace.out = c("always", "never", "modified"), message = TRUE,
          logFile = NULL, Mplus = detect.mplus(), killOnFail = TRUE,
          local_tmpdir = FALSE)

Value

None.

Arguments

target

a character string indicating the directory containing Mplus input files (.inp) to run or the single .inp file to be run. May be a full path, relative path, or a filename within the working directory.

recursive

logical: if TRUE, run all models nested in subdirectories within directory. Not relevant if target is a single file.

filefilter

a Perl regular expression (PCRE-compatible) specifying particular input files to be run within directory. See regex or http://www.pcre.org/pcre.txt for details about regular expression syntax. Not relevant if target is a single file.

show.out

logical: if TRUE, estimation output (TECH8) is show on the R console. Note that if run within Rgui, output will display within R, but if run via Rterm, a separate window will appear during estimation.

replace.out

a character string for specifying three settings: "always" (default), which runs all models, regardless of whether an output file for the model exists, "never", which does not run any model that has an existing output file, and "modified", which only runs a model if the modified date for the input file is more recent than the output file modified date.

message

logical: if TRUE, message Running model: and System command: is printed on the console.

logFile

a character string specifying a file that records the settings passed into the function and the models run (or skipped) during the run.

Mplus

a character string for specifying the name or path of the Mplus executable to be used for running models. This covers situations where Mplus is not in the system's path, or where one wants to test different versions of the Mplus program. Note that there is no need to specify this argument for most users since it has intelligent defaults.

killOnFail

logical: if TRUE (default), all processes named mplus.exe when mplus.run() does not terminate normally are killed. Windows only.

local_tmpdir

logical: if TRUE, the TMPDIR environment variable is set to the location of the .inp file prior to execution. This is useful in Monte Carlo studies where many instances of Mplus may run in parallel and we wish to avoid collisions in temporary files among processes. Linux/Mac only.

Author

Michael Hallquist and Joshua Wiley

References

Hallquist, M. N. & Wiley, J. F. (2018). MplusAutomation: An R package for facilitating large-scale latent variable analyses in Mplus. Structural Equation Modeling: A Multidisciplinary Journal, 25, 621-638. https://doi.org/10.1080/10705511.2017.1402334.

Muthen, L. K., & Muthen, B. O. (1998-2017). Mplus User's Guide (8th ed.). Muthen & Muthen.

See Also

read.mplus, write.mplus, mplus, mplus.update, mplus.print, mplus.plot, mplus.bayes, mplus.lca

Examples

Run this code
if (FALSE) {
# Example 1: Run Mplus models located within a single directory
mplus.run(Mplus = "C:/Program Files/Mplus/Mplus.exe")

# Example 2: Run Mplus models located nested within subdirectories
mplus.run(recursive = TRUE,
          Mplus = "C:/Program Files/Mplus/Mplus.exe")
}

Run the code above in your browser using DataLab