Read in the fisheries data
rr fisheries <- read.csv(_FishData.csv, header = TRUE)
Check for normality:
rr boxplot(fisheries\(Low, fisheries\)Med, fisheries$High)
rr shapiro.test(fisheries$Low)
Shapiro-Wilk normality test
data: fisheries$Low
W = 0.91761, p-value = 0.4883
rr shapiro.test(fisheries$Med)
Shapiro-Wilk normality test
data: fisheries$Med
W = 0.9816, p-value = 0.9592
rr shapiro.test(fisheries$High)
Shapiro-Wilk normality test
data: fisheries$High
W = 0.79945, p-value = 0.05811
Prepare data for anova and perform anova:
rr fish_stack <- stack(fisheries) names(fish_stack) <- c(, ) fish.aov <- aov(fish_stack\(Mass~fish_stack\)Treatment) fish.aov
Call:
aov(formula = fish_stack$Mass ~ fish_stack$Treatment)
Terms:
fish_stack$Treatment Residuals
Sum of Squares 490.0544 252.6683
Deg. of Freedom 2 15
Residual standard error: 4.104212
Estimated effects may be unbalanced
rr summary(fish.aov)
Df Sum Sq Mean Sq F value Pr(>F)
fish_stack$Treatment 2 490.1 245.03 14.55 0.000308 ***
Residuals 15 252.7 16.84
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Showing that the F value is the ratio of the mean squares and that using the f distribution you can find the p-value with the degrees of freedom indicated.
rr 245.03/16.84
[1] 14.55048
rr 1-pf(14.55, 2, 15)
[1] 0.0003071815
Perform posthoc analysis:
rr TukeyHSD(fish.aov)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = fish_stack$Mass ~ fish_stack$Treatment)
$`fish_stack$Treatment`
diff lwr upr p adj
Med-Low 7.466667 1.311785 13.62155 0.0170662
High-Low 12.716667 6.561785 18.87155 0.0002185
High-Med 5.250000 -0.904882 11.40488 0.1008030