arima.sim
Simulate a Univariate ARIMA Series
Description
Simulates a univariate ARIMA time series.
By default the innovations are Gaussian.
Usage
arima.sim(model, n, rand.gen = rnorm, innov = rand.gen(n, ...),
n.start = NA, start.innov = rand.gen(n.start, ...), ...)
Arguments
model |
a list specifying an ARIMA model.
The components ar and ma, if present, should be
numeric vectors giving the autoregression and moving average
parameters for the model. If you also want a difference parameter,
supply the order component, a three-long integer vector giving the
length of the ar component, the number of differences, and
the length of the ma component, respecively. (If supplied,
the first and last elements of order must match the lengths
of the ar and ma components.)
|
n |
the length of the series to be simulated.
|
innov |
a univariate time series or vector of innovations to produce the series.
If not provided, innov is generated using rand.gen.
Missing values (NAs) are not allowed.
If provided, its length must match the n argument.
|
n.start |
the number of start-up innovations.
The start-up innovations are generated by rand.gen
if start.innov is not provided.
n.start must be as long as ar + ma.
|
start.innov |
a univariate time series or vector of innovations to be used as start up values.
Missing values (NAs) are not allowed.
These are transformed by the Choleski "square root" of the correlation
matrix corresponding to the model so the simulated process begins with something
close to its stationary state if you supply iid (independent and identically distributed)
innovations.
|
rand.gen |
a function that is called to generate the innovations.
Usually, rand.gen is a random number generator.
|
... |
additional arguments to pass to rand.gen
|
Value
returns a univariate time series, the simulated series,
with start==1 and frequency==1.
References
Jones, R. H. (1980).
Maximum likelihood fitting of ARIMA models to time series
with missing observations.
Technometrics
22, 389-395.
See Also
Examples
# Simulate an ARIMA(1,0,2) process
x <- arima.sim(n=100, model=list(ar=.5, ma=c(-.6, .6)))
# Generate the impulse response for the same model
ix <- arima.sim(n=30, model=list(ar=.5, ma=c(-.6, .6)), innov=(1:30)==5, start.innov=rep(0,4))
# Simulate an ARIMA(0,2,3) process
y <- arima.sim(n=100, model=list(ma=c(0.5, 0.5, -0.1), order=c(0,2,3)))