# [R] how to simulate a time series

From: bogdan romocea <br44114_at_yahoo.com>
Date: Fri 01 Apr 2005 - 01:17:23 EST

I want to simulate a time series (stationary; the distribution of values is skewed to the right; quite a few ARMA absolute standardized residuals above 2 - about 8% of them). Is this the right way to do it?

#--------------------------------

> summary(rdtb)
Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.11800 -0.65010 -0.09091 0.30390 1.12500 2.67600

farma <- arima(rdtb,order=c(1,0,1),include.mean=T)
> farma[["coef"]]

ar1 ma1 intercept
0.58091575 0.02313803 0.30417062

sim[[i]] <- as.vector(arima.sim(list(ar=c(farma[["coef"]][1]),
ma=c(farma[["coef"]][2])),n=length(rdtb),innov=rdtb))
}

allsim <- as.data.frame(sim)

colnames(allsim) <- paste("sim",1:5,sep="") all <- cbind(rdtb,allsim)
#--------------------------------

I don't understand why the simulation runs generate virtually identical values:
> all[100:105,]

rdtb sim1 sim2 sim3 sim4 sim5

100  2.3863636 1.065661 1.065661 1.065661 1.065661 1.065661
101  1.9318182 2.606093 2.606093 2.606093 2.606093 2.606093
102  2.2954545 3.854074 3.854074 3.854074 3.854074 3.854074
103  2.5882353 4.880240 4.880240 4.880240 4.880240 4.880240
104  2.0227273 4.917622 4.917622 4.917622 4.917622 4.917622
105 -0.1521739 2.751352 2.751352 2.751352 2.751352 2.751352

It appears I may be missing something (very) basic, but don't know what.

Thank you,
b.

R-help@stat.math.ethz.ch mailing list