包序列中的R - garch函数,如何用该函数的结果预测值



我有一系列股票日志回报,比如100个值。我想用GARCH来预测时刻101的波动率。如果我使用tseries包中的garch函数,我会这样调用它:

garch(myData, order=c(1, 1)) 

所以考虑p = q = 1。这个函数返回一个对象,其中包含100个拟合值(第一个是NA)、系数(a0、a1和a2)和100个残差(第一个也是NA)。我如何使用这些信息来预测时间101的波动?

我的第一个猜测是计算:

Vol_101 = a0  +  a1 * fitted.values[100] + a2 * residuals[100]

但是从我得到的结果来看,这绝对是不对的。我如何使用GARCH信息来预测不属于原始数据的时间段的波动性?

许多谢谢,

Chicoscience

也许你可以使用fGarch包:

library(fGarch)
y1 <- myData # store your series of returns in y
# parameter estimates
g = garchFit(~garch(1,1), y1, cond.dist= "norm", include.mean=FALSE, trace=FALSE)  
omega = g@fit$matcoef[1,1]
alpha = g@fit$matcoef[2,1]
beta = g@fit$matcoef[3,1]
sigma2 = omega + alpha * y1[100]^2 + beta*g@h.t[100] # compute sigma2 for t+1
print(sigma2)

在封装fGarch中,有一个功能predict可以帮助您从样品中获得挥发性。作为同伴的例子:

library(fGarch)
da=read.table("m-intcsp7309.txt",header=T)
intc=log(da$intc+1)
length(intc)
#numbers of sample is 444 
m4=garchFit(~1+garch(1,1),data=intc,trace=F)
condPre <- predict(m4, n.ahead = 5)
condPre$standardDeviation

standardDeviation在样品外储存挥发性(从445到449)

standardDeviation只是条件标准差!

相关内容

最新更新