How to compute the gradient for a GARCH with the package rugarch in R I am estimating a GARCH(1,1) with external regressors and the package rugarch allows me to do it easily.
However, to compute QMLE robust standard errors, I need the outer product of the gradient, and therefore, the gradient itself. The code is the following:
uspecSerie1 <- ugarchspec( variance.model = list(model = "sGARCH",garchOrder = c(1,1), external.regressors=as.matrix(Exo)
                                           ),
                     mean.model = list(armaOrder = c(5,4), include.mean = F),
                     distribution.model = "norm")
fit.garchSerie1 <- ugarchfit(spec = uspecSerie1, data = logretSerie1)

The command ugarchfit does not compute the gradient. I tried many things, for example, with the package NumDeriv I tried the following:
grad(ugarchfit, x=fit.garchSerie1@fit$coef, spec = uspecSerie1, data = logretSerie1)

but it does not give results.
Can anyone help me computing the gradient for this object? Thanks

I had the same problem recently. When it comes to robust standard errors, I am not quite sure what is implemented in the rugarch package but it is not QMLE.
In the vignette of the rugarch package the author states that the asymptotic covariance matrix is estimated via
$$
V =(-A)^{-1}B(-A)^{-1}
$$
where
$$
A = \sum_{t=1}^T\frac{\partial^2{\cal l }_t (\theta)}{\partial \theta \partial \theta^\top}
$$
and
$$
B = \sum_{t=1}^T \frac{\partial{\cal l }_t (\theta)}{\partial \theta}\frac{\partial{\cal l }_t (\theta)}{\partial \theta^\top}
$$
You are able to extract these matrices form ugarchfit, (for instance, fit.garchSerie1@fit$A) so you have all your building blocks to estimate the covariance matrix.
