Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Latent Growth model and mixed effects random slopes model - equivalent ?


From   kmacdonald@stata.com (Kristin MacDonald, StataCorp LP)
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Latent Growth model and mixed effects random slopes model - equivalent ?
Date   Wed, 01 May 2013 17:57:27 -0500

Robert Long <W.R.Long@leeds.ac.uk> is trying to reproduce a growth curve model
fit by -xtmixed- with a latent growth curve model fit by -sem- and is
obtaining different results.  

Robert began by fitting a random-intercept model using the commands

  . use http://www.stata-press.com/data/r12/pig.dta, clear
  . xtmixed weight week ||id: , var
  . reshape wide weight, i(id) j(week)
  . sem (Intercept@1 Slope@0 -> weight1) ///
    (Intercept@1 Slope@1 -> weight2) ///
    (Intercept@1 Slope@2 -> weight3) ///
    (Intercept@1 Slope@3 -> weight4) ///
    (Intercept@1 Slope@4 -> weight5) ///
    (Intercept@1 Slope@5 -> weight6) ///
    (Intercept@1 Slope@6 -> weight7) ///
    (Intercept@1 Slope@7 -> weight8) ///
    (Intercept@1 Slope@8 -> weight9) ///
    , nocons means(Intercept Slope) ///
    cov(Slope@0 e.weight1@fix1 e.weight2@fix1 e.weight3@fix1 ///
        e.weight4@fix1 e.weight5@fix1 e.weight6@fix1 e.weight7@fix1 ///
        e.weight8@fix1 e.weight9@fix1 Intercept*Slope@0)


These commands produce equivalent variance components, and the coefficient
reported by -xtmixed- for in the fixed portion of the model corresponds to the
mean of the latent variable Slope in the -sem- output.  However, -xtmixed-
reports the intercept in the fixed portion of the model as 19.35561 while the 
mean of the Intercept latent variable in the -sem- output is 25.56551.  

This difference is related to the way week is coded.  In the original dataset,
the values of week range from 1 to 9.  If we recode this so that week ranges
from 0 to 8, the values of week will now correspond to the constraints placed
on the Slope coefficients in the -sem- command when we type Slope@0, Slope@1,
and so on.  With this modification, -sem- and -xtmixed- will produce
equivalent results for each of Robert's proposed models.  The full code is
given below.


-- Kristin
kmacdonald@stata.com



  use http://www.stata-press.com/data/r12/pig.dta, clear
  replace week = week - 1
  
  /* random intercept */
  xtmixed weight week || id: , var
  preserve
  reshape wide weight, i(id) j(week)
  sem (Intercept@1 Slope@0 -> weight0) ///
    (Intercept@1 Slope@1 -> weight1) ///
    (Intercept@1 Slope@2 -> weight2) ///
    (Intercept@1 Slope@3 -> weight3) ///
    (Intercept@1 Slope@4 -> weight4) ///
    (Intercept@1 Slope@5 -> weight5) ///
    (Intercept@1 Slope@6 -> weight6) ///
    (Intercept@1 Slope@7 -> weight7) ///
    (Intercept@1 Slope@8 -> weight8) ///
    , nocons means(Intercept Slope) ///
    cov(Slope@0 e.weight0@fix1 e.weight1@fix1 e.weight2@fix1 ///
        e.weight3@fix1 e.weight4@fix1 e.weight5@fix1 e.weight6@fix1 ///
        e.weight7@fix1 e.weight8@fix1 Intercept*Slope@0)
  restore
		
  /* random intercept and random slope */
  xtmixed weight week || id: week, var
  preserve
  reshape wide weight, i(id) j(week)
  sem (Intercept@1 Slope@0 -> weight0) ///
    (Intercept@1 Slope@1 -> weight1) ///
    (Intercept@1 Slope@2 -> weight2) ///
    (Intercept@1 Slope@3 -> weight3) ///
    (Intercept@1 Slope@4 -> weight4) ///
    (Intercept@1 Slope@5 -> weight5) ///
    (Intercept@1 Slope@6 -> weight6) ///
    (Intercept@1 Slope@7 -> weight7) ///
    (Intercept@1 Slope@8 -> weight8) ///
    , nocons means(Intercept Slope) ///
    cov(e.weight0@fix1 e.weight1@fix1 e.weight2@fix1 ///
        e.weight3@fix1 e.weight4@fix1 e.weight5@fix1 e.weight6@fix1 ///
        e.weight7@fix1 e.weight8@fix1 Intercept*Slope@0)
  restore
		
  /* covariance between random intercept and random slope */
  xtmixed weight week || id: week, var covariance(unstructured)
  reshape wide weight, i(id) j(week)
  sem (Intercept@1 Slope@0 -> weight0) ///
    (Intercept@1 Slope@1 -> weight1) ///
    (Intercept@1 Slope@2 -> weight2) ///
    (Intercept@1 Slope@3 -> weight3) ///
    (Intercept@1 Slope@4 -> weight4) ///
    (Intercept@1 Slope@5 -> weight5) ///
    (Intercept@1 Slope@6 -> weight6) ///
    (Intercept@1 Slope@7 -> weight7) ///
    (Intercept@1 Slope@8 -> weight8) ///
    , nocons means(Intercept Slope) ///
    cov(e.weight0@fix1 e.weight1@fix1 e.weight2@fix1 ///
        e.weight3@fix1 e.weight4@fix1 e.weight5@fix1 e.weight6@fix1 ///
        e.weight7@fix1 e.weight8@fix1)
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index