Statalist


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

RE: st: Predicting multiple slopes with xtmixed


From   Maarten buis <[email protected]>
To   stata list <[email protected]>
Subject   RE: st: Predicting multiple slopes with xtmixed
Date   Mon, 22 Jun 2009 18:49:11 +0000 (GMT)

--- Robie Sterling wrote:
> I am attempting to estimate the individual slopes of two time periods
> in nonlinear mixed models of unbalanced panel data of weight for
> length SD values (wlz) over time, but am unclear as to the best method
> using xtmixed. Graphing the data shows growth from 0-6 mos has a
> different trajectory than growth after 6 mos.
>
> I would like to estimate the slope from age=0 to age=6, and then have
> another slope estimate for the growth thereafter for each
> participant(id).

Sounds like you want to model the effect of age as a spline. This can 
be easily implemented in -xtmixed- as it is just a transformation of 
the age variable. This transformation can be performed using the 
-mkspline- command. After that you can add the variables created with 
-mkspline- to your -xtmixed- model (or any other model) See: 
-help mkspline- and the example below. The advantage of (linear) 
splines is that it closely corresponds with what you describe and that 
the parameters are easily interpretable: In the example below the 
effect of sp1 is the effect of tenure when tenure is less than 5 years 
and the effect of sp2 is the effect of tenure when tenure is more than 
5 years.

*----------------- begin example ------------------------------
webuse nlswork, clear
mkspline sp1 5 sp2 = tenure
gen age2 = age^2
xtmixed ln_w grade age age2 sp1 sp2 union wks_ue || id: 
sum age , meanonly
local age2 = r(mean)^2
adjust grade age age2=`age2' union=1 wks_ue, by(tenure) gen(yhat)
twoway line yhat tenure, sort ytitle("predicted log(wage)")
*-------------------- end example ---------------------------------

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index