[R-lang] Odd summary(aov()) result

Adam Baker adamb924 at gmail.com
Mon May 14 10:19:22 PDT 2007


I wonder if somebody could comment on why I get different summaries
with these two commands, which differ only in the order of the
variables.

summary(aov(MidAvg ~ Ccon*Rpres + Error(Subject/Ccon*Rpres),data=nr))
summary(aov(MidAvg ~ Rpres*Ccon + Error(Subject/Ccon*Rpres),data=nr))

With the first command, R doesn't report the main effect of Rpres.
With the second command, it does (code & output below). It's not very
important since the interaction is significant; I'm just surprised
that commutativity doesn't hold.

Thanks,
Adam


> summary(aov(MidAvg ~ Ccon*Rpres + Error(Subject/Ccon*Rpres),data=nr))

Error: Subject
          Df   Sum Sq  Mean Sq F value   Pr(>F)
Ccon       1 13245765 13245765  17.767 0.002256 **
Residuals  9  6709794   745533
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Rpres
     Df   Sum Sq  Mean Sq
Ccon  1 38923433 38923433

Error: Subject:Ccon
           Df   Sum Sq  Mean Sq F value    Pr(>F)
Ccon        2 16646448  8323224 239.589 3.334e-14 ***
Ccon:Rpres  1   906946   906946  26.107 6.229e-05 ***
Residuals  19   660053    34740
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Subject:Rpres
           Df Sum Sq Mean Sq F value  Pr(>F)
Ccon:Rpres  1 645835  645835  9.5416 0.01295 *
Residuals   9 609176   67686
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Subject:Ccon:Rpres
           Df  Sum Sq Mean Sq F value    Pr(>F)
Ccon:Rpres  2 7636019 3818009  676.48 < 2.2e-16 ***
Residuals  20  112879    5644
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Within
           Df  Sum Sq Mean Sq F value Pr(>F)
Residuals 499 9862093   19764






> summary(aov(MidAvg ~ Rpres*Ccon + Error(Subject/Ccon*Rpres),data=nr))

Error: Subject
          Df   Sum Sq  Mean Sq F value   Pr(>F)
Rpres      1 13245765 13245765  17.767 0.002256 **
Residuals  9  6709794   745533
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Rpres
      Df   Sum Sq  Mean Sq
Rpres  1 38923433 38923433

Error: Subject:Ccon
           Df   Sum Sq  Mean Sq F value    Pr(>F)
Ccon        2 16646448  8323224 239.589 3.334e-14 ***
Rpres:Ccon  1   906946   906946  26.107 6.229e-05 ***
Residuals  19   660053    34740
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Subject:Rpres
           Df Sum Sq Mean Sq F value  Pr(>F)
Rpres:Ccon  1 645835  645835  9.5416 0.01295 *
Residuals   9 609176   67686
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Subject:Ccon:Rpres
           Df  Sum Sq Mean Sq F value    Pr(>F)
Rpres:Ccon  2 7636019 3818009  676.48 < 2.2e-16 ***
Residuals  20  112879    5644
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Within
           Df  Sum Sq Mean Sq F value Pr(>F)
Residuals 499 9862093   19764


More information about the R-lang mailing list