Mplus+Stata stuff (runmplus.ado)

To Install Runmplus

Run from stata:

  net install runmplus , from( force


If this is your first time installing runmplus, you may also need to:

  ssc install lstrfun
  ssc install strparse
  ssc install findname


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 and Mac OS platforms.

Some programs included with runmplus:


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)].


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 colleagues. runmplus is now a community effort. The ssc version is not updated as often as the program changes. You can get it from ssc (findit runmplus in your Stata command window). But, I think 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( force

This will place runmplus and associated files in your c:/ado/plus folder or where ever your system is setup 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"
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)
runmplus_load_savedata , out(c:/trash/trash.out) clear
keep rnjid f
sort rnjid
tempfile f1
save `f1'
merge rnjid using `f1' , sort
table _merge
drop _merge