Hey, I want to Forecast SPX using SPX, GVZ, VIX, and OVX stocks using mGARCH but my model is not running properly. Please, anyone, help me to understand this.
My code:
data_xts <- xts(data, order.by = data$Dates)
logreturns <- diff(log(data$SPX,data$VIX))
logreturns <- diff(log(data$OVX,data$GVZ))
plot(log(data[,2:5]), col = c("black", "orange", "magenta"),
main = "Log-prices of the Four ETFs", legend.loc = "topleft")
ugarch_spec <- ugarchspec(mean.model = list(armaOrder = c(0,0), include.mean = FALSE),
variance.model = list(model = "sGARCH", garchOrder = c(1,1)))
dcc_spec <- dccspec(uspec = multispec(replicate(ugarch_spec, n = 4)),
VAR = TRUE, lag = 4,
model = "DCC", dccOrder = c(1,1))
# estimate model
garchdcc_fit <- dccfit(dcc_spec, data = logreturns, solver = "nlminb")
Sample data set:
| Dates |
SPX |
VIX |
OVX |
GVZ |
| 1/4/2010 |
1132.985478 |
20.04 |
35.44 |
24.59 |
| 1/5/2010 |
1136.523386 |
19.35 |
34.27 |
23.34 |
| 1/6/2010 |
1137.13783 |
19.16 |
34.4 |
23.9 |
| 1/7/2010 |
1141.694928 |
19.06 |
33.61 |
23.32 |
| 1/8/2010 |
1144.983058 |
18.13 |
31.34 |
22.04 |
| 1/11/2010 |
1146.978977 |
17.55 |
30 |
20.97 |
| 1/12/2010 |
1136.221168 |
18.25 |
31.61 |
21.97 |
| 1/13/2010 |
1145.676014 |
17.85 |
32.75 |
20.63 |
| 1/14/2010 |
1148.460648 |
17.63 |
30.86 |
21.34 |
| 1/15/2010 |
1136.028881 |
17.91 |
29.8 |
21.48 |
| 1/19/2010 |
1150.232178 |
17.58 |
28.52 |
21.31 |
| 1/20/2010 |
1138.040246 |
18.68 |
31.15 |
22.85 |
| 1/21/2010 |
1116.478536 |
22.27 |
32.51 |
24.82 |
| 1/22/2010 |
1091.755535 |
27.31 |
34.85 |
26.01 |
| 1/25/2010 |
1096.784901 |
25.41 |
33.33 |
24.73 |
| 1/26/2010 |
1092.165948 |
24.55 |
33.78 |
24.35 |
| 1/27/2010 |
1097.504182 |
23.14 |
34.23 |
24.08 |
| 1/28/2010 |
1084.526415 |
23.73 |
33.28 |
23.35 |
| 1/29/2010 |
1073.869364 |
24.62 |
34.05 |
23.87 |
| 2/1/2010 |
1089.188735 |
22.59 |
32.45 |
23.84 |
| 2/2/2010 |
1103.323052 |
21.48 |
32.44 |
22.75 |
| 2/3/2010 |
1097.281694 |
21.6 |
34.65 |
22.09 |
| 2/4/2010 |
1063.10986 |
26.08 |
38.51 |
27.19 |
| 2/5/2010 |
1066.186826 |
26.11 |
39.99 |
27.59 |
| 2/8/2010 |
1056.744665 |
26.51 |
39.53 |
26.88 |
| 2/9/2010 |
1070.52374 |
26 |
38.74 |
25.45 |
| 2/10/2010 |
1068.134595 |
25.4 |
37.91 |
26.02 |
| 2/11/2010 |
1078.466575 |
23.96 |
36.04 |
25.48 |
| 2/12/2010 |
1075.513262 |
22.73 |
36.04 |
24.29 |
| 2/16/2010 |
1094.87096 |
22.25 |
36.15 |
25.38 |
| 2/17/2010 |
1099.509086 |
21.72 |
35.38 |
24.88 |
| 2/18/2010 |
1106.752095 |
20.63 |
33.36 |
24 |
| 2/19/2010 |
1109.172983 |
20.02 |
34.63 |
24.05 |
| 2/22/2010 |
1108.014922 |
19.94 |
33.68 |
23.53 |
| 2/23/2010 |
1094.60157 |
21.37 |
34.88 |
23.89 |
| 2/24/2010 |
1105.244201 |
20.27 |
33.46 |
22.68 |
| 2/25/2010 |
1102.942516 |
20.1 |
33.56 |
21.85 |
| 2/26/2010 |
1104.493369 |
19.5 |
32.82 |
21.31 |
| 3/1/2010 |
1115.71248 |
19.26 |
34.29 |
21.13 |
| 3/2/2010 |
1118.31055 |
19.06 |
34.88 |
21.76 |
| 3/3/2010 |
1118.789921 |
18.83 |
34.53 |
21.37 |
| 3/4/2010 |
1122.973559 |
18.72 |
33.54 |
20.06 |
| 3/5/2010 |
1138.698076 |
17.42 |
32.67 |
19.29 |
| 3/8/2010 |
1138.504872 |
17.79 |
33.22 |
19.89 |
| 3/9/2010 |
1140.446408 |
17.92 |
33.19 |
19.88 |
| 3/10/2010 |
1145.608971 |
18.57 |
33.28 |
20.93 |
| 3/11/2010 |
1150.243149 |
18.06 |
32.7 |
20.19 |
| 3/12/2010 |
1149.991906 |
17.58 |
32.11 |
20.16 |
| 3/15/2010 |
1150.513867 |
18 |
33.38 |
20.9 |