-------------
Help file for runmplus (version 2.0 2013.05.26)
-------------


Build a Mplus data file, command file, execute the command file
and display Mplus log file in Stata results window. Parameter matrices, estimates,
standard errors, and model and fit statistics are stored as saved
results. runmplus is a modification and extension of Michael Mitchell's
stata2mplus module (see http://www.ats.ucla.edu/stat/Stata/). The Mplus demo version is supported.


 runmplus requires
 lstrfun,
 findname, and
 strparse to run. These can be obtained
from the ssc (click links to install).


Keep up-to-date on changes to runmplus, and
 net install runmplus , from(http://dl.dropboxusercontent.com/u/458793/RUNMPLUS) force (click to run). If
for whatever reason you'd like the old version of runmplus back, visit this web page.

-------------


 runmplus varlist [if] [in] ,
 [
 SAVEINPutfile(string)
 SAVELOGfile(string)
 saveinputdatafile(string)
 log(string)
 TItle(string)
 DATa(string)
 VARiable(string)
 DEFine(string)
 ANalysis(string)
 MOdel(string)
 OUTput(string)
 savedata(string)
 PLOT(string)
 mc(string)
 montecarlo(string)
 population(string)
 TItle(string)
 demo6
 demo7
 Mplus_command_option_shortcuts
 Special_postestimation_commands_options
 ]


 Mplus command option shortcuts:


 missing(#)
 IDvariable(string)
 NGroups(string)
 CATegorical(string)
 GROUPing(string)
 wgt(string)
 CLUSter(string)
 within(string)
 between(string)
 tscores(string)
 centering(string)
 ttype(string)


 type(string)
 ESTimator(string)
 MATrix(string)
 PARAMeterization(string)
 VARiance(string)
 ITERations(string)
 SDITERations(string)
 H1ITERations(string)
 MITERations(string)
 MCITERations(string)
 MUITERations(string)
 CONvergence(string)
 H1CONvergence(string)
 COVERage(string)
 logcriterion(string)
 MCONVergence(string)
 MCCONVergence(string)
 MUCONVergence(string)
 mixc(string)
 mixu(string)
 LOGHigh(string)
 LOGLow(string)
 UCELLsize(string)
 ALGOrithm(string)


 SAMPStat
 MODindices(string)
 STANDardized
 RESidual
 CINTerval
 NOCHIsquare
 h1se
 H1TEch3
 PATterns
 FSCOEFficeint
 FSDETerminacy
 tech(string)
 population(string)
 loadresults
 varnocheck


System Set-up


Runmplus will try to identify where your Mplus executable is, regardless if you are using a full or demo version. However, a smart way to configure runmplus is to add a line to your profile.do that
identifies the full path, using the short file name, of your Mplus executable, for example:


 global mplus_path `"C:\Progra~1\Mplus\mplus.exe"'


If you work in a Windows environment. If you work in a MacOS environment, and
have installed in default locations, runmplus will assume


 global mplus_path "/applications/mplus/mplus"


See here for more examples.


Read more about a profile.do files
here,
here,
here, and
 here (for our friends on MacOS)


Although programmed in a Windows environment, every attempt has been made
to have  runmplus work in a MacOS environment. *Nix should work as
well.


Required commands


varlist - Variables to be used in the Mplus model. This command
is not actually required. If it's left blank runmplus will assume
you want all of the variables, unless there is text in the MC or
montecarlo commands.


NOTE: This varlist can be a Stata abbreviated
varlist. But, keep in mind that Mplus and Stata expand varlists differently,
and what works in Stata may not work in Mplus. For example, the
abbreviated list y1-x3 will identify to Stata all variables falling
between and including y1 and x3, and will work as a varlist
in this command. However, you couldn't use the option
in a Mplus command (e.g.,  cat(y1-x3)) because Mplus can't expand such a varlist.


Options


demo6 and demo7 - If you have both the demo
version 6 or 7 and another version of Mplus, demo6
will force a call to the Mplus demo version 6.
If you only have the demo version, you do NOT need to
specify this option. runmplus will find the
right executable so long as they are in the default install
locations. Specify "demo6" if running the demo version 6 of Mplus.


missing - Specify number for missing values, default -9999


SAVEINPutfile(string) ,


SAVELOGfile(string) and


saveinputdatafile(string) - runmplus
uses temporary file names to store the Mplus command file
and data file. By default, these are not saved. If the
user wishes to have these files to review after execution
of runmplus, file names can be specified
using the three save options. DOS shell copy
commands are used and replacement of existing files
will occur.


NOTE: do not include the
suffexes (inp, out, dat).


log(string) - if "off" is specified, runmplus
supresses the dump of the Mplus output file
to the Stata results window. Any other entry will have
no influence on runmplus processing.  Can be used at the
same time as savelogfile.


Mplus_command_file_options - See below and the
Mplus Users Guide. The Mplus command file options are
captured as strings and placed into a ascii file that
is sent to the Mplus program. You can put anything
you want in any of these options, but only options that
make sense to  Mplus will be useful. Modifications or
special circumstances are addressed in the next section.


Description


runmplus brings the powerful latent variable analysis
capabilities of Mplus (see www.statmodel.com) into the
Stata enviroment. While runmplus does little more than
data reformat and ascii file creation, it removes a lot of
the hassle of estimating categorical and continuous latent
variable models using Mplus. runmplus is a
modification and extension of Michael Mitchell's
stata2mplus module (see
http://www.ats.ucla.edu/stat/Stata/). The runmplus
module does a number of tasks:


(1) creates an ascii data file suitable for use with Mplus
using code from stata2mplus, and also


(2) creates a mplus command file using options specified,


(3) executes the mplus command file using the dos shell
command feature, and


(4) dumps the Mplus model results to the screen/log
(unless directed not to by the user using log(off)), and


(5) extracts important and/or useful information out of
the mplus ouput file and makes these available as returned
results (type  return list after a  runmplus
command).


Mplus is required to use this Stata module. If you
don't have Mplus, visit www.statmodel.com.
runmplus can't be used efficiently without an understanding of the Mplus
command syntax.


Known Bugs and Limitations


Long variable names: Mplus does not support long variable names, so neither does runmplus.
Your runmplus/Mplus file will run with a long file name so long as the first
eight characters are unique. It'd be better to make them short in Stata first.


runmplus allow you to put code in the Mplus PLOT command, but has no
way of executing or extracting graphics or data prepared for graphics by Mplus.


runmplus may have trouble reading parameter estimates when more than
one latent class variable is used. Use the  saveinp and  saveinputdatafile
options and run the model from Mplus.


Examples


Simple linear regression for a continuous dependent variable


. runmplus y1 x1 x3, model(y1 on x1 x3;)


Logistic regression


. runmplus y1 x1 x3, categorical(y1) type(logistic) model(y1 on x1 x3;)


Path analysis with continuous dependent variables


. runmplus y1-y3 x1-x3, model(y1 y2 on x1 x2 x3; y3 on y1 y2 x2;)


Path analysis with categorical dependent variables


. runmplus y1-y3 x1-x3, categorical(y1 y2 y3) model(y1 y2 on x1 x2 x3; y3 on y1 y2 x2;)


Path analysis with a combination of continuous and categorical dependent variables


. runmplus y1-y3 x1-x3, categorical(y3) model(y1 y2 on x1 x2 x3; y3 on y1 y2 x2;)


Exploratory factor analysis with continuous indicators


.  runmplus y1-y12, type(efa 1 4)


Exploratory factor analysis with categorical indicators


.  runmplus y1-y12, type(efa 1 4) categorical(all)


Exploratory factor analysis with a mixture of categorical and continuous indicators


.  runmplus y1-y12, type(efa 1 4) categorical(y1 y3 y5 y7 y9 y11)


Confirmatory factor analysis with continuous indicators


.  runmplus y1-y6, model(f1 by y1-y3; f2 by y4-y6;)


Confirmatory factor analysis with continuous indicators
and equality constraints, using savedata
and savelogfile options, and following up
with  runmplus_load_savedata bringing the factor
estimates back into the current data set


.  runmplus y1-y6 id , idvariable(id) ///

   model(f by y1-y6 *1 (1); f@1; [y1-y6 *0] ; y1-y6 *1 (2) ;) ///

   savedata(save=fscores; file=c:\trash\trash.dat) ///

   savelogfile(c:\trash\trash)  // note no suffix on trash.out


.  preserve


.  runmplus_load_savedata , ///

   out(c:/trash/trash.out) clear  // note with suffix on trash.out


.  id f

.  sort id

.  tempfile f1

.  save `f1'

.  restore

.  merge id using `f1' , sort

.  table _merge

.  drop _merge


Mplus Program Options


Data Options not usually needed - The user should
not generally need to specify Mplus DATA "file",
"format", "type", "nobservations" options. runmplus takes
care of all of this for you.


NGroups - number of groups


Variable Options not needed - Generally, the Mplus "names",
"useobservations", "usevariables" will not be needed. Use
the if and in statements to
accomplish the same thing as "Useobservations", and you
must specify a variable list so "Usevariables" is
assumed to be all of the variables.


categorical - names of categorical dependent
variables. Use a string Mplus will understand.


Grouping - name and label values of grouping variable.
Put text here just like you would after the GROUPING option
in Mplus. For example grouping(gender(1=male 2=female)).
In the model statement, refer to these groups as you would in Mplus
(eg., model(f by y1 y2; f on x; model male:; f on x; model
female:; f on x;)).


Note the semi-colon after model <group>: This helps runmplus
parse the command line.


It is possible you'll get an error message or the grouping
statement won't be parsed correctly, particularly if you have a long
grouping statement. If this happens, try shortening the grouping
statement by using shorter group lablels.


DEFINE- The whole
point of this program is to allow you to do this kind
of stuff in Stata. But, if you want it, you can specify
a Mplus option string within the DEFINE option and
have Mplus make new variables. This might be useful
if you wanted a new variable in the Mplus analysis
but not as a part of the master data set.


type - refers to "type" option in Mplus ANALYSIS
command. The default is general. Other options include
meanstructure, missing, H1, Mcohort, Mixture, Complex,
Twolevel, EFA # #, Logistic.


estimator - Mplus will recognize and implement ML,
MLM, MLMV, GLS, WLS, WLSM, WLSMV, MLR, MLF, MLM, MLMV,
ULS estimators if the model type can support it. If
nothing is specified, the Mplus default estimators
are used.


matrix - matrix to be evaluated. You can put
anything you want but Mplus will only
allow "covariance" or "correlation"


tech(number list) - list in number list
the technical output to be displayed (just list the numbers)


1 - parameter specifications and starting values for
all free parameters.


2 - parameter derivatives.


3 - estimated covariance and correlation matrices
for the parameter estimates.


4 - means and covariace and correlation matrices
for the latent variables in the model.


5 - optimization history.


6 - optimization in estimating the sample statistics.


7 - sample statistics for each class
(when type(mixture) is used) using raw
data weighted by the estimated class probabilities.


8 - optimization history when
type(mixture) is used).


9 - available when MONTECARLO command is
used when type(mixture) is also used,
and produces error messages regarding convergence
for each replication of the Monte Carlo study.


10 - used in conjunction with TYPE=MIXTURE to
request univariate and bivariate model fit information
for the categorical dependent variables in the model.


11 - used in conjunction with TYPE=MIXTURE request
the Lo-Mendell-Rubin likelihood ratio test of model fit.


12 - used in conjunction with TYPE=MIXTURE to
request residuals for observed versus model estimated means,
variances, covariances, univariate skewness, and univariate
kurtosis.


13 - used in conjunction with TYPE=MIXTURE to
request two-sided tests of model fit for univariate,
bivariate, and multivariate skew and kurtosis (Mardia’s
measure of multivariate kurtosis).


14 - used in conjunction with TYPE=MIXTURE to
request a parametric bootstrapped likelihood ratio test.


Author/Curator


Many people have contributed to  runmplus since it
was first introduced, some knowingly like Frances M. Yang, Doug C.
Tommet, Alden L. Gross, Adam Carle, George Leckie, Tor Neilands,
Elan Cohen, Betsy Feldman, and others unknowingly (Michael
Mitchell - thanks for  stata2mplus). Also many users'
comments and suggestions have greatly improved the software.
To report bugs, request features, or ask questions about
using runmplus, please feel free to contact me at:


Richard N Jones, ScD

Brown University

richard_jones@brown.edu


News and Updates


Between SSC posts, updates to  runmplus and other Stata+Mplus tools can be obtained from
http://lvmworkshop.org/home/runmplus-stuff and/or by using the net install commands above.


Users may also wish to subscribe to the runmplus
mailing list and keep informed about software updates, and
see/post tips and hints by sending email to
runmplus+subscribe@googlegroups.com
and/or visit
the runmplus Google group.


Also see


On-line: help for
   stata2mplus
   runmplus
   runmplus_fits
   read_parameterestimates_general
   read_parameterestimates
   read_convergence
   lli