I'm just curious how I would use residual plots to check if the (G)ARCH model is adequate. After estimating the ARIMA, I found that there was still heteroskedasticity in the residuals, so I estimated a GARCH. The code is below:
garch.spec = ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(5,5)),
mean.model = list(armaOrder = c(2,2), include.mean = TRUE,external.regressors = fourier(y, K=11)))
fit11 = ugarchfit(garch.spec,data = ts(solar,start=1,end=14,f=48), solver = "nloptr")
Plotting the residuals:
Whereas the ACF and PACF look alright (to me), the residuals are clearly not homoscedastic, but even upon changing my garchOrder=c(a,b)
, it doesn't change much.
Any help would be much appreciated!
Edit
Hi, great answers, but now I've some additional questions!
-
You mentioned “standardised residuals”, I am curious if I am testing for “standardised residuals”, and if not, how do I test for them? This is the code for the ARIMA, I decided upon the order based on the ACF and PACF. Moreover, because there was heteroskedasticity in the residuals of the ARIMA(2,0,2), I then decided to try a (G)ARCH.
n = 672
y = ts(solar,start=1,end=14,f=48)
fit=Arima(y, order=c(2,0,2), xreg=fourier(y, K=11))
usolar=residuals(fit)
dev.new()
plot(usolar)
dev.new()
acf2(usolar)
dev.new()
plot(y-usolar,usolar) -
From what I understand the Q-Q plot is used to assess if something came from some sort of distribution, however if I have 672 observations would I still use a Q-Q plot?
- You mention statistical tests to check properties, what type of test(s) are recommended?
This is the code for the (G)ARCH, note please that it has been changed from GARCH(5,5) to GARCH(2,2). ACF and PACF of GARCH(2,2) are attached.
n=672
garch.spec = ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(2,2)),
mean.model = list(armaOrder = c(2,2), include.mean = TRUE,external.regressors = fourier(y, K=11)))
fit11 = ugarchfit(garch.spec,data = ts(solar,start=1,end=14,f=48), solver = "nloptr")
uusolar=residuals(fit11)
dev.new()
plot(uusolar)
dev.new()
acf2(uusolar)
- Regarding Fourier series, I’ve added it as an external regressor as part of the mean model. Is it wise to add it again to the variance model?
- My interest is in making forecasts, and then comparing those to my actual values, how important is heteroskedasticity in this regard for my dataset specifically (if you can tell, I don’t know if you can)?
- Is my procedure sensible/correct?
Cheers in advance!
Best Answer
You may wish to assess two properties of the standardized residuals:
You may use statistical tests to check these properties, but you may also try to infer something from residual plots.
You may also look at the simple plot of standardized residuals, as you have already done. They should look more or less like white noise, and you note correctly that this is not quite the case, so the current model might not be entirely appropriate. However, it is difficult to tell whether it would be easy to construct a better model and get better-behaved residuals, though.
Perhaps you could add some seasonal terms (dummies or Fourier series) in either the conditional mean or the conditional variance model, as the heteroskedasticity appears to be seasonal (judging from the first graph).
Edit:
After the edit of the OP, here are answers to the extra questions:
The notion of standardized residuals is relevant for GARCH, but not ARMA models. Standardized residuals in the GARCH model are the sample counterparts of $\varepsilon$ where $$ \begin{aligned} y_t &= \mu_t + u_t, \\ u_t &= \sigma_t \varepsilon_t, \\ \sigma_t^2 &= \omega + \alpha_1 u_{t-1}^2 + \beta_1 \sigma_{t-1}^2, \\ \varepsilon_t &\sim i.i.d.(0,1). \end{aligned} $$ Here the fitted $\hat u_t$ is the raw residual while $\hat \varepsilon_t$ is the standardized residual.
How do you obtain $\hat \varepsilon_t$? Use method
residuals
with the optionstandardize=TRUE
; from the documentation of the "rugarch" package regarding the methodresiduals
applied to classuGARCHfit
:Why not?
For ARCH patterns you may use the Li-Mak test (but not the ARCH-LM test, again because you are applying it on standardized residuals rather than raw data).