Skip to content

Instantly share code, notes, and snippets.

@InzamamRahaman
Last active August 29, 2015 14:04
Show Gist options
  • Save InzamamRahaman/09748cdb313860214504 to your computer and use it in GitHub Desktop.
Save InzamamRahaman/09748cdb313860214504 to your computer and use it in GitHub Desktop.
logged.data <- log(data)
len <- length(logged.data)
logged.data.timeseries <- logged.data[1 : 36]
actual <- logged.data[37 : len]
z12 <- logged.data[(37 - 12): (len - 12)]
z6 <- logged.data[(37-6):(len-6)]
# Now we attempt to fit a time series model
arima.model <- auto.arima(logged.data.timeseries, max.order = 21,
approximation = FALSE,
stepwise = FALSE,
parallel = FALSE)
arima.predictions <- forecast(arima.model, h = (len - 36))
preds <- arima.predictions$mean
frame <- data.frame(list(Actual=actual, Z12=z12, Z6=z6, Zt=preds))
frame.construction <- frame[1 : 24, ]
frame.test <- frame[25 : length(frame$z6), ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment