## read in data
sharkrawdata=read.csv("sharks.csv", header = T)
## show classification of variables
str(sharkrawdata)
## 'data.frame': 532 obs. of 10 variables:
## $ Species.Name : chr "AUSTRALIAN BLACKTIP" "BLACKTIP REEF WHALER" "BLACKTIP REEF WHALER" "BLACKTIP REEF WHALER" ...
## $ Date : chr "2016-11-16" "2016-01-02" "2016-01-02" "2016-01-05" ...
## $ Area : chr "Cairns" "Cairns" "Cairns" "Mackay" ...
## $ Location : chr "Holloways Beach" "Buchans Point Beach" "Ellis Beach" "Harbour Beach" ...
## $ Latitude : chr "-16°49.82" "-16°43.56" "-16°43.3" "-21°7.08" ...
## $ Longitude : chr "145°44.85" "145°39.78" "145°39.01" "149°13.62" ...
## $ Length..m. : num 1 0.7 1.5 2.2 1.7 1.2 0.75 1.2 0.8 1.3 ...
## $ Water.Temp..C.: int 27 27 27 26 26 29 30 31 29 29 ...
## $ Month : chr "November" "January" "January" "January" ...
## $ Day.of.Week : chr "Wednesday" "Saturday" "Saturday" "Tuesday" ...
This section is looking at the number of shark encounters during summer, where the beach is used regularly, and winter, where there are not many people in the water. To properly assess, the dataset had to be manipulated to focus on moths and number of sharks, and then a new column was mutated into the data to classify the months. Summer is from December to February, whilst all other months are considered Not Summer for this analysis. A hypothesis test is to be conducted with the Null hypothesis being: There is less risk of shark encounters during Summer and, Alternate hypothesis being : There is more risk of shark encounters during summer. After conducting a Welch Two Sample t-test, the p value is given to be 0.2723 with a 95% confidence interval and a 5% significance level. The p value is far greater than 0.05, which means that the null hypothesis in this case is not to be rejected. This concluded that there is more risk of shark encounters during seasons other than summer. According to research, different species of sharks prefer different temperatures of water( Ball, 2022). The different species prove to be a possible confounding factor to this test. This analysis is by no means concrete evidence that all sharks prefer cooler waters, rather it is a reflection of this specific dataset. Since this data is obtained from captured sharks, it does not reflect all shark encounters as the appearance of humans and equipment can dissuade marine life from approaching the beach. Perhaps analysing a dataset detailing shark sightings could be more helpful but has its own limitations regarding details.
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.6 ✓ purrr 0.3.4
## ✓ tibble 3.1.5 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.4 ✓ stringr 1.4.0
## ✓ readr 2.0.2 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
#Read in data
sharkmonth=read.csv("Sharks_month.csv", header = T)
dataq1<-sharkmonth %>%
#Add season classification colmn to dataset
mutate(Season = ifelse(Month %in% c("December","January","February"), "Summer", "Not Summer"))
Summer <-dataq1 %>%
filter(Season == "Summer")
NotSummer <- dataq1 %>%
filter(Season != "Summer")
#Create barplot by grouping summer and not summer
data <- dataq1 %>%
group_by(Season) %>%
summarise(Shark_Encounter = Sharks) %>%
arrange(desc(Shark_Encounter))
## `summarise()` has grouped output by 'Season'. You can override using the `.groups` argument.
ggplot(dataq1,aes(x=Season, y= Sharks))+geom_col()
t.test(Summer$Sharks,NotSummer$Sharks, alternative = "greater")
##
## Welch Two Sample t-test
##
## data: Summer$Sharks and NotSummer$Sharks
## t = 0.71285, df = 2.1738, p-value = 0.2723
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -23.05105 Inf
## sample estimates:
## mean of x mean of y
## 50.33333 42.33333
Summer
## read in data
dataq2=read.csv("BullVSHammerSharks.csv", header = T)
#create boxplot
ggplot(data = dataq2, aes(x = Species.Name, y = Water.Temp..C.)) +
stat_boxplot(geom = "errorbar",
width = 0.2) +
geom_boxplot(fill = "#4271AE", colour = "#1F3552",
alpha = 0.9, outlier.colour = "red") +
scale_y_continuous(name = "Temperature") +
scale_x_discrete(name = "Shark Species") +
theme(axis.line = element_line(colour = "black",
size = 0.35))
This question aims to compare two species of sharks: the Bull Whaler shark and the Scalloped Hammerhead. The latter is harmless to humans whilst the former poses a threat to swimmers and surfers at the beach. The box plot above shows a general trend where bull sharks prefer warmer water, and this is supported by research that indicates that bull sharks are more likely to attack during summer (Callinan, 2016). The median line in the two plots appear to be indicating similar values, with bull sharks pulling ahead by very little. But the IQR indicates a clearer trend where more scalloped hammerheads are sighted in cooler temperatures than bull whalers. The analysis has the same limitations as the last question, wherein the method of data collection can affect the shark captures as they would be less likely to approach near crowds and equipment. Nevertheless, this dataset still reflects a clear trend that is backed by research.
Ball, J. (2022, August 12). Do Sharks Like Cold Water? [It Depends On The Species]. WildlifeBoss.com. https://wildlifeboss.com/do-sharks-like-cold-water/
Callinan, R. (2016, April 1). Bull sharks on the bite in hot water, new research suggests. The Sydney Morning Herald. https://www.smh.com.au/environment/conservation/bull-sharks-on-the-bite-in-hot-water-new-research-suggests-20160401-gnvs0i.html