[Rd] using innov in arima.sim

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 10 17:38:13 CEST 2005


On Mon, 10 Oct 2005, Hjellvik Vidar wrote:

> 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

Yes, that is what it says on the help page.

> 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.

Reading the help page would have told you.  Make sure you look in the 
current version of R.

> 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?

Take a look at the R-devel version of arima.sim.

It _would_ be a good idea to read the posting guide and follow its 
requests.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list