[R-SIG-Finance] rugarch and fGarch

Belgarath marco.cora at googlemail.com
Thu Jun 14 20:07:55 CEST 2012


Thank you very much Alexios.

One more question, related to my point (4) two messages above, where I
probably have not been very clear. Please see the following code.

---
getSymbols("^GSPC", src="yahoo")
getSymbols("^VIX", src="yahoo")
SPY.log.ret=ClCl(GSPC)
#GA3=garchFit(formula=~arma(1,0)+aparch(1,1),data=last(SPY.log.ret,1371),cond.dist="sstd")
#summary(GA3)
modeltofit=ugarchspec(variance.model = list(model = "apARCH", garchOrder =
c(1, 1), 
                    submodel = NULL, external.regressors = NULL,
variance.targeting = FALSE),
                    mean.model = list(armaOrder = c(1, 0), include.mean =
TRUE, archm = FALSE, 
                    archpow = 1, arfima = FALSE, external.regressors = NULL,
archex = FALSE), 
                    distribution.model = "sstd", start.pars = list(),
fixed.pars = list())

#GAA3=ugarchfit(spec=modeltofit,data=last(SPY.log.ret,1371),fit.control=list(scale=1))
#show(GAA3)
volforecast=ugarchroll(spec=modeltofit,data=last(SPY.log.ret,1371), n.ahead
= 21, 
                       forecast.length = 420, refit.every = 21,
                       fit.control=list(scale=1))
sigma=as.data.frame(volforecast,which="density",n.ahead=21)
sigmat <- as.Date(strptime(sigma[,1],format="%Y-%m-%d"))
sigma2 <- xts(sigma[,3],order.by=sigmat)*100*sqrt(252)
plot(sigma2)
lines(Cl(VIX), col="red")

sigmat <- as.Date(index(first(last(GSPC,420+21),420)))
sigma2 <- xts(sigma[,3],order.by=sigmat)*100*sqrt(252)

plot(sigma2)
lines(Cl(VIX), col="red")

---

As you can see the two are very distant: I think the dates that are passed
by the as.data.frame(volforecast,which="density",n.ahead=21) refers to the
forecast date (i.e. 2012-05-07     20.7   means the vol is forecasted to be
20.7 on the 2012-05-07) not the date in which the forecast is made (i.e. the
forecast for the 21d vol made on the 2012-05-07 is 20.7). I realise I was
not very clear in my previous question...

So if I instead use

---
sigmat2 <- as.Date(index(first(last(GSPC,420+21),420)))
sigma3 <- xts(sigma[,3],order.by=sigmat)*100*sqrt(252)

plot(sigma3)
lines(Cl(VIX), col="red")

----

they are now aligned. 

So if I want the 21d forecast aligned with the date they have been made I
have to go for the second version, correct?

In this way thou I missed the last 21 days in the sample, do you think there
is a way to get them back?

Thank you very much for all the help!
Rgds,
marco








--
View this message in context: http://r.789695.n4.nabble.com/rugarch-and-fGarch-tp4633077p4633432.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list