Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.