From Vidar.Hjellvik at imr.no  Mon Oct 10 17:23:04 2005
From: Vidar.Hjellvik at imr.no (Hjellvik Vidar)
Date: Mon, 10 Oct 2005 17:23:04 +0200
Subject: [Rd] using innov in arima.sim
Message-ID: <0D54094F69391A438650C6151B0A33E46FD371@post2.imr.no>

Hello,

I have used the arima.sim function to generate a lot of time series, but to day I got som results that I didn't quite understand. Generating two time series z0 and z1 as

eps <- rnorm(n, sd=0.03)
z0 <- arima.sim(list(ar=c(0.9)), n=n, innov=eps)

and 

z1 <- arima.sim(list(ar=c(0.9)), n=n, sd=0.03),

I would expect z0 and z1 to be qualitatively similar. However, with n=10 the two series could look like this:

z0 = -4.1258 -3.7326 -3.3269 -2.9813 -2.7314 -2.4416 -2.2223 -2.0083 -1.7848 -1.6016
z1 = -0.1001 -0.0885 -0.0767 -0.0531 -0.0647 -0.0268 -0.0118 -0.0153 0.0038 -0.0364

Using a larger n, z0 converges to the right level after some time, but it would have been nice to have it there from the first observation... I took a look into the code for arima.sim, and I think I found the reason for this behaviour in the line 

x <- ts(c(rand.gen(n.start, ...), innov[1:n]), start = 1 - n.start)

It seems like the "warming up" innovations are standard normal, and that that's why the first observations of z0 are so large in magnitude. So one solution is to generate

z0 <- arima.sim(list(ar=c(0.9)), n=n, innov=eps, sd=sd(eps)),

but I didn't figure out this before having taken a look at the code. So my question is:

Wouldn't it be a good idea to have the calculation of the standard deviation of the "warming up" observations done in arima.sim? Or maybe that the "warming up" observations were sampled from innov, in case the innovations are not gaussian?

Best regards,
Vidar Hjellvik



[Rd] using innov in arima.sim
Hjellvik Vidar