Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Jared Saletin <jsaletin@berkeley.edu> |

To |
"Joseph Coveney" <jcoveney@bigplanet.com> |

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

Date |
Fri, 6 May 2011 10:15:52 -0700 |

This is great, thank you Joesph, Is that model considered invalid then, with negative components? Should the xtmixed output not be used? Or just accept that its a slightly different model from the one ANOVA is able to fit? On May 6, 2011, at 2:49 AM, Joseph Coveney wrote: > > 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/

**Follow-Ups**:**Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design***From:*"Joseph Coveney" <jcoveney@bigplanet.com>

**References**:**Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design***From:*Jared Saletin <jsaletin@berkeley.edu>

**Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design***From:*"Joseph Coveney" <jcoveney@bigplanet.com>

- Prev by Date:
**R: st: R: imputation of missing dates** - Next by Date:
**Re: st: how to generate mean for a secquence of five year of a variable** - Previous by thread:
**Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design** - Next by thread:
**Re: st: Stumped...xtmixed and ANOVA F-stats not agreeing for balanced design** - Index(es):