Monday, May 16, 2011

Replicating multilevel analysis Mplus results

Since I am relatively unfamiliar with Mplus, The first step toward building a complicated model is to replicate some simpler results using statistical packages I have more knowledge on such Stata and R, then build it up piece by piece. 

As the effort to understand the multilevel mixture modeling capacity of Mplus, I have decided to use the Mplus sample data set, "ex10.1.dat", to try alternative model specifications in both Mplus, Stata and R. I am going to post a series of code and results. 

As the first step, I try this really simple Mplus code: 
-----------------------------------------------------------
DATA: FILE IS ex10.1.dat;
VARIABLE: NAMES ARE y x1 x2 w class clus;
USEVARIABLES = y x1 x2;
WITHIN = x1 x2;
CLUSTER = clus;
ANALYSIS: TYPE = TWOLEVEL;
STARTS = 0;
MODEL:
%WITHIN%
y ON x1 x2;
%BETWEEN%
y ON ;
-----------------------------------------------------------
which gives exactly the same results as the following Stata code: 
-----------------------------------------------------------
xtreg y x1 x2, i(clus) mle
-----------------------------------------------------------

No comments:

Counter