Beach <- read.csv("beach_data.csv")
summary(Beach)
## Sample Animal Weight Zone
## Length:30 Length:30 Min. : 5.00 Length:30
## Class :character Class :character 1st Qu.:12.25 Class :character
## Mode :character Mode :character Median :18.50 Mode :character
## Mean :22.60
## 3rd Qu.:29.50
## Max. :72.00
sd(Beach$Weight)
## [1] 15.21705
mean(Beach$Weight)
## [1] 22.6
barplot(Beach$Weight, names = Beach$Sample, col = "steelblue")
aov(Beach$Weight~Beach$Animal)
## Call:
## aov(formula = Beach$Weight ~ Beach$Animal)
##
## Terms:
## Beach$Animal Residuals
## Sum of Squares 5163.069 1552.131
## Deg. of Freedom 6 23
##
## Residual standard error: 8.214862
## Estimated effects may be unbalanced
summary(aov(Beach$Weight~Beach$Animal))
## Df Sum Sq Mean Sq F value Pr(>F)
## Beach$Animal 6 5163 860.5 12.75 2.53e-06 ***
## Residuals 23 1552 67.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(aov(Beach$Weight~Beach$Zone))
## Df Sum Sq Mean Sq F value Pr(>F)
## Beach$Zone 4 2239 559.8 3.127 0.0325 *
## Residuals 25 4476 179.0
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
We find out that the mean weight of all animals in the data set is 22.6kg. Also we realized there is a relationship between weight and animals or tidal zones is significant and not due to chance.
anova1 <- lm(Beach$Weight~Beach$Animal, data = Beach)
plot(density(anova1$residuals))
anova2 <- lm(Beach$Weight~Beach$Zone, data = Beach)
plot(density(anova2$residuals))