Skip to content

Instantly share code, notes, and snippets.

@IronistM
Forked from pachevalier/regression_with_dates.R
Created November 11, 2013 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IronistM/7411111 to your computer and use it in GitHub Desktop.
Save IronistM/7411111 to your computer and use it in GitHub Desktop.
N <- 10
id <- 1:10
x <- 1 + rnorm(N) - 1*id
date <- seq(as.Date("2013-07-01"), by = "year", along = x)
df <- data.frame(x = x, date = date)
plot(df$date, df$x)
summary(lm(x ~ date, data = df))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment