[R] Model Based Bootstrap of an MA(1)-Modell (with R-code)!

Andreas Klein klein82517 at yahoo.de
Sat Jan 31 21:00:29 CET 2009


Hello.

I want to calculate percentile intervals for the coefficient of an MA(1)-Model, but it doesn't work.



Code for model based bootstrap based upon a MA(1)-Modell and building a bootseries recursivley (takes around 4 minutes to compute):


y <- arima.sim(100,model=list(order=c(0,0,1),ma=0.5))

model <- arima(y,order=c(0,0,1),method="ML")

ma <- as.numeric(model$coef[1])

res <- model$res-mean(model$res)

bootseries <- numeric(100)

ma_boot <- numeric(10000)


for (i in 1:10000) {

  for (j in 1:100) {

    bootseries[j] <- sample(res,1)+ma*sample(res,1)

  }

  model_boot <- arima(bootseries,order=c(0,0,1),method="ML")

  ma_boot[i] <- as.numeric(model_boot$coef[1])

}

quantile(ma_boot,0.025);quantile(ma_boot,0.975)



Often the estimated coefficient from the original model does not lie in the interval and the interval always contains the zero, so it is not significant.


What is my failure?

Please help me and give me some hints or correct my code.


Regards,
Andreas.







More information about the R-help mailing list