Simulation from a time series model
Returns a time series based on the model object
"simulate"(object, nsim=length(object$x), seed=NULL, future=TRUE, bootstrap=FALSE, innov=NULL, ...) "simulate"(object, nsim=object$n.used, seed=NULL, future=TRUE, bootstrap=FALSE, innov=NULL, ...) "simulate"(object, nsim=length(object$x), seed=NULL, xreg=NULL, future=TRUE, bootstrap=FALSE, innov=NULL, lambda=object$lambda, ...) "simulate"(object, nsim=object$n, seed=NULL, future=TRUE, bootstrap=FALSE, innov=NULL, ...)
- An object of class "
Arima" or "
- Number of periods for the simulated series
- Either NULL or an integer that will be used in a call to
set.seedbefore simulating the time series. The default, NULL will not change the random generator state.
- Produce sample paths that are future to and conditional on the data in
- If TRUE, simulation uses resampled errors rather than normally distributed errors.
- A vector of innovations to use as the error series. If present,
- New values of xreg to be used for forecasting. Must have nsim rows.
- Box-Cox parameter. If not
NULL, the simulated series is transformed using an inverse Box-Cox transformation with parameter
- Other arguments.
object should be produced by
auto.arima, rather than
arima. By default, the error series is assumed normally distributed and generated using
innov is present, it is used instead. If
innov=NULL, the residuals are resampled instead.
future=TRUE, the sample paths are conditional on the data. When
future=FALSE and the model is stationary, the sample paths do not depend on the data at all. When
future=FALSE and the model is non-stationary, the location of the sample paths is arbitrary, so they all start at the value of the first observation.
plot(USAccDeaths,xlim=c(1973,1982)) lines(simulate(fit, 36),col="red")