library(readr)
limpet <- read_csv("~/Desktop/Limpets/limpet data.csv",
col_types = cols(Site = col_factor(levels = c("1",
"2")), Quadrant = col_character(),
Rock = col_factor(levels = c("0",
"1")), Count = col_number()))
print(limpet)
## # A tibble: 40 x 4
## Site Quadrant Rock Count
## <fct> <chr> <fct> <dbl>
## 1 1 1 1 0
## 2 1 2 0 6
## 3 1 3 0 3
## 4 1 4 1 5
## 5 1 5 0 3
## 6 1 6 1 4
## 7 1 7 1 0
## 8 1 8 1 6
## 9 1 9 0 0
## 10 1 10 0 7
## # … with 30 more rows
str(limpet)
## tibble [40 × 4] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
## $ Site : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
## $ Quadrant: chr [1:40] "1" "2" "3" "4" ...
## $ Rock : Factor w/ 2 levels "0","1": 2 1 1 2 1 2 2 2 1 1 ...
## $ Count : num [1:40] 0 6 3 5 3 4 0 6 0 7 ...
## - attr(*, "spec")=
## .. cols(
## .. Site = col_factor(levels = c("1", "2"), ordered = FALSE, include_na = FALSE),
## .. Quadrant = col_character(),
## .. Rock = col_factor(levels = c("0", "1"), ordered = FALSE, include_na = FALSE),
## .. Count = col_number()
## .. )
plot(limpet)
Where 0 = crevice and 1 = flat rock.
MSE of treatment rock type.
## Loading required package: matrixStats
## Loading required package: R.methodsS3
## R.methodsS3 v1.8.1 (2020-08-26 16:20:06 UTC) successfully loaded. See ?R.methodsS3 for help.
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:matrixStats':
##
## count
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
limpet_mse <- summarise(group_by(limpet, Rock, Site), mean=mean(Count), se=sd(Count)/sqrt(length(Count)))
## `summarise()` regrouping output by 'Rock' (override with `.groups` argument)
print(limpet_mse)
## # A tibble: 4 x 4
## # Groups: Rock [2]
## Rock Site mean se
## <fct> <fct> <dbl> <dbl>
## 1 0 1 3.6 0.859
## 2 0 2 2.4 0.686
## 3 1 1 1.6 0.763
## 4 1 2 1 0.394
ggplot(limpet_mse, aes(fill=Site, y= mean, x = Rock)) +
geom_bar(position="dodge", stat="identity") +
geom_errorbar(aes(ymin=mean-se, ymax=mean+se),
size=.75, # Thinner lines
width=.1,
position=position_dodge(.7)) + theme_minimal() + ylab("Abundance") + xlab("Rock Type (0 = Crevice, 1 = Flat)") + ggtitle("Abundance of Limpets on Crevices and Flat Rock at Cronulla Point")
We see a trend of more limpets accumulating in the crevices compared to flat rock across the sites. Large, mostly overlapping error bars.
si <- as.fixed(limpet$Site)
ro <- as.fixed(limpet$Rock)
m1 <- lm(Count ~ si*ro, data = limpet)
res <- gad(m1)
res
## Analysis of Variance Table
##
## Response: Count
## Df Sum Sq Mean Sq F value Pr(>F)
## si 1 8.1 8.1000 1.6644 0.20524
## ro 1 28.9 28.9000 5.9384 0.01989 *
## si:ro 1 0.9 0.9000 0.1849 0.66973
## Residual 36 175.2 4.8667
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Rock Type is Significant, site is not. We reject the null hypothesis of no difference or less abundance of limpets on flat rock compared to crevices.
C.test(m1)
##
## Cochran test of homogeneity of variances
##
## data: m1
## C = 0.34811, n = 10, k = 4, p-value = 0.6592
## alternative hypothesis: Group 1.1 has outlying variance
## sample estimates:
## 1.1 1.0 2.0 2.1
## 7.1556 6.8444 2.7667 3.7889
The null hypothesis of homogenity is accepted. It has homogenity of variances.
1 = Flat 0 = Crevice
snk.test(m1, term ="ro")
##
## Student-Newman-Keuls test for: ro
##
## Standard error = 0.4933
## Df = 36
## 1 0
## Rank order: 1 2
## Ranked means: 1.3 3
## Comparisons:
## 1 2-1 *
## ---
## Signif. codes: <0.001 '***' <0.01 '**' <0.05 '*' >0.05 'ns'
Significant different between the two rock types with crevices being significantly higher in limpet abundance than flat rock.
library(ggpubr)
ggscatter(limpet, x = "Rock", y = "Count")
Not linear because the way the rock is classified is either fitting in 1 or 2 so plotting on a scatter is unsuitable.
m2 <- lm(Count ~ Rock, data = limpet)
anova(m2)
## Analysis of Variance Table
##
## Response: Count
## Df Sum Sq Mean Sq F value Pr(>F)
## Rock 1 28.9 28.9000 5.962 0.01938 *
## Residuals 38 184.2 4.8474
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A significant relationship between rock type and abundance. P value = 0.01938.
Rock type has been established as a signficant predictor of limpet abundance, with higher abundances occurring in areas of crevices/depressions in the rockface. Plotting the data visualised the difference in abundance and showed that overall less limpets were observed in site 2, regardless of rock type. However, ANOVA did not find site to be significant with a p-value of 0.20534, and did not find an interaction between site and rock type. Large numbers of barnacles were present in site 2, and therefore, competition for space could have skewed the results. Further studies into the relationship between species assemblages and limpet abundance are recommended.
ANOVA produced a p-value of 0.01989 for the main effect of rock type, and therefore,the null hypotheses of less than or no difference on flat rock is rejected. Contrasts confirmed higher abundance of limpets in crevices.
Homogenity of Variances was checked using a Cochran Test, revealing a p-value of 0.6592, and therefore, the null hypothesis of homogenity of variances is accepted, validating the accuracy of the ANOVA.