[R] aov help

Kingsford Jones kingsfordjones at gmail.com
Fri Nov 14 04:28:42 CET 2008


Rather than estimating the variance components via the
method-of-moments estimators, have a look at the 'nlme' and 'lme4'
packages, which provide likelihood-based tools for estimating random
and mixed models (and in the case of nlme, gls models too).
Advantages of the likelihood-based approaches include working with
unbalanced data, not producing negative variance estimates when the
MS_{error} is larger than the MS_{between groups}, and providing a
great deal of flexibility in structuring both the random effects and
error covariance matrices.

hth,

Kingsford Jones

On Thu, Nov 13, 2008 at 7:14 PM,  <john_heumann at agilent.com> wrote:
> Please pardon an extremely naive question. I see related earlier
> posts, but no responses which answer my particular question. In
> general, I'm very confused about how to do variance decomposition with
> random and mixed effects. Pointers to good tutorials or texts would
> be greatly appreciated.
>
> To give a specific example, page 193 of V&R, 3d Edition, illustrates
> using raov assuming pure random effects on a subset of coop:
>
>> raov(Conc ~ Lab / Bat, data=coop, subset = Spc=="S1")
>
> I realize ('understand' would be a bit too strong) that the same analysis,
> resulting in identical sums of squares, degrees of freedom, and residuals
> can be generated in R by doing
>
>> op <- options(contrasts=c("contr.helmert", "contr.poly"))
>> aov(Conc ~ Lab + Error(Lab / Bat), data=coop, subset = Spc=="S1")
>
> However, as shown in V&R, raov also equated the expected and observed
> mean squares, to solve for and display the variance components associated
> with the random factors, \sigma_\epsilon^2, \sigma_B^2, and \sigma_L^2 in
> a column labeled "Est.  Var.". Given the analytical forms of the expected
> mean squares for each stratum, I can obviously do this manually. But is
> there way to get R to do it automatically, a la raov? This would be
> particularly useful for mixed cases in which the analytical formulations
> of the expected mean squares may not be immediately obvious to a novice.
>
> Thanks in advance!
>
> Regards,
> -jh-
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list