Site icon R-bloggers

Simulating from a specified seasonal ARIMA model

[This article was first published on R – Hyndsight, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

From my email today

You use an illustration of a seasonal arima model:

ARIMA(1,1,1)(1,1,1)4

I would like to simulate data from this process then fit a model… but I am unable to find any information as to how this can be conducted… if I set phi1, Phi1, theta1, and Theta1 it would be reassuring that for large n the parameters returned by Arima(foo,order=c(1,1,1),seasonal=c(1,1,1)) are in agreement…

My answer:

Unfortunately arima.sim() won’t handle seasonal ARIMA models. I wrote simulate.Arima() to handle them, but it is designed to simulate from a fitted model rather than a specified model. However, you can use the following code to do it. It first “estimates” an ARIMA model with specified coefficients. Then simulates from it.

library(forecast)
model <- Arima(ts(rnorm(100),freq=4), order=c(1,1,1), seasonal=c(1,1,1),
             fixed=c(phi=0.5, theta=-0.4, Phi=0.3, Theta=-0.2))
foo <- simulate(model, nsim=1000)
fit <- Arima(foo, order=c(1,1,1), seasonal=c(1,1,1))

To leave a comment for the author, please follow the link and comment on their blog: R – Hyndsight.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.