Skip to content

Instantly share code, notes, and snippets.

@omartinez182
Created June 19, 2020 18:13
Show Gist options
  • Save omartinez182/db9a34748124ff6c8b911994d02fa34a to your computer and use it in GitHub Desktop.
Save omartinez182/db9a34748124ff6c8b911994d02fa34a to your computer and use it in GitHub Desktop.
Understanding Time Series Analysis with R - Snippet 9
#Linear model
model <- lm(formula = DES ~ t, dfOut)
#Predictions
f <- predict(object = model, newdata = data.frame(t=dfOut[, 1]))
dfOut <- data.frame(dfOut, f=f)
#New prediction accounting for seasonality
predictions <- dfOut[, 7]*dfOut[, 5]
dfOut <- data.frame(dfOut, predictions = predictions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment