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

Re: st: xtmixed: variation at the highest level

From   Michael Norman Mitchell <>
Subject   Re: st: xtmixed: variation at the highest level
Date   Mon, 08 Feb 2010 19:16:54 -0800

Dear Peter

I share your confusion about these particular examples. As I look at the "nlswork" dataset, it seems that this data represents repeated observations of women across years, with "idcode" representing the identifier of the woman (the level 2 identifier) and "year" representing the year of measurement of the woman within the year. Using "year" as a level 1 variable (that varies within each woman), we could form a simple random intercept model as

* Random intercept model
xtmixed ln_w year  || idcode:

and then extend this to a random slope model, assessing the extent to which the slope of "year" varies across women.

xtmixed ln_w year  || idcode: year

Seeing that there is variation in the slope of "year" predicting "ln_w" across women, we could then try to explain this variation, by, as you suggested, introducing a cross level interaction. For example, perhaps women who are college graduates have higher slopes that non-college graduates (i.e. the relationship between "year" and "ln_w" is higher for college graduates than non-college grads). We could try this model like this...

xtmixed ln_w i.collgrad##c.year  || idcode: year, cov(unstruct)

In fact, the results show exactly this result. The slope between "year" and "ln_wage" is -0.049 for non-college graduates, but for college graduates, the slope is higher by 0.0056 (p < 0.001).

ln_wage | Coef. Std. Err. z P>|z| [95% Conf. Interval]
1.collgrad | -.0493273 .115747 -0.43 0.670 -.2761872 .1775326 year | .0175735 .0006167 28.50 0.000 .0163648 .0187822
     c.year |
1 | .0056061 .001491 3.76 0.000 .0026838 .0085284
_cons | .2003554 .0465266 4.31 0.000 .1091649 .291546

 I hope this helps.

Best regards,

Michael N. Mitchell
See the Stata tidbit of the week at...
Visit me on Facebook at...

Peter Goff wrote:
I have a question that pertains to one of the examples given in the xtmixed help file. Using the two-level data set "webuse nlswork" from the first example in the help file, I see that the command: xtmixed ln_w grade age c.age#c.age ttl_exp tenure c.tenure#c.tenure || id: grade, cov(unstruct) can be used to create a random coefficient model. However, the data file itself shows that the variable grade does not vary at the highest level (level 2), i.e. it is constant within id (level 1).

From a multi-level modeling approach I have interpreted random coefficient models to mean that the slope (of grade, in this example) for each cluster can have a different impact upon the dependent variable (ln_w, here). Although within this context there is no variation of grade within individuals so I'm not clear how to interpret this model.

Taking this a step further, if the model included an interaction between the level 2 variable and a level 1 variable such as: xtmixed ln_w grade c.grade#c.age age c.age#c.age ttl_exp tenure c.tenure#c.tenure || id: grade, cov(unstruct)
would this change the interpretation of the random component of grade?

Kind thanks,

Peter Trabert Goff
PhD student
Department of Leadership, Policy, and Organizations
Vanderbilt University

Peabody #514
230 Appleton Place
Nashville, TN 37203-5721
Tel. 615-415-7844
Fax. 615-322-6596

*   For searches and help try:
*   For searches and help try:

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