Reputation: 1002
I fitted an ARMA-GARCH model for the following simulated data and finally obtained the bootstrapping prediction intervals. I used the rugrach
package in R.
ar.sim<-arima.sim(model=list(ar=c(.9,-.2),ma=c(-.7,.1)),n=100)
logr=diff(log(na.omit(ar.sim)))
require(rugrach)
gar<-ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2, 1)),
mean.model = list(armaOrder = c(2, 1)),
distribution.model = "norm");
fitg=ugarchfit(spec = gar,data = ar.sim,solver = "hybrid");
garch11.boot = ugarchboot(fitg, method="Partial",
n.ahead=10, n.bootpred=2000)
My output of the bootstrap results as follows and my question is based on this output,
> garch11.boot
*-----------------------------------*
* GARCH Bootstrap Forecast *
*-----------------------------------*
Model : sGARCH
n.ahead : 10
Bootstrap method: partial
Date (T[0]): 0100-01-01
Series (summary):
min q.25 mean q.75 max forecast[analytic]
t+1 -1.5418 -0.60011 0.111638 0.78600 2.9529 0.12522
t+2 -1.8665 -0.66265 0.110356 0.74133 3.1840 0.12857
t+3 -1.9302 -0.61371 0.111750 0.73367 3.4751 0.10131
t+4 -1.8828 -0.64614 0.104376 0.75553 3.2405 0.11716
t+5 -1.8306 -0.61477 0.135969 0.76970 3.4603 0.10583
t+6 -1.8864 -0.65527 0.130858 0.74737 3.4491 0.11362
t+7 -1.9581 -0.61335 0.122836 0.75270 3.1523 0.10822
t+8 -1.8804 -0.61070 0.114942 0.74431 3.3355 0.11196
t+9 -1.8663 -0.70012 0.061826 0.70271 3.2432 0.10937
t+10 -1.9256 -0.67817 0.055261 0.64646 3.3439 0.11116
.....................
Sigma (summary):
min q0.25 mean q0.75 max forecast[analytic]
t+1 0.90218 0.90218 0.90218 0.90218 0.90218 0.90218
t+2 0.90107 0.90107 0.90107 0.90107 0.90107 0.90107
t+3 0.89997 0.89997 0.89997 0.89997 0.89997 0.89997
t+4 0.89887 0.89887 0.89887 0.89887 0.89887 0.89887
t+5 0.89777 0.89777 0.89777 0.89777 0.89777 0.89777
t+6 0.89667 0.89667 0.89667 0.89667 0.89667 0.89667
t+7 0.89557 0.89557 0.89557 0.89557 0.89557 0.89557
t+8 0.89447 0.89447 0.89447 0.89447 0.89447 0.89447
t+9 0.89337 0.89337 0.89337 0.89337 0.89337 0.89337
t+10 0.89228 0.89228 0.89228 0.89228 0.89228 0.89228
.....................
My question is how to extract lower limit and upper limit (q0.25 and q0.75 )columns from this output ?
I used str(garch11.boot)
, but couldn't find anything related to this.
Upvotes: 0
Views: 997
Reputation: 17689
The data is within garch11.boot@forc
.
You can extract it by running the following code:
sig = sigma(garch11.boot@forc)
ser = fitted(garch11.boot@forc)
zs = cbind(t(as.data.frame(garch11.boot, which = "sigma", type = "summary")), sig)
zr = cbind(t(as.data.frame(garch11.boot, which = "series", type = "summary")), ser)
zr[, c(2, 4)]
zs[, c(2, 4)]
Explanation:
One way to arrive at this code is to reverse engineer the print()
method of that package, where you see your desired result.
You can find the print method here:
https://github.com/cran/rugarch/blob/1ad7e9ddb5ebaea9b191eb8326353334196f3ebc/R/rugarch-methods.R#L1607.
Going through that code will lead you to the code provided above.
Upvotes: 2