6
$\begingroup$

The help page for R's aov function states:

The default ‘contrasts’ in R are not orthogonal contrasts, and aov and its helper functions will work better with such contrasts: see the examples for how to select these.

What does 'work better' mean in this context? My recollection is that the anova table's F statistics are invariant to changes in contrast coding, but maybe I'm mistaken.

Here is an example that shows that the default contrasts and orthogonal contrasts yield the same anova table:

Example table with orthogonal contrasts:

> op <- options(contrasts = c("contr.helmert", "contr.poly"))
> summary(npk1 <- aov(yield ~ block + N*P*K, npk) )
            Df Sum Sq Mean Sq F value  Pr(>F)   
block        5  343.3   68.66   4.447 0.01594 * 
N            1  189.3  189.28  12.259 0.00437 **
P            1    8.4    8.40   0.544 0.47490   
K            1   95.2   95.20   6.166 0.02880 * 
N:P          1   21.3   21.28   1.378 0.26317   
N:K          1   33.1   33.14   2.146 0.16865   
P:K          1    0.5    0.48   0.031 0.86275   
Residuals   12  185.3   15.44        

Same table with non-orthogonal contrasts:

> op <- options(contrasts = c("contr.treatment", "contr.poly"))
> summary( npk2 <- aov(yield ~ block + N*P*K, npk) )
            Df Sum Sq Mean Sq F value  Pr(>F)   
block        5  343.3   68.66   4.447 0.01594 * 
N            1  189.3  189.28  12.259 0.00437 **
P            1    8.4    8.40   0.544 0.47490   
K            1   95.2   95.20   6.166 0.02880 * 
N:P          1   21.3   21.28   1.378 0.26317   
N:K          1   33.1   33.13   2.146 0.16865   
P:K          1    0.5    0.48   0.031 0.86275   
Residuals   12  185.3   15.44     

Is this just about ease of numerical computation?

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.