Skip to content

Instantly share code, notes, and snippets.

@zachmayer
Created August 26, 2011 14:52
Show Gist options
  • Save zachmayer/1173581 to your computer and use it in GitHub Desktop.
Save zachmayer/1173581 to your computer and use it in GitHub Desktop.
Sheep and Temperature
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.18471 0.12130 9.767 1.08e-12 ***
Sheep -0.71154 0.08546 -8.326 1.16e-10 ***
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.18471 0.12130 9.767 1.08e-12 ***
Sheep -0.71154 0.08546 -8.326 1.16e-10 ***
#Load Data
library(rdatamarket)
sheep <- dmseries("http://data.is/nIEpGU")/1e+08 #Hundreds of millions of sheep in Australia
temp <- dmseries("http://data.is/oDSR9Q") #Global temperature anomaly (land+sea)
names(sheep) <- 'Sheep'
names(temp) <- 'Temp.Anomaly'
#Combine into one data frame
Data <- na.omit(cbind(sheep,temp))
#Plot
library(psych)
pairs.panels(as.data.frame(Data))
#Build a model
library(forecast)
model <- lm(Temp.Anomaly~Sheep,Data)
summary(model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment