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

# Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design

 From "Airey, David C" To "statalist@hsphsun2.harvard.edu" Subject Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design Date Fri, 6 May 2011 08:47:16 -0500

```.

Math is helpful! I think I remember reading the mixed model routine in JMP 9 allows negative estimates of variance components. I don't quite understand the choice between SAS and StataCorp statisticians on this point.

> 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/
```