我一直在使用两个软件包fGarch和rugarch来使GARCH(1,1)模型适合我的汇率时间序列,该序列由3980个每日对数返回组成。
fx_rates <- data.frame(read.csv("WMCOFixingsTimeSeries.csv", header=T, sep=";", stringsAsFactors=FALSE))
#data series
EURUSD <- ts(diff(log(fx_rates$EURUSD), lag=1), frequency=1)
#GARCH(1,1)
library(timeSeries)
library(fGarch)
x <- EURUSD
fit <- garchFit(~garch(1,1), data=x, cond.dist="std", trace=F, include.mean=F)
fit@fit$matcoef
library(rugarch)
spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)),
mean.model=list(armaOrder=c(0,0), include.mean=F), distribution.model="std")
gfit <- ugarchfit(spec, x, solver="hybrid", fit.control=list(stationarity=0))
gfit@fit$matcoef
这两个模型显示以下结果:
fGarch:
fit@fit$matcoef
Estimate Std. Error t value Pr(>|t|)
omega 1.372270e-07 6.206406e-08 2.211054 2.703207e-02
alpha1 2.695012e-02 3.681467e-03 7.320484 2.471356e-13
beta1 9.697648e-01 3.961845e-03 244.776060 0.000000e+00
shape 8.969562e+00 1.264957e+00 7.090804 1.333378e-12
rugarch:
gfit@fit$matcoef
Estimate Std. Error t value Pr(>|t|)
omega 1.346631e-07 3.664294e-07 0.3675008 7.132455e-01
alpha1 2.638156e-02 2.364896e-03 11.1554837 0.000000e+00
beta1 9.703710e-01 1.999087e-03 485.4070764 0.000000e+00
shape 8.951322e+00 1.671404e+00 5.3555696 8.528729e-08
我找到了关于为什么估算值不一致的http://r.789695.n4.nabble.com/Comparison-between-rugarch-and-fGarch-td4683770.html线索,但是我无法弄清楚标准误差以及欧米茄的不同含义之间的巨大差异。差异不是由平稳性约束引起的,因为欧米茄仍然微不足道。有人知道估算参数(Ω,α,β和nu(形状))的标准误差是如何计算的吗?
最佳答案
如果H
是您的Hessian,而G
是您的渐变,则使C = H^-1 (G^T * G) H^-1
,即H
的倒数乘以G
转置与G
的矩阵相乘的结果,然后将结果相乘与H
再次相反。然后,标准误差系数为sqrt(diag(C))
,即其对角线条目的平方根。您可以通过仔细阅读fGarch:::.garchFit
的代码来查看:
# Standard Errors and t-Values:
if (DEBUG) print("Standard Errors and t-Values ...")
fit$cvar <-
if (robust.cvar)
(solve(fit$hessian) %*% (t(fit$gradient) %*% fit$gradient) %*%
solve(fit$hessian))
else
- solve(fit$hessian)
fit$se.coef = sqrt(diag(fit$cvar))
fit$tval = fit$coef/fit$se.coef
fit$matcoef = cbind(fit$coef, fit$se.coef,