Learn R Programming

MplusLGM (version 1.0.0)

runLGM: Run Latent Growth Models (LGM) and replicate the best loglikelihood value (LL)

Description

Run iterations of an LGM, doubling the number of starting values until the best LL value has replicated at least twice, both within and between models.

Usage

runLGM(lgm_object, wd)

Value

A list of class mplusObject including results for the replicated model, alongside with :

  • - The Mplus input and data files used for the model.

  • - The output files generated by Mplus.

  • - The data results files saved by Mplus.

Arguments

lgm_object

An mplusObject with predefined random starting values (STARTS) in the ANALYSIS section.

wd

A character string specifying the directory where the results folder will be created for saving the Mplus input, output, and data files. Default is the current working directory.

Details

The runLGM function run iterations of an LGM in Mplus while gradually increasing the number of random starting values used to optimize the loglikelihood. This approach aims to prevent estimation issues related to local maxima, which can result in selecting the inappropriate model during class enumeration. The function works as follows:

  • 1. Estimate the model using the predefined number of random starting values.

  • 2. Rerun the model with double the number of starting values.

  • 3. Continue until the best LL value is successfully replicated both within the model and between 2 consecutive model run, or the maximum number of allowed starting values is reached. By default the maximum number of allowed starting values is set 2 times the number of initial starting values raised to the power of 5.

  • 4. Return the mplusObject from the replicated model.

This function builds upon the capabilities of the mplusModeler function from the MplusAutomation package.

See Also

mplusModeler for running, and reading an mplusObject. LGMobject for creating the mplusObject for a latent growth model.

Examples

Run this code
# \donttest{
# Example usage:
GBTM_model <-  runLGM(
  lgm_object = GBTM_object,
  wd = file.path("Results", "Trajectories"))
# }

Run the code above in your browser using DataLab