[R] arima.sim

J Toll jctoll at gmail.com
Mon Oct 8 16:23:00 CEST 2012


Hi,

I have been using arima.sim from the stats package recently, and I'm
wondering why I get different results when using what seem to be the
same parameters. For example, I've given examples of three different
ways to run arima.sim with what I believe are the same parameters.
It's my understanding from the R documentation that rnorm is the
default function for rand.gen if not provided in innov.  So it would
seem that there's quite a bit of redundancy in the assignment to a1.
My expectation is that a1, a2, and a3 should be identical.  It turns
out that a1 is only partially identical to a2 and a3.  The first 56
values of a1 are different from a2 and a3, but the rest are the same.
What is it that makes an explicit declaration of the innov parameters
different from using the defaults?  At this point, my best guess is
that this might have something to do with n.start and the length of
the "burn-in" period.  Any suggestions as to why all three of these
aren't the same?  Thanks.

James

set.seed(2012)
a1 <- arima.sim(list(order = c(1, 0, 0), ar = 0.5), n = 250, innov =
rnorm(n = 250, mean = 0, sd = 0.1))
> summary(a1)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
-0.45630 -0.11060 -0.03225 -0.02525  0.05484  0.27120

set.seed(2012)
a2 <- arima.sim(list(order = c(1, 0, 0), ar = 0.5), n = 250, sd = 0.1)
> summary(a2)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
-0.31830 -0.10200 -0.03016 -0.02174  0.05593  0.27120

set.seed(2012)
a3 <- arima.sim(list(ar = 0.5), n = 250, sd = 0.1)
> summary(a3)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
-0.31830 -0.10200 -0.03016 -0.02174  0.05593  0.27120

> a1 == a2
Time Series:
Start = 1
End = 250
Frequency = 1
  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [22] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 [43] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [64]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
 [85]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE



More information about the R-help mailing list