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

Bruno Estigarribia aananda at stanford.edu
Mon May 14 11:17:48 PDT 2007


Adam,

Take a look at this page for types of sums-of-squares:
http://afni.nimh.nih.gov/sscc/gangc/SS.html
Not all of them have the property you expect.
Bruno
> Dear Adam,
>
>   
>> I'm just surprised
>> that commutativity doesn't hold.
>>     
>
> A*B is is not the equivalent notation of any combination of A, B and
> A:B. It is only the equivalent of A+B+A:B. When your design is
> completely balanced, the output should be the same regardless of the
> order. However, with unbalanced/incomplete designs you will get
> different outputs. This is because of the famous Type I / Type III
> sums of squares issue. To be honest I don't think this is the answer
> to your problem, since repeated-measures designs require only 1 data
> point per cell. Is any data point missing?
>
> Francisco
>
> On 5/14/07, Adam Baker <adamb924 at gmail.com> wrote:
>   
>> 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
>> _______________________________________________
>> R-lang mailing list
>> R-lang at ling.ucsd.edu
>> https://ling.ucsd.edu/mailman/listinfo.cgi/r-lang
>>
>>     
>
>
>   


More information about the R-lang mailing list