Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Comparing coefficient across two xtmixed (growth curve) models
From
Scott Baldwin <[email protected]>
To
[email protected]
Subject
Re: st: Comparing coefficient across two xtmixed (growth curve) models
Date
Tue, 23 Nov 2010 17:37:45 -0700
Hi Lance,
You could try a (pseudo-) multivariate model. I actually don't know if
this is totally legitimate but it seems to work (I know, hardly the
reassurance you are looking for, but I believe this is okay and would
happily stand corrected if it isn't). Anyhow, basically you just have
to set up the 2 xtmixed models (unadjusted and adjusted) in a single
model. Then within that second model, you can use the test command to
test whether two coefficients are different.
Here's some example code using a built-in dataset.
Best,
Scott
***example
clear
set more off
webuse childweight
//for establishing the equivalence between the normal models
//and the multivariate model
xtmixed weight age || id:age
xtmixed weight age girl || id:age
expand 2, generate(new)
sort id age new
//variable new will be intercept in model 1
gen old=new==0 //for intercept in model 2
gen ageold=age*old // for age slope in model1
gen agenew=age*new // for age slope in model2
gen girlnew=girl*new // for girl slope in model2
//you can compare the slopes, random effects, and residuals and see
that they are the same as before (only tiny, tiny differences -- many
decimal places out)
xtmixed weight old new ageold agenew girlnew, nocons || id: old new
ageold agenew, nocons residuals(independent, by(new))
//now use the test command to compare the
//unadjusted age slope and adjusted age slope
test ageold=agenew
On Tue, Nov 23, 2010 at 2:31 PM, Lance Erickson <[email protected]> wrote:
> I am working with a panel dataset that has 4 measurement periods and estimating a mixed (growth curve) model using -xtmixed- where the dependent variable is nested within individuals. I want to compare a coefficient across two models where the only difference between the models is the introduction of an additional level-2 predictor. For example, the two models are specified like this...
>
> xtmixed y age x1 || id: age, cov(un)
> xtmixed y age x1 x2 || id: age, cov(un)
>
> Specifically, I want to test whether the estimate of x1 from the first model is significantly different than the estimate of x1 from the second model. I know I could 'eyeball' the difference but would feel better about interpreting them if there was a formal test.
>
> I understand that -suest- will not work in this situation because -predict- does not allow the -score- option after -xtmixed-. I haven't found a solution after various attempts at finding the answer through the statalist archives and alternative internet sources.
>
> Any direction or clues would be much appreciated.
>
> Thanks for considering the question,
>
> Lance
>
>
> *
> * 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/
>
*
* 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/