Home‎ > ‎

Mplus+Stata stuff (runmplus.ado)

To Install Runmplus

Method 1:
1. Download the current build of runmplus as a zip file here.
2. Extract to a folder on your local computer (for example c:/users/justin/downloads/runmpluspak) 
3. Run from stata:
    net install runmplus , from(c:/users/justin/downloads/runmpluspak) force

Method 2:
1. Run from stata:
    net install runmplus , from(https://s3.amazonaws.com/runmplusbucket) force

Then
If this is your first time installing runmplus, you may also need to:
  ssc install lstrfun
  ssc install strparse
  ssc install findname


Very Basic Screenshot to get you started (pdf)

runmplus
Runmplus is a Stata module (ado) that lets the user run Mplus (including the demo) as if it were part of the Stata program. runmplus formats data for Mplus, prepares a Mplus syntax file, executes Mplus, redisplays Mplus results to the Stata results window, and extracts useful information (fits, parameter estimates) from the Mplus output as local macros. Includes several sub-routines (ados) that read and return results from the Mplus output file. 

runmplus and associated programs are known to work on a Windows platform. They can be made to work in a Mac and *nix environment by resetting some shell commands, but you will have to edit the ados.

If you want to get the old version of runmplus back, click here.

Some programs included with runmplus:

runmplus_fits
Save selected results (fits and/or parameter estimates) from across multiple runmplus sessions.  Fits accumulated in a matrix return in e(fits).  Use replace option to start a new collection of fits. Identify fits you want to save using return list after a runmplus session. You may also save parameter estimates [estimate(blah)] and their standard errors[se(blah)].

runmplus_load_savedata
The loadsavedata program loads data saved from Mplus SAVEDATA into Stata. Click here to see a note on computing expected or model-implied values in a growth modeling context.

Satorra-Bentler Scaled Chi-Square calculator (lli.ado)
lli calculates a likelihood ratio test following instructions on Mplus web page, for use after MLR or WLSMV estimation.

runmplus: How to Install
Runmplus can be installed from within Stata. Just type:

  . findit runmplus

runmplus is continuously updated. I am adding new features, fixing bugs, many of which are provided by users and colleages. runmplus is now a community effort. The ssc version is not updated as often as the program changes. The best way to get the most up to date version of runmplus is to install it from my AWS. Here's how:

    net install runmplus , from(https://s3.amazonaws.com/runmplusbucket) force

This will place runmplus and associated files in your c:/ado/plus folder or where ever your system is set up to install STB ados. The force option is needed if you've already installed runmplus.


Example Session using runmplus
set more off
qui do "C:\work\syntax\Preprocessing  -  ROS 24AUG2008.do"
egen rnjid=group(projid visit)
runmplus zanimals zfruits db do as ds nc rnjid , ///
   idvariable(rnjid) ///
   model(f by zanimals-nc *1 (1); f@1; [zanimals-nc *0] ; zanimals-nc *1 (2) ;) ///
   savedata(save=fscores; file=c:\trash\trash.dat) savelogfile(c:\trash\trash)
preserve
runmplus_load_savedata , out(c:/trash/trash.out) clear
keep rnjid f
sort rnjid
tempfile f1
save `f1'
restore
merge rnjid using `f1' , sort
table _merge
drop _merge