Re: [R-sig-eco] Marrying Tukey's HSD and ANOVA results

2011-11-18 Thread Ben Bolker
Lara R. Appleby 04 Lara.R.Appleby.04@... writes:

  I've done a standard two way ANOVA using glm on the dependent
 variable clutchsize with the two factors treatment (which has 3
 levels called 1, 2, and 3) and species (which has two levels
 called 1 and 2). Apparently there is no significant interaction
 term. Then I did Tukey's HSD and found that there were significant
 differences between species at only one of the three treatment
 levels, treatment level 1.

 
 ##ANOVA RESULTS
   summary(aov((clutchsize~treatment*species)))
 Df Sum Sq Mean Sq F value   Pr(F)
 treatment   1  29.26  29.264  7.0230  0.00884 **
 species 1 138.14 138.143 33.1526 4.13e-08 ***
 treatment:species   1   8.11   8.110  1.9464  0.16487
 Residuals 163 679.20   4.167

  I think you failed to tell R that `treatment' was a factor
(i.e. a categorical variable).  The Df in the output above
suggests that you are actually (accidentally) running a linear
regression on treatment number, rather than an ANOVA on
treatment.  The Df should be 2,1,2 for the design you
described above.

  That doesn't answer your other question, but it would
be better to sort out the more fundamental issue first.

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Marrying Tukey's HSD and ANOVA results

2011-11-16 Thread Lara R. Appleby 04
I've done a standard two way ANOVA using glm on the dependent variable clutchsize  
with the two factors treatment (which has 3 levels called 1, 2, and 3) and species  
(which has two levels called 1 and 2). Apparently there is no significant interaction  
term. Then I did Tukey's HSD and found that there were significant differences  
between species at only one of the three treatment levels, treatment level 1.  
Are these in fact conflicting results?


##ANOVA RESULTS

 summary(aov((clutchsize~treatment*species)))

   Df Sum Sq Mean Sq F value   Pr(F)
treatment   1  29.26  29.264  7.0230  0.00884 **
species 1 138.14 138.143 33.1526 4.13e-08 ***
treatment:species   1   8.11   8.110  1.9464  0.16487
Residuals 163 679.20   4.167
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##TUKEY HSD RESULTS

 TukeyHSD(aov(clutchsize~treatment*species))

  Tukey multiple comparisons of means
95% family-wise confidence level

Fit: aov(formula = clutchsize ~ treatment * species)

$treatment
  difflwr   upr p adj
2-1  1.3245614  0.4184292 2.2306936 0.0020030
3-1  1.0416667  0.1316071 1.9517262 0.0204117
3-2 -0.2828947 -1.1806793 0.6148899 0.7368331

$species
diff   lwr   upr p adj
2-1 -1.89988 -2.544747 -1.255013 0

$`treatment:species`
  diff lwrupr p adj
2:1-1:1  1.1791506 -0.19269072  2.5509919 0.1364846
3:1-1:1  0.6476190 -0.73345324  2.0286913 0.7550479
1:2-1:1 -2.4225564 -4.08045729 -0.7646555 0.0005858
2:2-1:1 -0.8357143 -2.46652980  0.7951012 0.6787094
3:2-1:1 -0.6357143 -2.26652980  0.9951012 0.8706501
3:1-2:1 -0.5315315 -1.89354633  0.8304833 0.8701101
1:2-2:1 -3.6017070 -5.24376636 -1.9596476 0.000
2:2-2:1 -2.0148649 -3.62957317 -0.4001566 0.0055886
3:2-2:1 -1.8148649 -3.42957317 -0.2001566 0.0177862
1:2-3:1 -3.0701754 -4.71995456 -1.4203963 0.041
2:2-3:1 -1.483 -3.10589150  0.1392248 0.0944158
3:2-3:1 -1.283 -2.90589150  0.3392248 0.2077935
2:2-1:2  1.5868421 -0.27701672  3.4507009 0.1438444
3:2-1:2  1.7868421 -0.07701672  3.6507009 0.0684872
3:2-2:2  0.200 -1.63980803  2.0398080 0.9995894

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology