1

我曾尝试在 R 中使用 garchFit 并发现一些非常奇怪的东西,似乎所有的拟合都是一样的。我尝试使用 R 页面中的示例并发现相同的结果。

如果您打开 R 并键入以下内容:

library(fGarch);
## UNIVARIATE TIME SERIES INPUT:
# In the univariate case the lhs formula has not to be specified ...
# A numeric Vector from default GARCH(1,1) - fix the seed:
N = 200
x.vec = as.vector(garchSim(garchSpec(rseed = 1985), n = N)[,1])
garchFit(~ garch(1,1), data = x.vec, trace = FALSE)
# An univariate timeSeries object with dummy dates:
x.timeSeries = dummyDailySeries(matrix(x.vec), units = "GARCH11")
gfit = garchFit(~ garch(1,1), data = x.timeSeries, trace = FALSE)

然后进行以下健全性检查似乎表明残差计算正确:

gfit@residuals == (x.vec - gfit@fitted)

但是,如果您检查 gfit@fitted 的内容,您会发现所有值都是相同的!所以基本上 garchFit 函数找到了一条水平线?

这个例子是预期的吗?

4

1 回答 1

6

GARCH 对序列的方差进行建模,因此我们不会期望拟合值(序列均值的估计值)发生变化,因为您所做的只是为方差指定模型。

这意味着您拟合的模型中的平均值有一个 ARMA(0,0):

R> gfit = garchFit(~ garch(1,1), data = x.timeSeries, trace = TRUE)

Series Initialization:
 ARMA Model:                arma
 Formula Mean:              ~ arma(0, 0)
 GARCH Model:               garch
 Formula Variance:          ~ garch(1, 1)

如果您使用均值和方差模型拟合该系列,则拟合值确实会有所不同:

R> gfit2 = garchFit(~ arma(1,1) + garch(1,1), data = x.timeSeries, trace = FALSE)
R> head(gfit2@fitted)
   1970-01-01    1970-01-02    1970-01-03    1970-01-04    1970-01-05 
-0.0010093158 -0.0004840687 -0.0002678956 -0.0006093776 -0.0003781936 
   1970-01-06 
 0.0004521798
于 2012-08-05T16:41:37.883 回答