我正在尝试通过使用R中的RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^https://example.com%{REQUEST_URI} [NS,R,L]
RewriteRule ^((?:[a-zA-Z0-9_-]|%20)+)/?$ member.php?id=$1
包中的ugarchroll
函数,使用ARCH(1)模型来生成每日滚动样本外预测。但是,这些样本外-样本预测与原始样本外回报系列的日历日期不同,因此不匹配。
为澄清起见,我的采样期从 2000-01-05 到 2004-08-06 (1,000个观察值)开始,而样本外时期从 2004-08-09 开始到 2018-03-27 (3,078个观测值)。
我的样本数据如下:
rugarch
我使用以下代码执行每日滚动ARCH(1)预测:
> show(Data_v016_inclEM)
# A tibble: 4,078 x 68
date1 t sp_op sp_cp sp_high sp_low mxx_op mxx_cp mxx_high mxx_low hsi_op hsi_cp hsi_high hsi_low ks_op
<date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 2000-01-05 1 1396. 1402. 1413. 1378. 6675. 6764 6781. 6524. 16609. 15847. 16609. 15688. 1007.
2 2000-01-06 2 1399. 1403. 1412. 1392. 6764. 6752. 6822. 6743. 15942. 15153. 15971. 14764. 1014.
3 2000-01-07 3 1403. 1441. 1441. 1401. 6769. 7047. 7054. 6769. 15329. 15406. 15514. 15109. 949.
4 2000-01-10 4 1441. 1457. 1464. 1441. 7048. 7334. 7337. 7048. 15631 15848. 16065. 15631 980.
5 2000-01-11 5 1457. 1438. 1459. 1434. 7332. 7143. 7363. 7078. 15981. 15862. 16196. 15736. 992.
6 2000-01-12 6 1439. 1432. 1443. 1427. 7143. 7174. 7174. 7091. 15692. 15714. 15744. 15546. 958.
7 2000-01-13 7 1432. 1450. 1454. 1432. 7174. 7275. 7426. 7174. 15763. 15634. 15861. 15459. 955.
8 2000-01-14 8 1450. 1464. 1473 1450. 7279. 7381. 7394. 7279. 15742. 15542. 15863. 15322. 959.
9 2000-01-18 9 1465. 1455. 1465. 1451. 7447. 7304. 7447. 7302. 15576. 15789. 15801. 15508. 992.
10 2000-01-19 10 1452. 1456. 1461. 1449. 7303. 7171. 7311. 7171. 15719. 15275. 15719. 15192. 969.
# ... with 4,068 more rows, and 53 more variables
每日滚动ARCH(1)预测从某种程度上与上述样本外时期不同的日历日期开始。从下面的结果中可以看到,它创建了一个日期条目,从 1972-09-28 到 1981-03-02 。
ARCH_1 <- ugarchspec(variance.model = list(garchOrder = c(1,0)),mean.model = list(armaOrder = c(0,0)))
Fit_ARCH_1 <- ugarchfit(spec = ARCH_1, data = Data_v016_inclEM$ret_sp_index, out.sample = 3078, solver = "hybrid")
Var_ARCH_1 <- Fit_ARCH_1@fit$var
# Out-of-sample rolling forecasts #
cluster <- makePSOCKcluster(10)
CVAR_ARCH1_h1 <- ugarchroll(ARCH_1, Data_v016_inclEM$ret_sp_index, n.ahead = 1, forecast.length = 3078, n.start = 1000, refit.every = 1, refit.window = "moving", window.size = 1000, solver = "hybrid", solver.control = list(tol = 1e-6, trace = 1), keep.coef = TRUE, fit.control = list(scale = 1))
CVAR_ARCH1_h1 <- resume(CVAR_ARCH1_h1, solver = "gosolnp")
show(CVAR_ARCH1_h1)
stopCluster(cluster)
View(CVAR_ARCH1_h1@forecast$density)
report(CVAR_ARCH1_h1)
report(CVAR_ARCH1_h1, type = "fpm")
那么,这些样本外预测的日历日期怎么可能与上述样本外时期的日历日期不匹配?我可能缺少哪些步骤才能正确进行此滚动预测?我该如何解决这个小问题?
感谢任何帮助!