Bookmark and Share

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: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design


From   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design
Date   Fri, 6 May 2011 18:49:38 +0900

Jared Saletin wrote:

Thanks for the help again Phil and David.

David: The R^2 for the ANOVA model is 0.97, adjusted to 0.91, so it seems to
fitting the data well, AIC is about 418.97.

Phil: I flagged the -xtmixed- command with the -var- option, and the residual MS
is now identical between the two models, the remaining random effects do not
match the MS's from the -anova-sta model (and the cons SE remains empty).

Is there a better parameterization to use then this one, since you noted there
are 3 error terms in the -anova- (s#a s#b and residual) and 4 random effects in
the -xtmixed- model (s: _cons, s: R.a, s: R.b, residual).

I checked this parameterization against the example dataset:
http://www.ats.ucla.edu/stat/stata/examples/kirk/rbf33

In the latter case all effects are estimated and the F-ratios do indeed match
the -anova-, and again the MS does does match for the residual, but not for the
other effects (though in this case all effects are estimated properly), probably
accounting for the correct F-ratios.

It would seem that David's point about the data may be the most likely, and that
for whatever reason the current dataset is causing xtmixed to fail?

--------------------------------------------------------------------------------

Except for the residual, mean squares for random effects in ANOVA are functions
of the variance components, but they aren't the same as the variance components.
So, the values for variances for s, a and b from -xtmixed- won't be the same as
the corresponding mean squares in -anova-.

By setting the mean squares from your ANOVA table against their expectations and
solving for the variance components, I get the following:

MS_e = 0.00273899 = sigma2_e
MS_s#a = 0.012825848 = sigma2_e + 2 * sigma2_s#a
MS_s#b = 0.014614037 = sigma2_e + 3 * sigma2_s#b
MS_s = 0.02026831 = sigma2_e + 6 * sigma2_s + 2 * sigma2_s#a + 3 * sigma2_s#b

sigma2_s#a = (0.012825848 - 0.00273899) / 2 = 0.00504343
sigma2_s#b = (0.014614037 - 0.00273899) / 3 = 0.00395835
sigma2_s = (0.02026831 - 0.01008686 - 0.01187505) / 6 = -0.00028227

You can see that -anova-'s estimate for the variance of s is negative.
Least-squares (ANOVA) allows negative variance components, but -xtmixed-
doesn't.

So the model fit by -xtmixed- is slightly different from the one fit by -anova-
in this case.  That's why the F statistics aren't the same.

Joseph Coveney


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index