# The following R script contains the data and the code to make the scatter plot and do the regression analysis. # You can easily modify it for the two counties you are doing for your project. # # Warning!! You need to change the counties and the data 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 #--------------------------------------------------- county_x_density = DutchessTickDensity county_y_density = WestchesterTickDensity # county_x_name = "Dutchess" # don't forget quotes! county_y_name = "Westchester" your_name = "Prof McCarthy" #--------------------------------------------------- # No changes needed below this line #--------------------------------------------------- #-------- Scatter Plot plot(county_x_density,county_y_density,xlab = paste(county_x_name,"tick density in ticks per 1000 m^2"),ylab = paste(county_y_name,"tick density in ticks per 1000 m^2"),main = paste(county_y_name,"vs",county_x_name,"\nData: Yearly tick densities 2008 - 2019"),pch = 16); # title(sub = paste("Analysis by", your_name),cex.sub = 0.75, font.sub = 3, col.sub = "black", adj = 1) #------------ do the regression analysis y ~ x regression = lm(county_y_density ~ county_x_density); summary(regression) #------------ plot the regression line from the regression analysis abline(regression, lwd = 3) # plots regression line #------------ 2011 data point "2011 county_x tick density"; county_x_density[which(Years == 2011)]; "2011 county_y tick density"; county_y_density[which(Years == 2011)]; # End of R Script