Read Parameters, Summary Statistics, and Savedata from Mplus Output
Source:R/readModels.R
readModels.RdExtracts information from one or more Mplus output files, including fit statistics and parameters. Its is to parse all (supported) aspects of Mplus output and to combine these into a list object, with one element per output file identified.
Usage
readModels(
target = getwd(),
recursive = FALSE,
filefilter,
pathfilter,
what = "all",
quiet = TRUE
)Arguments
- target
the directory containing Mplus output files (.out) to parse OR the single output file to be parsed. May be a full path, relative path, or a filename within the working directory. Defaults to the current working directory. Example: "C:/Users/Michael/Mplus Runs"
- recursive
optional. If
TRUE, parse all models nested in subdirectories withintarget. Defaults toFALSE.- filefilter
a Perl regular expression (PCRE-compatible) specifying particular output files to be parsed within
directorybased on their file name. Seeregexor https://www.pcre.org/pcre.txt for details about regular expression syntax.- pathfilter
a Perl regular expression (PCRE-compatible) specifying particular paths to be parsed within
directorybased on their absolute paths.- what
a character vector denoting what aspects of Mplus output to extract. Defaults to
"all", which will extract all supported output sections. See details for additional information.- quiet
whether to suppress printing to the screen the file currently being processed. Defaults to TRUE.
Value
A list with one mplus.model per file. Each mplus.model object is composed of
elements containing major output sections, as detailed below. If
target is a single file, then the top-level elements will be
a single mplus.model object, not a list of files. Specific elements are:
input: Mplus input syntax parsed into a list by major sectionwarnings: Syntax and estimation warnings as a listerrors: Syntax and estimation errors as a listdata_summary: Output of SUMMARY OF DATA section, including cluster sizes and ICCssampstat: Sample statistics provided by OUTPUT: SAMPSTAT, if specifiedcovariance_coverage: Covariance coverage matrix for checking missingness patternssummaries: Summary statistics fromextractModelSummaries, having structure as specified by that functionparameters: Model parameters fromextractModelParameters, having structure as specified by that functionclass_counts: Latent class counts and proportions for models that include a categorical latent variableindirect: Output of MODEL INDIRECT if available in output. Contains$overalland$specificdata.frames for each indirect effect sectionmod_indices: Model modification indices fromextractModIndices, having structure as specified by that functionresiduals: a list containing relevant information from OUTPUT: RESIDUALSsavedata_info: File information about SAVEDATA files related to this outputsavedata: SAVEDATA file as an Rdata.frame, as described ingetSavedata_Databparameters: anmcmc.listobject containing the draws from the MCMC chains for a Bayesian model that uses the SAVEDATA: BPARAMETERS commandtech1: a list containing parameter specification and starting values from OUTPUT: TECH1tech3: a list containing parameter covariance and correlation matrices from OUTPUT: TECH3tech4: a list containing means, covariances, and correlations for latent variables from OUTPUT: TECH4tech7: a list containing sample statistics for each latent class from OUTPUT: TECH7tech8: a list containing optimization history of the model. Currently only supports potential scale reduction in BAYES. OUTPUT: TECH8tech9: a list containing warnings/errors from replication runs for MONTECARLO analyses from OUTPUT: TECH9tech10: a list containing model fit information from OUTPUT: TECH10tech12: a list containing observed versus estimated sample statistics for TYPE=MIXTURE analyses from OUTPUT: TECH12fac_score_stats: factor score mean, correlation, and covariance structure from SAMPLE STATISTICS FOR ESTIMATED FACTOR SCORES sectionlcCondMeans: conditional latent class means and pairwise comparisons, obtained using auxiliary(e) syntax in latent class modelsr3step: predictors of latent class membership using the 3-step procedure (R3STEP)gh5: a list containing data from the gh5 (graphics) file corresponding to this output. (Requires rhdf5 package)h5results: a list containing data from h5results file produced by Mplus v8.11+. (Requires rhdf5 package)output: The entire, raw output file.
Details
The what parameter defaults to "all", which extracts all supported output. If you would like to extract a
reduced set of output sections (especially to speed up the function when reading many files), specify the sections
as a character vector from the following options:
c("input", "warn_err", "data_summary", "sampstat", "covariance_coverage", "summaries", "parameters", "class_counts", "indirect", "mod_indices", "residuals", "savedata", "bparameters", "tech1", "tech3", "tech4", "tech7", "tech8", "tech9", "tech10", "tech12", "fac_score_stats", "lcCondMeans", "gh5", "output")