[R] Specifying initial values for arima.sim

Jack Liddle jackliddlephysics at googlemail.com
Tue Jul 21 15:58:08 CEST 2009


Hi Everyone,

I'm having a problem with arima.sim.  Namely specifying inital values
for the series.

If I generate a random walk

> vs = rnorm(100,0,1)
> xs = cumsum(vs)

and fit an ARIMA(1,0,0) to it

> xarima = arima(xs,order=c(1,0,0))
> xarima

Call:
arima(x = xs, order = c(1, 0, 0))

Coefficients:
         ar1  intercept
      0.9895     8.6341
s.e.  0.0106     6.1869

I should then be able to simulate this ARIMA process, using the
residuals.  Lets do this twice for comparison

> xsim1 <-arima.sim(n = 100,innov=residuals(xarima),list(ar = c(0.9895)), )
> xsim2 <-arima.sim(n = 100,innov=residuals(xarima),list(ar = c(0.9895)), )

> xsim1[1]
[1] -4.855137
> xsim2[1]
[1] 5.511827
> xs[1]
[1] 1.014863

Clearly these series are starting from different initial values.  For
the ARIMA(1,0,0) only one value need be specified, but how do I do
that.

I've been unable to find how to do this from mailing lists or the web.

I would be grateful for any insights people may have

Thanks

Jack Liddle
Juelich Forschungszentrum




More information about the R-help mailing list