Statalist


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

st: Random Coefficients in Crossed-Effects Models


From   Andrew Spiegelman <aspiege@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Random Coefficients in Crossed-Effects Models
Date   Wed, 9 Dec 2009 15:16:50 -0600

I am using Stata MP version 10 in Windows.  I would like to run a
crossed-effects model using xtmixed.  Further, I would like this model
to have random coefficients in addition to the random intercepts it
normally produces.  For example, a basic crossed-effects model looks
like

xtmixed depvar indepvar || _all: R.groupvar1 || groupvar2:

where groupvar1 and groupvar2 are the two groups I would like to
estimate random effects for but would like them not to be nested
within each other (hence why I wish to use a crossed-effects model).
But this model does not appear to permit the use of random
coefficients the way the more basic xtmixed command does:

xtmixed depvar indepvar || groupvar: indepvar

In the above case my output will contain a random intercept organized
by the group groupvar and will also have a random coefficient on
indepvar associated with groupvar.

My question is, how can I get the random coefficient into a
crossed-effects model?  Specifically, I'd like the random coefficient
to occur in BOTH groups.  I have tried the following:

xtmixed depvar indepvar || _all: R.groupvar1 indepvar || groupvar2:
xtmixed depvar indepvar || _all: R.groupvar1 || groupvar2: indepvar:

The problem with the first of these is that I get an r(198) saying
that "R.groupvar1 indpevar" is an invalid level specification.
The problem with the second one is that it appears to give me a random
coefficient on indepvar associated with groupvar2 but does not appear
to give me a random coefficient on indepvar associated with groupvar1.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index