Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: multilevel model with crossed factors


From   [email protected] (Yulia Marchenko, StataCorp)
To   [email protected]
Subject   Re: st: multilevel model with crossed factors
Date   Thu, 21 Jun 2007 17:46:42 -0500

Sharif S. Aly <[email protected]> asks about the syntax of -xtmixed- to fit a
model with crossed and nested factors:

> Can anyone help me modify my mixed model command (levels 1, 2 and 3; 3 being
> the highest level) to account for levels 1 and 2 being crossed?
>
> xtmixed outcome || level3: || level2: || level1: , variance

Before answering Sharif's questions, let's consider first the syntax of
-xtmixed- for a simpler model with two crossed factors, level1 and level2.  In
multilevel terms, each factor is treated as being nested within one big group
of all observations with the following random-effects specification: a set of
uncorrelated and equal-variance random intercepts is defined for each of the
factor categories.  -xtmixed- provides "_all" group designation to identify
the data as one big panel and "R.varname" specification to define the
described above random-intercepts structure.  Refer to example 6 in [XT]
-xtmixed- for more details.

Thus, the crossed two-factor model can be fit by using the following syntax of
-xtmixed-:

	xtmixed outcome || _all: R.level2 || _all: R.level1, variance

Equivalently, and more efficiently, this same model can be fit by using

	xtmixed outcome || _all: R.level2 || level1:, variance

The explanation for this may be found in the literature for multilevel models
(for example, see the book "Multilevel Statistical Models", 3rd ed. by H.
Goldstein).

Going back to Sharif's original model, there is an additional level of
hierarchy, level3.  Let's assume that both factors level2 and level1 are
nested within level3.  Then, in order to fit such a model we simply add an
additional random-effects equation for level3 to the syntax of the above
two-factor crossed model as follows:

	xtmixed outcome || level3: || _all: R.level2 || level1:, variance

You may also find the following sources to be helpful:

	http://www.stata.com/bookstore/mlmus.html
	http://www.stata-journal.com/abstracts/st0095.pdf


 -- Yulia
[email protected]



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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