您无需为presample 设置参数。它将提供一个“好的”猜测,并且在估计参数时它并不重要。如果你想模拟数据,那么我会确保老化 n.start 足够大。
我们来看一个例子:
library(fGarch)
## First we simulate some data without setting presample:
# we set up the model by spec:
set.seed(911)
spec <- garchSpec(model = list(mu = 0.02, omega = 0.05, alpha = 0.2, beta = 0.75))
# then simulate our GARCH(1,1) model:
garchSim <- garchSim(spec, n = 200, n.start = 1)
plot(garchSim)
和估计:
> garchFit(~ garch(1, 1), data = garchSim)
Error Analysis:
Estimate Std. Error t value Pr(>|t|)
mu -0.02196 0.05800 -0.379 0.7049
omega 0.03567 0.02681 1.331 0.1833
alpha1 0.12074 0.04952 2.438 0.0148 *
beta1 0.84527 0.05597 15.103 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log Likelihood:
-265.8417 normalized: -1.329209
现在让我们尝试添加一个非常极端的预采样。在上述模型(和这个种子)中,presample 是:
> spec@presample
Presample:
time z h y
1 0 -0.4324072 1 0.02
现在我们将其替换为c(100, 0.1, 0.1)。由于我的模型是没有任何 ARMA 部分的 GARCH(1,1),我只需要设置文档 ?garchSpec 中描述的 3 个参数。更新spec后我们估计是同一个模型:
set.seed(911)
spec@presample <- matrix(c(0.1, 0.1, 0.1), ncol = 3)
garchFit(~ garch(1, 1), data = garchSim)
输出相同:
Error Analysis:
Estimate Std. Error t value Pr(>|t|)
mu -0.02196 0.05800 -0.379 0.7049
omega 0.03567 0.02681 1.331 0.1833
alpha1 0.12074 0.04952 2.438 0.0148 *
beta1 0.84527 0.05597 15.103 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log Likelihood:
-265.8417 normalized: -1.329209
可能性和估计值是相同的,但请注意当我们使用新的spec 进行模拟时:
set.seed(911)
garchSim <- garchSim(spec, n = 200, n.start = 1)
plot(garchSim)
,提供的极端初始样本搞砸了我们很好的模拟。但是通过增加burn.in 我们得到:
set.seed(911)
garchSim <- garchSim(spec, n = 200, n.start = 100)
plot(garchSim)