Dear useRs, 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? #-------------------------------- load("rdtb") #the time series> 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 <- list(NULL) #simulated for (i in 1:5) { 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.
Bogdan Romocea wrote:> I want to simulate a time series (stationary; ... <snip> ... > values is skewed to the right; quite a few ARMA absolute standardized<snip>> > sim <- list(NULL) #simulated > for (i in 1:5) { > sim[[i]] <- as.vector(arima.sim(list(ar=c(farma[["coef"]][1]), > ma=c(farma[["coef"]][2])),n=length(rdtb),innov=rdtb)) > } > > I don't understand why the simulation runs generate virtually > identical values:<snip> They are identical because you are using the same innovations i.e. rdtb, over and over!!! If you want different results, you have to use different innovations. BTW it would seem to make more sense to use the ***residuals*** from your fit to rdtb, rather than rdtb itself, as your innovations. (But then you would be essentially reconstructing rdtb.) You probably want to ***fit*** some distribution to the residuals from rdtb, and then sample from that distribution to get your innovations. cheers, Rolf Turner rolf at math.unb.ca
On Thu, 31 Mar 2005, bogdan romocea wrote:> Dear useRs, > > 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? > #-------------------------------- > load("rdtb") #the time series >> 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 <- list(NULL) #simulated > for (i in 1:5) { > 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.The meaning of `innovations'. The innovations determine the series, so you asked for the same series five times. In the reference, the innovations are e[t]. -- 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