Mplus
Tuesday
March 19, 2024
HOME ORDER CONTACT US CUSTOMER LOGIN MPLUS DISCUSSION
Mplus
Mplus at a Glance
General Description
Mplus Programs
Pricing
Version History
System Requirements
Platforms
Mplus Demo Version
Training
Mplus Web Talks
Short Courses
Short Course Videos
and Handouts
Web Training
Mplus YouTube Channel
Documentation
Mplus User's Guide
Mplus Diagrammer
Technical Appendices
Mplus Web Notes
FAQ
User's Guide Examples
Mplus Book
Mplus Book Examples
Mplus Book Errata
Analyses/Research
Mplus Examples
Papers
References
Special Mplus Topics
Bayesian SEM (BSEM)
Complex Survey Data
DSEM – MultiLevel Time Series Analysis
Exploratory SEM (ESEM)
Genetics
IRT
Measurement Invariance
and Alignment
Mediation Analysis
Missing Data
Mixture Modeling
Multilevel Modeling
Randomized Trials
RI-CLPM
RI-LTA
Structural Equation Modeling
Survival Analysis
How-To
Using Mplus via R
Mplus plotting using R
Chi-Square Difference
Test for MLM and MLR
Power Calculation
Monte Carlo Utility
Search
 
Mplus Website Updates
Mplus Privacy Policy
VPAT/508 Compliance

Mplus Plotting Using R

The Mplus GH5 File, Mplus Plots User Interface App, and Mplus R Functions

Starting with Version 8.9, plots can be viewed in R with the R Shiny app, Mplus Plots User Interface. Mplus Plots User Interface app accepts the Mplus GH5 file as input and provides a list of available plots. While Mac and Linux users cannot get Mplus plots in the current Mplus version using the PLOT command, they can use the PLOT command to generate a GH5 file for use in the Mplus Plots User Interface app. The app uses the Mplus R functions to display selected plots.

While plots can be viewed in the Mplus Plots User Interface, the Mplus R functions can also be accessed directly for more specific plot use or for getting access to the plot data. The Mplus R Tutorial describes how to get started and lists the current Mplus R functions.

R and the RHDF5 Package

The R program is available from the CRAN website. In order to read the GH5 file created by Mplus, the rhdf5 package from Bioconductor must be loaded in R. The latest version of the rhdf5 package is version 3.16 and is compatible with R version 4.2 for Windows, Mac OS X and Linux operating systems.

Note that while the set of R functions has been written with users of Mplus Mac OS X and Linux versions in mind, the use of the GH5 file in R with the HDF5 package is not limited to these operating systems. Users of Mplus Windows can also load the GH5 file into R for Windows.

Running the Mplus Plots User Interface App

The Mplus Plots User Interface app uses the R shiny package. The shiny package should be installed before loading the Mplus Plots User Interface app. The package can be installed with options under the Packages menu or on the command line in console:

install.packages('shiny')

The packages DT and data.table are also needed for inputting values for plots with covariates. These packages should also be installed before running the app.

install.packages('DT')
install.packages('data.table')

Download MplusPlotsUI.zip, which contains the files for the app, and uncompress it. Then run the app with the following command in R console (assuming the file was uncompressed into the Downloads folder):

shiny::runApp('/Users/useraccount/Downloads/rplotsui/')

The app will open in a browser window/tab. To close the app, close the browser window/tab. Press ESC in the R console window to regain the R prompt.

Getting Plots in the Mplus Plots User Interface

Enter the name of the GH5 file under Choose GH5 file or click Browse to open a File dialog box. Note when browsing for a file, select a file in the dialog and then click on the Upload button. The file is only "uploaded" into the app only and not uploaded to any server. Available plots in the GH5 file will appear in the Select a plot to view dropdown option. Various settings for each plot will appear as the plot is selected in this dropdown option. Most plots can be viewed in the app. For plots where the interface or an R function is not available, a message will appear.

A table of available Mplus plots, the associated R function and available User Interface selections will be updated as more functions/interface are added.

The File mplus.R

The file mplus.R (included in MplusPlotsUI.zip) contains the set of R functions to assist users view plots and extract plot data from the GH5 file created from an Mplus run. These functions can be loaded into R directly without the app using the source command to load the mplus.R file. The file is sourced automatically when running the app. A description of each function and its syntax are given in the Mplus R Tutorial.