Skip to content

Instantly share code, notes, and snippets.

@pachevalier
Created July 10, 2013 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pachevalier/5966314 to your computer and use it in GitHub Desktop.
Save pachevalier/5966314 to your computer and use it in GitHub Desktop.
A simple example of a regression with a date variable
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