# [R] aov or lme effect size calculation

Doran, Harold HDoran at air.org
Tue Sep 2 20:14:28 CEST 2008

```Greg

use lmer and not lme.

### Example
> example(lmer)
> anova(fm1)
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Days  1  30032   30032  45.854

Your method for eta-squared with a mixed model is another story,
however.

> -----Original Message-----
> From: Greg Trafton [mailto:greg.trafton at nrl.navy.mil]
> Sent: Tuesday, September 02, 2008 1:57 PM
> To: Doran, Harold
> Cc: r-help at r-project.org
> Subject: Re: [R] aov or lme effect size calculation
>
> Sorry about that.  My problem is computational, not
> statistical and exactly as you say:  I don't quite know how
> to get the correct variance component from either aov or lme.
>  the way to compute partial eta squared is:
>
> partial-eta-squared = SS(effect) / (SS(effect) + SS(error))
>
> AOV gives Sum Squares for both effects and the interaction,
> but lme doesn't even give that in default format.
>
> thanks,
> greg
>
> On Sep 2, 2008, at 11:43 AM, Doran, Harold wrote:
>
> > Greg
> >
> > You haven't really explained what your problem is. If it is
> conceptual
> > (i.e., how do I do it) this is not really the right place
> for in-depth
> > statistical advice, but it is often given. OTOH, if your problem is
> > computational, please explain what that is? For example, maybe you
> > know how to compute eta-squared, but you want to extract
> the variance
> > component and you can't figure that out.
> >
> > Without more info, it is hard to help. Now, with that said,
> with lme
> > (or mixed models) you have multiple variance components, so
> how would
> > you go about computing eta-squared anyhow?
> >
> >> -----Original Message-----
> >> From: r-help-bounces at r-project.org
> >> [mailto:r-help-bounces at r-project.org] On Behalf Of Greg Trafton
> >> Sent: Tuesday, September 02, 2008 10:25 AM
> >> To: r-help at r-project.org
> >> Subject: [R] aov or lme effect size calculation
> >>
> >> (A repost of this request with a bit more detail)
> >>
> >> Hi, All.  I'd like to calculate effect sizes for aov or
> lme and seem
> >> to have a bit of a problem.  partial-eta squared would be my first
> >> choice, but I'm open to suggestions.
> >>
> >> I have a completely within design with 2 conditions (condition and
> >> palette).
> >>
> >> Here is the aov version:
> >>
> >>> fit.aov <- (aov(correct ~ cond * palette + Error(subject),
> >> data=data))
> >>> summary(fit.aov)
> >>
> >> Error: subject
> >>          Df  Sum Sq Mean Sq F value Pr(>F) Residuals 15
> >> 0.17326 0.01155
> >>
> >> Error: Within
> >>             Df  Sum Sq Mean Sq F value    Pr(>F)
> >> cond          1 0.32890 0.32890  52.047 4.906e-09 ***
> >> palette       1 0.21971 0.21971  34.768 4.447e-07 ***
> >> cond:palette  1 0.50387 0.50387  79.735 1.594e-11 ***
> >> Residuals    45 0.28437 0.00632
> >> ---
> >> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> >>
> >> and here is the lme version:
> >>
> >>> fm1 <- lme(correct ~ cond * palette, random=~1 | subject,
> >> data=data)  > anova(fm1)
> >>             numDF denDF  F-value p-value
> >> (Intercept)      1    45 4031.042  <.0001
> >> cond             1    45   52.047  <.0001
> >> palette          1    45   34.768  <.0001
> >> cond:palette     1    45   79.735  <.0001
> >>
> >> Thanks so much!
> >> Greg
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help