library(stats) # This text file is from the "Unfiltered" sheet from the Excel spreadsheet # Copy the first 7 columns to a text file, including the headers # Paste the data in a text file at c:/data/groundhog.txt # (or just any text file and change the file reference in this first line) g <- read.delim("c:/data/groundhog.txt",skip=1) # Means between the two populations? # (the times when Phil predicted "Long Winter" vs. times when he predicted "Early Spring") # mean(g$PAMeanFebTemp[g$Groundhog.Prediction=="Long Winter"]) length(g$PAMeanFebTemp[g$Groundhog.Prediction=="Long Winter"]) mean(g$PAMeanFebTemp[g$Groundhog.Prediction=="Early Spring"]) length(g$PAMeanFebTemp[g$Groundhog.Prediction=="Early Spring"]) # mean(g$PAMeanMarTemp[g$Groundhog.Prediction=="Long Winter"]) length(g$PAMeanMarTemp[g$Groundhog.Prediction=="Long Winter"]) mean(g$PAMeanMarTemp[g$Groundhog.Prediction=="Early Spring"]) length(g$PAMeanMarTemp[g$Groundhog.Prediction=="Early Spring"]) # mean(g$PAFebPrecip[g$Groundhog.Prediction=="Long Winter"]) length(g$PAFebPrecip[g$Groundhog.Prediction=="Long Winter"]) mean(g$PAFebPrecip[g$Groundhog.Prediction=="Early Spring"]) length(g$PAFebPrecip[g$Groundhog.Prediction=="Early Spring"]) # mean(g$PAMarPrecip[g$Groundhog.Prediction=="Long Winter"]) length(g$PAMarPrecip[g$Groundhog.Prediction=="Long Winter"]) mean(g$PAMarPrecip[g$Groundhog.Prediction=="Early Spring"]) length(g$PAMarPrecip[g$Groundhog.Prediction=="Early Spring"]) # Mann-Whitney-Wilcoxon Tests # Are the metrics different between the two populations? (pred=Y vs. pred=N) wilcox.test(g$PAMeanFebTemp[g$Groundhog.Prediction=="Long Winter"], g$PAMeanFebTemp[g$Groundhog.Prediction=="Early Spring"]) wilcox.test(g$PAMeanMarTemp[g$Groundhog.Prediction=="Long Winter"], g$PAMeanMarTemp[g$Groundhog.Prediction=="Early Spring"]) wilcox.test(g$PAFebPrecip[g$Groundhog.Prediction=="Long Winter"], g$PAFebPrecip[g$Groundhog.Prediction=="Early Spring"]) wilcox.test(g$PAMarPrecip[g$Groundhog.Prediction=="Long Winter"], g$PAMarPrecip[g$Groundhog.Prediction=="Early Spring"]) # Is Phil's prediction based on January's temperature? wilcox.test(g$PAMeanJanTemp[g$Groundhog.Prediction=="Long Winter"], g$PAMeanJanTemp[g$Groundhog.Prediction=="Early Spring"]) # Better than Phil - can we predict the outcome of February with the temperature of January? # Linear regression summary(lm(g$PAMeanFebTemp ~ g$PAMeanJanTemp))