Skip to content

Instantly share code, notes, and snippets.

@robjhyndman
Created August 4, 2016 00:26
Show Gist options
  • Save robjhyndman/3b341c50bf8adc10593ee82137eaab56 to your computer and use it in GitHub Desktop.
Save robjhyndman/3b341c50bf8adc10593ee82137eaab56 to your computer and use it in GitHub Desktop.
Use of Fourier series in simulating from an ARIMA model
library(forecast)
fit <- auto.arima(USAccDeaths, xreg=fourier(USAccDeaths, 4))
fc <- forecast(fit, xreg=fourier(USAccDeaths, 4, 12))
plot(fc)
for(i in 1:12)
lines(simulate(fit, xreg=fourier(USAccDeaths, 4, 12)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment