Learn R Programming

misty (version 0.6.7)

mplus.update: Mplus Input Updating

Description

This function updates specific input command sections of a misty.object of type mplus to create an updated Mplus input file, run the updated input file by using the mplus.run() function, and print the updated Mplus output file by using the mplus.print() function.

Usage

mplus.update(x, update, file = "Mplus_Input_Update.inp", comment = FALSE,
             replace.inp = TRUE, 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)

Value

Returns an object of class misty.object, which is a list with following entries:

call

function call

type

type of analysis

x

misty.object object of type mplus

args

specification of function arguments

input

list with input command sections

write

updated write command sections

result

list with input command sections (input) and result sections (input)

Arguments

x

misty.object object of type mplus.

update

a character string containing the updated input command sections.

file

a character string indicating the name of the updated Mplus input file with or without the file extension .inp, e.g., "Mplus_Input_Update.inp" or "Mplus_Input_Update".

comment

logical: if FALSE (default), comments (i.e., text after the ! symbol) are removed from the input text specified in the argument x.

replace.inp

logical: if TRUE (default), an existing input file will be replaced.

mplus.run

logical: if TRUE, the input file specified in the argument file containing the input text specified in the argument x is run using the mplus.run function.

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.

print

a character vector indicating which results to show, i.e. "all" (default) for all results "input" for input command sections, and "result" for result sections.

input

a character vector specifying Mplus input command sections included in the output (see 'Details' in the mplus.print function).

result

a character vector specifying Mplus result sections included in the output (see 'Details' in the mplus.print function).

exclude

a character vector specifying Mplus input command or result sections excluded from the output (see 'Details' in the mplus.print function).

variable

logical: if TRUE, names of the variables in the data set (NAMES ARE) specified in the VARIABLE: command section are shown. By default, names of the variables in the data set are excluded from the output unless all variables are used in the analysis (i.e., no USEVARIABLES command specified in the Mplus input file).

not.input

logical: if TRUE (default), character vector indicating the input commands not requested are shown on the console.

not.result

logical: if TRUE (default), character vector indicating the result sections not requested are shown on the console.

write

a character string naming a file for writing the output into a text file with file extension ".txt" (e.g., "Output.txt").

append

logical: if TRUE (default), output will be appended to an existing text file with extension .txt specified in write, if FALSE existing text file will be overwritten.

check

logical: if TRUE (default), argument specification is checked.

output

logical: if TRUE (default), output is shown on the console by using the function mplus.print.

Author

Takuya Yanagida

Details

Mplus Input Sections

The function is used to update following Mplus input sections:

  • TITLE

  • DATA

  • DATA IMPUTATION

  • DATA WIDETOLONG

  • DATA LONGTOWIDE

  • DATA TWOPARTE

  • DATA MISSING

  • DATA SURVIVAL

  • DATA COHORT

  • VARIABLE

  • DEFINE

  • ANALYSIS

  • MODEL

  • MODEL INDIRECT

  • MODEL CONSTRAINT

  • MODEL TEST

  • MODEL PRIORS

  • MODEL MONTECARLO

  • MODEL POPULATION

  • MODEL COVERAGE

  • MODEL MISSING

  • OUTPUT

  • SAVEDATA

  • PLOT

The ...; Specification

The ...; Specification is used to update specific options in the VARIABLE and ANALYSIS section, while keeping all other options in the misty.object of type mplus specified in the argument x. The ...; specification is only available for the VARIABLE and ANALYSIS section. Note that ...; including the semicolon ; needs to be specified, i.e., ... without the semicolon ; will result in an error message.

The ---; Specification

The ---; specification is used to remove entire sections (e.g., OUTPUT: ---;) or options within the VARIABLE: and ANALYSIS: section (e.g., ANALYSIS: ESTIMATOR IS ---;) from the Mplus input. Note that ---; including the semicolon ; needs to be specified, i.e., --- without the semicolon ; will result in an error message.

Comments in the Mplus Input

Comments in the Mplus Input can cause problems when following keywords in uppercase, lower case, or mixed upper and lower case letters are involved in the comments of the VARIABLE and ANALYSIS section:

  • VARIABLE section: "NAMES", "USEOBSERVATIONS", "USEVARIABLES", "MISSING", "CENSORED", "CATEGORICAL", "NOMINAL", "COUNT", "DSURVIVAL", "GROUPING", "IDVARIABLE", "FREQWEIGHT", "TSCORES", "AUXILIARY", "CONSTRAINT", "PATTERN", "STRATIFICATION", "CLUSTER", "WEIGHT", "WTSCALE", "BWEIGHT", "B2WEIGHT", "B3WEIGHT", "BWTSCALE", "REPWEIGHTS", "SUBPOPULATION", "FINITE", "CLASSES", "KNOWNCLASS", "TRAINING", "WITHIN", "BETWEEN", "SURVIVAL", "TIMECENSORED", "LAGGED", or "TINTERVAL".

  • ANALYSIS section: "TYPE", "ESTIMATOR", "MODEL", "ALIGNMENT", "DISTRIBUTION", "PARAMETERIZATION", "LINK", "ROTATION", "ROWSTANDARDIZATION", "PARALLEL", "REPSE", "BASEHAZARD", "CHOLESKY", "ALGORITHM", "INTEGRATION", "MCSEED", "ADAPTIVE", "INFORMATION", "BOOTSTRAP", "LRTBOOTSTRAP", "STARTS", "STITERATIONS", "STCONVERGENCE", "STSCALE", "STSEED", "OPTSEED", "K-1STARTS", "LRTSTARTS", "RSTARTS", "ASTARTS", "H1STARTS", "DIFFTEST", "MULTIPLIER", "COVERAGE", "ADDFREQUENCY", "ITERATIONS", "SDITERATIONS", "H1ITERATIONS", "MITERATIONS", "MCITERATIONS", "MUITERATIONS", "RITERATIONS", "AITERATIONS", "CONVERGENCE", "H1CONVERGENCE", "LOGCRITERION", "RLOGCRITERION", "MCONVERGENCE", "MCCONVERGENCE", "MUCONVERGENCE", "RCONVERGENCE", "ACONVERGENCE", "MIXC", "MIXU", "LOGHIGH", "LOGLOW", "UCELLSIZE", "VARIANCE", "SIMPLICITY", "TOLERANCE", "METRIC", "MATRIX", "POINT", "CHAINS", "BSEED", "STVALUES", "PREDICTOR", "ALGORITHM", "BCONVERGENCE", "BITERATIONS", "FBITERATIONS", "THIN", "MDITERATIONS", "KOLMOGOROV", "PRIOR", "INTERACTIVE", or "PROCESSORS".

Note that comments are removed from the input text by default, i.e., comment = FALSE.

References

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

See Also

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