[R] Model Based Bootstrap
Andreas Klein
klein82517 at yahoo.de
Tue May 6 10:32:32 CEST 2008
Hello.
Has anyone any idea how a function would look like of a model based bootstrap, when the underlying time series follows an ARIMA(1,1,1)-process?
A pure AR-process is no problem, but what is, if the time series need to be differentiated of order one or above and the additional MA-part?
Sample code for a series, which follows a pure AR-process:
#Series y of 192 observations, which follows an AR(1)-process
#Fit of an AR(1)-Model to y
ar.coef <- ar(y)$ar
ar.resid <- ar(y)$resid
#Sampling for mean
y_sample <- numeric(192)
y_sample[1] <- y[1]
mean_y <- numeric(10000)
for (i in 1:10000)
{
for (j in 1:191)
{
idx <- sample(2:192,1,replace=TRUE)
y_sample[j+1] <- y_sample[j]*ar.coef+ar.resid[idx]
}
mean_y[i] <- mean(y_sample)
}
What would the function look like if y follows an ARIMA(1,1,1)-process for example or in general if y is a time series, which need to be differentiated and is best modeled with a mixture of AR and MA?
I hope you can help me.
Sincerely
Andreas.
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
More information about the R-help
mailing list