# 6. Test to see if the data provides statistically significant evidence that # mean tick density over the years 2008 to 2019 was less than 2011 spike in tick densities. # # Warning!! You need to change the counties and data to the ones for YOUR project! # # Tick Data for Dutchess and Westchester Counties # From NYS-DOH # WestchesterTickDensity = c(30.00, 35.70, 38.30, 168.40,17.70, 21.30, 19.10, 47.60,43.10, 21.10, 11.00, 32.63); DutchessTickDensity = c(40.0, 36.4, 59.8, 97.4,68.5, 40.3, 49.4, 62.3,63.1, 44.2, 71.8, 52.0); Years = c(2008, 2009, 2010, 2011,2012, 2013, 2014, 2015,2016, 2017, 2018, 2019); #--------------------------------------------------- # What you need to change #--------------------------------------------------- x = DutchessTickDensity #--------------------------------------------------- # No changes needed below this line #--------------------------------------------------- "Hypothesis test for claim: mean tick density 2008 - 2019 < 2011 spike in density"; mux = max(x); "spike density"; mux; xbar = mean(x); "mean density M"; xbar; Sx = sd(x); "standard deviation SD"; Sx; n = length(x); t_statistic = (xbar - mux)/(Sx/sqrt(n)); "t-statistic"; round(t_statistic, 4); "degrees of freedom for one sample t-test"; n-1; pvalue = pt(t_statistic, n - 1); "p-value for claim: mean density < spike density"; pvalue; # End of R Script