Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Are my -xtmixed- intercepts accurate?

From   Brandon Olszewski <>
Subject   st: Are my -xtmixed- intercepts accurate?
Date   Tue, 17 Aug 2010 12:40:17 -0700

Im building my first model using -xtmixed- and am struggling with
modeling specification and interpreting the output. I want to use a
three-tier panel model: the effect of being in a treatment group
(tx_group) and time (pre- and post-test times) on scores with the
expectation that scores for the treatment group (as opposed to
non-tx/control group) increase more. I am also interested in the
degree to which teacher assignment (tid), independent of group
assignment, affects scores.

I’ve been using Rabe-Hesketh & Skrondal’s “Multilevel and Longitudinal
Modeling Using Stata, 2nd edition”. My hunch is that my question are
easy to answer for someone who has experience with this – but I’m a
newbie and feel frustrated and lost. Part of that is me flipping back
and forth between the sections on Assigning values to random
intercepts (2.9), Random-coefficient models (4.X), Longitudinal models
(5.X) and Models with nested effects (10.X) because I can’t seem to
find a good example of modeling nested panel data.

I’m trying to model this using the following syntax:

 xtmixed score time tx || tid: tx, cov(un) || id:, cov(uns) mle

The -lrtest- has suggested that this model does a better job than
others at predicting scores. I tested that like so:
xtmixed score time tx || id: , mle
estimates store byid
xtmixed score time tx || tid: || id: , mle
estimates store ri
lrtest byid ri
 xtmixed score time tx || tid: tx, cov(un) || id:, cov(uns) mle
 estimates store rs
lrtest ri rs

This last -lrtest- produced the following:
Likelihood-ratio test                                  LR chi2(2)  =     12.28
(Assumption: rint nested in rslope)                    Prob > chi2 =    0.0022
...which I interpret to indicate that this model - with students
nested in teachers and allowing the effect of treatment to vary by
teacher - to be a better fit than the previous one.

Using the estimates from the random slope model (rs), I tried to
produce a table showing the intercepts (by teacher) and slopes (by
teacher) for the different fitted lines. I did that with the
predict rspred, xb
gen rsresidual = avg - rspred
quietly tabulate tid, gen (rstint)
reg rsres rstint*, noconstant
est store rstintercepts
est table rstintercepts

I compared these predicted intercepts to the actual scores (by
teacher), and also to those calculated using a Bayes’ prediction with:
quietly xtmixed avg time tx || tid: tx, cov(un) || id:, cov(uns) mle
predict eb1 eb2 eb3, reffects

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index