(This article was first published on

**R – Hyndsight**, and kindly contributed to R-bloggers)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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...