Created
July 10, 2013 13:34
-
-
Save pachevalier/5966314 to your computer and use it in GitHub Desktop.
A simple example of a regression with a date variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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