mplusModel_r6: An R6 class for a single Mplus model

mplusModel_r6R Documentation

An R6 class for a single Mplus model

Description

An R6 class for a single Mplus model

An R6 class for a single Mplus model

Details

Wrapped by 'mplusModel'

Public fields

input

Mplus input syntax parsed into a list by major section

warnings

Syntax and estimation warnings as a list

parameters

a list containing the parameter estimates for the model

summaries

a list containing the model summary information and statistics

savedata

a list containing the data output by the SAVEDATA command

Active bindings

model_dir

the directory for Mplus files corresponding to this model

inp_file

the location of the Mplus .inp file for this model

out_file

the location of the Mplus .out file for this model

dat_file

the location of the Mplus .dat (data) file for this model

data

the dataset used for estimating this model

Mplus_command

the location of the Mplus program

syntax

the Mplus syntax for this model as a character vector

Methods

Public methods


Method new()

generate an mplusModel_r6 object

Usage
mplusModel_r6$new(
  syntax = NULL,
  data = NULL,
  inp_file = NULL,
  read = TRUE,
  Mplus_command = NULL
)
Arguments
syntax

a character vector of Mplus input syntax for this model

data

a data.frame to be used for estimating the model

inp_file

the location of .inp file for this model

read

If TRUE and the .out file already exists, read the contents of the .out file using 'readModels'

Mplus_command

N.B.: No need to pass this parameter for most users (has intelligent defaults). Allows the user to specify the name/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.


Method read()

read the results of an Mplus model from the .out file using 'readModels'

Usage
mplusModel_r6$read(force = FALSE)
Arguments
force

if 'TRUE', re-read the .out file even if was already previously loaded in to this object


Method write_dat()

write the .inp and .dat files for this model to the intended location

Usage
mplusModel_r6$write_dat(overwrite = TRUE, quiet = FALSE, ...)
Arguments
overwrite

if 'TRUE', overwrite existing data. Default: 'TRUE'.

quiet

if 'TRUE', do not produce messages about the outcome of this command (e.g., a message about overwriting existing data)

...

additional arguments passed to 'prepareMplusData'


Method write_inp()

write the .inp and .dat files for this model to the intended location

Usage
mplusModel_r6$write_inp(overwrite = TRUE, inp_file = NULL, quiet = FALSE)
Arguments
overwrite

if 'TRUE', overwrite existing data. Default: 'TRUE'.

inp_file

The location of the input file to write. If NULL (default), use the '$inp_file' of this object.

quiet

if 'TRUE', do not produce messages about the outcome of this command (e.g., a message about overwriting existing data)


Method submit()

submit this model for estimation on an HPC using 'submitModels'

Usage
mplusModel_r6$submit(replaceOutfile = "modifiedDate", ...)
Arguments
replaceOutfile

Currently supports three settings: “always”, 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 “modifiedDate”, which only runs a model if the modified date for the input file is more recent than the output file modified date (implying there have been updates to the model).

...

additional arguments passed to 'submitModels'


Method run()

run this model locally using 'runModels'

Usage
mplusModel_r6$run(replaceOutfile = "modifiedDate")
Arguments
replaceOutfile

Currently supports three settings: “always”, 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 “modifiedDate”, which only runs a model if the modified date for the input file is more recent than the output file modified date (implying there have been updates to the model).

...

additional arguments passed to 'runModels'


Method clone()

The objects of this class are cloneable with this method.

Usage
mplusModel_r6$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


michaelhallquist/MplusAutomation documentation built on June 15, 2025, 9:48 a.m.