------------------------------------------------------------------------------- Help file forrunmplus-------------------------------------------------------------------------------Build a Mplus data file, command file, execute the command file and display Mplus log file in Stata results window. Parameter estimates, standard errors, and model and fit statistics are stored as saved results.

runmplusis a modification and extension of Michael Mitchell's stata2mplus module (see http://www.ats.ucla.edu/stat/Stata/). The Mplus demo version and new version 6 Bayesian estimator options are supported.-------------------------------------------------------------------------------

runmplusvarlist [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)demo6Mplus_command_option_shortcutsSpecial_postestimation_commands_options]

Mplus command option shortcuts:

missing(#)IDvariable(string)NGroups(string)CATegorical(string)GROUPing(string)weight(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)

SAMPStatMODindices(string)STANDardizedRESidualCINTervalNOCHIsquareh1seH1TEch3PATternsFSCOEFficeintFSDETerminacytech(string)population(string)loadresultsvarnocheck

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 theMCormontecarlocommands. NOTE: This varlist can be a STATA abbreviated varlist. 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 all variables falling between and including y1 and x3, and will work as a varlist in this command. However, you couldn't use the optioncategorical y1-x3because Mplus can't expand such a varlist.

Options

demo6- If you have both the demo version 6 and another version of Mplus,demo6will force a call to the Mplus demo version 6. If you only have the demo version, you do NOT need to specify this option.runpluswill find the right executable so long as they are in the default install locations. Specify "demo6" if running the demo version 6 of Mplus. No other demo versions are supported but you could edit the ado to achieve that (c. line 600).

missing- Specify number for missing values, default -9999

SAVEINPutfile(string),

SAVELOGfile(string)and

saveinputdatafile(string)-runplususes 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 ofrunplus, file names can be specified using the three save options. DOS shell copy commands are used and replacement of existing files will occur. NOTE: don't 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 assavelogfile.

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 theMplusprogram. You can put anything you want in any of these options, but only options that make sense toMpluswill be useful. Modifications or special circumstances are addressed in the next section.

Description

runmplusbrings the powerful latent variable analysis capabilities ofMplus(see www.statmodel.com) into the Stata enviroment. Whilerunmplusdoes 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.runmplusis a modification and extension of Michael Mitchell'sstata2mplusmodule (see http://www.ats.ucla.edu/stat/Stata/). Therunmplusmodule 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)).

Mplusis required to use this STATA module. If you don't have Mplus, visit www.statmodel.com. Moreover,runmplusassumes mplus.exe is located in the windows path (or that mpdemo6.exe is in c:\program files\mplus demo\).runmpluswill not check code for errors.runmpluscan't be used efficiently without an understanding of the Mplus command syntax.

Known Bugs and LimitationsLong 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.

runmpluswill not allow you to use the PLOT option in Mplus.

runmplusmay have trouble reading parameter estimates when more than one latent class variable is used. Use thesaveinpandsaveinputdatafileoptions and run the model from Mplus.

-------------------------------------------------------------------------------ExamplesSimple 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 x1x3;)

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 x2x3; y3 on y1 y2 x2;)

Path analysis with a combination of continuous and categorical dependent variab > les

.

runmplus y1-y3 x1-x3, categorical(y3) model(y1 y2 on x1 x2 x3; y3on 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 indica > tors

.

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 constraint > s, using

savedataandsavelogfileoptions, and following up withrunmplus_load_savedatabringing 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 OptionsData Options not usually needed- The user should not generally need to specify Mplus DATA "file", "format", "type", "nobservations" options.runmplustakes 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 theifandinstatements 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 examplegrouping(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 theDEFINEoption 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 innumber listthe 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 (whentype(mixture)is used) using raw data weighted by the estimated class probabilities.

8- optimization history whentype(mixture)is used).

9- available when MONTECARLO command is used whentype(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.

Richard N Jones, ScD Institute for Aging Research Hebrew SeniorLife, Boston, MA jones@mail.hrca.harvard.eduAuthorupdates and other STATA+Mplus tools at http://sites.google.com/site/lvmworkshop > /home/runmplus-stuff

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