I have fitted two competing GARCH models, one GARCH(1,2)
model and another EGARCH(1,1,1)
both with t-distributed errors, on the log-returns of EquinorASA (Norwegian gas equity). I will not go through the preliminary checks, but the assumptions for GARCH(1,2)
hold.
I have used Kevin Shepard's well-known arch library. To select the model, I would like to split the time-series into train/test (this is easily done with TimeSeriesSplit
from sklearn
).
For simplicity, let's just consider the GARCH(1,2)
model.
This is excerpt from the code:
logr_train, logr_test = logr[train_index], logr[test_index]
N_train = len(train_index)
N_test = len(test_index)
specs = {
'mean':'zero',
'vol':'GARCH',
'p':1,
'q':2,
'dist':'t',
'rescale':True
}
model = arch_model(y=logr_train, **specs)
res = model.fit(first_obs=0, last_obs=len(logr_train))
forecast = res.forecast(horizon=N_test, method='simulation', simulations=1000, reindex=False)
This is the summary print:
The dilemma: what do we actually compare between train and test?
What I have considered so far?
- Empirical volatility of test log-returns vs. Expectation of simulated volatility This would be simply:
forecast.variance.shape # second dimension is the same as size of test time-series
(1, 499)
np.sqrt(forecast.variance.values[0][-1]) # this is slicing the last value of the simulations (when it converges)
1.6180795243550963
np.std(logr_test) * 100
1.1331922351104446
error = np.sqrt(forecast.variance.values[0][-1]) - np.std(logr_test) * 100
error
0.4848872892446516
- Is there a way to somehow recover the log-returns?
Since GARCH(1,2)
is defined as:
$$
X_{t} = \sigma_{t}Z_{t} \\
Z_{t} \sim N(0,1) \\
\sigma_{t}^{2} = \alpha_{0} + \alpha_{1}X^{2}_{t-1} + \beta_{1}\sigma^{2}_{t-1} + \beta_{2}\sigma^{2}_{t-2}
$$
Given the estimated parameters, could there be a way to compute predicted $\hat{X_{t+n}}^{2}$ and then compute the error between that and the log-returns of $X_{t+n}$ from the test sample?
I have already checked the Q&As here for "evaluating garch models" and "GARCH model, expectation of volatility?", to no avail.