Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. library(dplyr)
  2. library(magrittr)
  3. library(lubridate)
  4. load("~/ecn321/pages/Lectures/ch10data.Rdata")
  5. estimation_data <- ch10data %>%
  6. filter(date > as.Date("1967-12-01") & date < as.Date("1994-12-01"))
  7. estimation_data %<>% mutate(lsales = log(liquor))
  8.  
  9. y <- estimation_data$lsales
  10. time <- 1:length(y)
  11. seasonal <- as.factor(month(estimation_data$date))
  12. X <- cbind(time, time2 = time^2, model.matrix(~seasonal - 1))
  13. reg <- arima(y, order = c(3, 0, 0), xreg = X, include.mean = FALSE)
  14. summary(reg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement