MplusAutomation

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthen and Muthen (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.

https://github.com/michaelhallquist/mplusautomation

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    5 of 23 committers (21.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary

Keywords from Contributors

estimated-marginal-means marginal-effects prediction
Last synced: 10 months ago · JSON representation

Repository

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthen and Muthen (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.

Basic Info
Statistics
  • Stars: 91
  • Watchers: 9
  • Forks: 47
  • Open Issues: 49
  • Releases: 3
Created over 13 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog

README.md

MplusAutomation

The MplusAutomation package leverages the flexibility of the R language to automate latent variable model estimation and interpretation using Mplus, a powerful latent variable modeling program developed by Muthén and Muthén (www.statmodel.com). Specifically, MplusAutomation provides routines for creating related groups of models, running batches of models, and extracting and tabulating model parameters and fit statistics.

Installation

You can install the latest release of MplusAutomation directly from CRAN by running

install.packages("MplusAutomation")

Alternately, if you want to try out the latest development MplusAutomation code, you can install it straight from github using Hadley Wickham's devtools package. If you do not have devtools installed, first install it and then install MplusAutomation.

#install.packages("devtools")
library(devtools)

install_github("michaelhallquist/MplusAutomation")

Questions

For questions, answers, and updates on the status of the MplusAutomation package, email or subscribe to the Google group list.

Examples

You can find a detailed example of how to use the MplusAutomation package in the vignette .

Here is an example of using the package to run a simple path model using the mtcars dataset built into R.

library(MplusAutomation)

pathmodel <- mplusObject(
   TITLE = "MplusAutomation Example - Path Model;",
   MODEL = "
     mpg ON hp;
     wt ON disp;",
   OUTPUT = "CINTERVAL;",
   rdata = mtcars)

## R variables selected automatically as any variable name that occurs in the MODEL, VARIABLE, or DEFINE section.
## If any issues, suggest explicitly specifying USEVARIABLES.
## A starting point may be:
## USEVARIABLES = mpg disp hp wt;

fit <- mplusModeler(pathmodel, modelout = "model1.inp", run = 1L)

That is all it takes to run Mplus! MplusAutomation takes care of figuring out which variables from your R dataset are used in the model and which are not (if it get's confused, you can also specify usevariables). It creates a dataset suitable for Mplus, calls Mplus to run the model on the dataset, and reads it back into R.

There is even pretty printing now. To see the results:

r library(texreg) screenreg(fit, summaries = c("Observations", "CFI", "SRMR"), single.row=TRUE)


==================================
                  Model 1
----------------------------------
 MPG<-HP          -0.06 (0.01) ***
 WT<-DISP          0.01 (0.00) ***
 WT<->MPG         -1.02 (0.38) **
 MPG<-Intercepts  29.59 (1.53) ***
 WT<-Intercepts    1.82 (0.18) ***
 MPG<->MPG        14.04 (3.52) ***
 WT<->WT           0.21 (0.06) ***
----------------------------------
Observations      32
CFI                0.87
SRMR               0.14
==================================
*** p < 0.001, ** p < 0.01, * p < 0.05

The fit is not great, to add some extra paths we can update the model.

pathmodel2 <- update(pathmodel, MODEL = ~ . + "
    mpg ON disp;
    wt ON hp;")

fit2 <- mplusModeler(pathmodel2, modelout = "model2.inp", run = 1L)

We can make some pretty output of both models:

r screenreg(list( extract(fit, summaries = c("Observations", "CFI", "SRMR")), extract(fit2, summaries = c("Observations", "CFI", "SRMR"))), single.row=TRUE)


====================================================
                  Model 1           Model 2
----------------------------------------------------
 MPG<-HP          -0.06 (0.01) ***  -0.02 (0.01)
 WT<-DISP          0.01 (0.00) ***   0.01 (0.00) ***
 WT<->MPG         -1.02 (0.38) **   -0.73 (0.26) **
 MPG<-Intercepts  29.59 (1.53) ***  30.74 (1.27) ***
 WT<-Intercepts    1.82 (0.18) ***   1.68 (0.19) ***
 MPG<->MPG        14.04 (3.52) ***   8.86 (2.21) ***
 WT<->WT           0.21 (0.06) ***   0.19 (0.05) ***
 MPG<-DISP                          -0.03 (0.01) ***
 WT<-HP                              0.00 (0.00)
----------------------------------------------------
Observations      32                32
CFI                0.87              1.00
SRMR               0.14              0.00
====================================================
*** p < 0.001, ** p < 0.01, * p < 0.05

If you want confidence intervals, those can also be printed, so long as they were requested as part of the output (we did in the initial model, which propogates to later models that were updated()ed based on the original model):

r screenreg(list( extract(fit, cis=TRUE, summaries = c("Observations", "CFI", "SRMR")), extract(fit2, cis=TRUE, summaries = c("Observations", "CFI", "SRMR"))), single.row=TRUE)


================================================================
                  Model 1                 Model 2               
----------------------------------------------------------------
 MPG<-HP          -0.06 [-0.08; -0.05] *  -0.02 [-0.05;  0.00]  
 WT<-DISP          0.01 [ 0.00;  0.01] *   0.01 [ 0.01;  0.01] *
 WT<->MPG         -1.02 [-1.77; -0.27] *  -0.73 [-1.25; -0.21] *
 MPG<-Intercepts  29.59 [26.59; 32.58] *  30.74 [28.25; 33.22] *
 WT<-Intercepts    1.82 [ 1.46;  2.17] *   1.68 [ 1.31;  2.04] *
 MPG<->MPG        14.04 [ 7.14; 20.95] *   8.86 [ 4.52; 13.20] *
 WT<->WT           0.21 [ 0.10;  0.32] *   0.19 [ 0.10;  0.28] *
 MPG<-DISP                                -0.03 [-0.04; -0.02] *
 WT<-HP                                   -0.00 [-0.00;  0.00]  
----------------------------------------------------------------
Observations      32                      32                    
CFI                0.87                    1.00                 
SRMR               0.14                    0.00                 
================================================================
* 0 outside the confidence interval

How to Help

If you have a tutorial or examples using MplusAutomation, please add them to the github Wiki.

In addition, on the Wiki, is a list of publications that cite or use MplusAutomation. If you use MplusAutomation in your own work --- papers, posters, presentations, etc. --- please add a citation to the list, and if possible, include an abstract or link to the full text. This helps us get to know our users and how MplusAutomation is being used.

Finally, if you find bugs or have suggestions for new features or ways to enhance MplusAutomation, please let us know! Just click the 'Issues' button at the top of the github page or go here and open a New Issue.

Lastly, if you use MplusAutomation and have space, we greatly appreciating citations. In addition to being easier to track, the recognition and credit help make it easier for us to continue putting our time into developing and sharing this software!

Owner

  • Login: michaelhallquist
  • Kind: user

GitHub Events

Total
  • Issues event: 3
  • Watch event: 6
  • Delete event: 2
  • Issue comment event: 4
  • Push event: 26
  • Pull request event: 11
  • Fork event: 2
  • Create event: 4
Last Year
  • Issues event: 3
  • Watch event: 6
  • Delete event: 2
  • Issue comment event: 4
  • Push event: 26
  • Pull request event: 11
  • Fork event: 2
  • Create event: 4

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 345
  • Total Committers: 23
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.655
Past Year
  • Commits: 10
  • Committers: 4
  • Avg Commits per committer: 2.5
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
Michael Hallquist m****t@g****m 119
Joshua Wiley j****h@g****m 98
cjvanlissa c****a@u****l 68
Sam Crawley s****m@c****z 11
Mikko Rönkkö m****o@a****i 8
garberadamc a****r@u****u 5
DaniMori d****o@g****m 5
Will Beasley w****y@h****m 4
Patrick Miller p****0@g****m 4
cjvanlissa c****a@t****u 4
Sam Crawley c****a@s****z 3
Michael Hallquist m****l@k****l 2
Hansjoerg Plieninger p****r@u****e 2
davidemorselli d****i@u****h 2
sda030 s****s@g****m 2
Caspar van Lissa v****a@f****l 1
Michael Hallquist m****l@s****t 1
Maarten Hermans m****s@g****m 1
U-CLA\mnh5174 m****4@L****u 1
Joshua Rosenberg j****n@m****u 1
aiyven s****i@h****m 1
Michael Hallquist m****l@Z****l 1
Lijin Zhang 4****7 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 108
  • Total pull requests: 20
  • Average time to close issues: 7 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 67
  • Total pull request authors: 8
  • Average comments per issue: 2.28
  • Average comments per pull request: 1.3
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 4
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • linem7 (10)
  • sda030 (8)
  • cjvanlissa (4)
  • dinanajiarch (3)
  • mhwxl2015 (3)
  • cbratt (3)
  • franciscowilhelm (3)
  • gekess (3)
  • michaelhallquist (2)
  • DaniMori (2)
  • haozhou1988 (2)
  • gitz13 (2)
  • albertostefanelli (2)
  • e-mcbride (2)
  • deb193 (2)
Pull Request Authors
  • cjvanlissa (9)
  • michaelhallquist (7)
  • sam-crawley (4)
  • DaniMori (3)
  • jenniferdguay (2)
  • haozhou1988 (1)
  • garberadamc (1)
  • hplieninger (1)
  • li-ruijie (1)
Top Labels
Issue Labels
enhancement (5) bug (3)
Pull Request Labels
codex (7)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 7,058 last-month
  • Total docker downloads: 43,529
  • Total dependent packages: 17
  • Total dependent repositories: 18
  • Total versions: 32
  • Total maintainers: 1
cran.r-project.org: MplusAutomation

An R Package for Facilitating Large-Scale Latent Variable Analyses in Mplus

  • Versions: 32
  • Dependent Packages: 17
  • Dependent Repositories: 18
  • Downloads: 7,058 Last month
  • Docker Downloads: 43,529
Rankings
Forks count: 1.6%
Dependent packages count: 4.0%
Stargazers count: 4.8%
Dependent repos count: 6.7%
Downloads: 6.8%
Average: 8.7%
Docker downloads count: 28.1%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • methods * depends
  • boot * imports
  • checkmate * imports
  • coda * imports
  • data.table * imports
  • digest * imports
  • fastDummies * imports
  • ggplot2 * imports
  • gsubfn * imports
  • lattice * imports
  • pander * imports
  • parallel * imports
  • plyr * imports
  • rlang * imports
  • texreg * imports
  • utils * imports
  • xtable * imports
  • knitr * suggests
  • relimp * suggests
  • rhdf5 * suggests
  • rmarkdown * suggests
  • tcltk * suggests
  • testthat >= 3.0.0 suggests