Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
For this section on One-Way ANOVA, lets focus on how treatment influences
root growth rate. Our first step is to produce a summary table of the number
of observations, mean and standard deviation of root growth for each of the 4
treatments.
mean_growth = by ( sponges$RootGrowthRate.mm.d. ,
sponges$Treatment , mean )
sd_growth = by ( sponges$RootGrowthRate.mm.d. ,
sponges$Treatment , sd )
N_obs = by ( sponges$RootGrowthRate.mm.d. , sponges$Treatment ,
length )
cbind ( N_obs , mean_growth , sd_growth )
The means among levels look different, but are they statistically significantly
different?
sponge_anova = aov ( sponges$RootGrowthRate.mm.d. ~
sponges$Treatment )
summary(sponge_anova)
We reject the null hypothesis that there is no difference among the treatment
means with 95% confidence (p = 0.0004), and conclude that treatment
significantly affects root growth rate.
Since we have a significant result, lets visualize the confidence intervals.
install.packages("gplots")
library(gplots)
plotmeans(sponges$RootGrowthRate.mm.d. ~ sponges$Treatment)
We see that only 2 treatments (Control, Tedania) dont overlap. The rest
overlap to some degree.
ANOVA tells us if theres a difference among the means for the levels of the
factor. To determine which treatments are different, we use Tukeys HSD.
TukeyHSD(sponge_anova)
Each one of these contrasts is essentially a t-test for the indicated levels of
factors. The first line can be read: the mean growth rate of the Foam
treatment was 0.35 mm greater than the mean growth rate of the Control
treatment. The p-value for this comparison is 0.076, and so the difference is
not significant at the 95% level.
What can we conclude from Tukeys HSD? At the 5% level:
1. Mangrove root growth rate increases when sponges (Haliclona
p=0.009 and Tedania p=0.0003) are attached
2. Mangrove root growth rate does not increase when foam is
attached (p = 0.077)
3. No significant difference between treatments (each treatment
contrast those without Control - has p > 0.05)
Part 3: ANOVA Two-Way Factorial (with Interaction Effects)
We also recorded the location for each of our plots. Each location was
measured by a different technician does this affect our results? Lets take a
look.
First, lets examine the number of samples and mean root growth rate for
each treatment and location.
table( sponges$Location , sponges$Treatment )
(R code omitted)
Lets perform an ANOVA analysis to determine which effects (main and their
interaction) are statistically significant. To do this, we add Location to our
ANOVA model. Note that were using a * between the factors in the model
definition below. The reason for this is because we want to analyze the
interaction effects of the two factors.
sponge_anova2=aov ( sponges$RootGrowthRate.mm.d. ~
sponges$Treatment * sponges$Location )
summary(sponge_anova2)
Now lets graph the interaction effects between Location and Treatment.
interaction.plot ( sponges$Treatment , sponges$Location ,
sponges$RootGrowthRate.mm.d. )