x: a series representing the standardized residuals of some estimated model.
lags: the lags for the co-moment test.
skewness: the skewness of the estimated model residuals.
kurtosis: the kurtosis of the estimated model residuals.
...: not currently used.
Returns
An object of class tstest.gmm which has a print and as_flextable method.
Details
For parametric models estimated with a particular distribution, the skewness and kurtosis should flow from the distributional model. See for example dskewness and dkurtosis.
Examples
library(tsgarch)library(tsdistributions)library(data.table)library(xts)data("spy")spyr <- na.omit(diff(log(spy)))spec <- garch_modelspec(spyr, model ="egarch", order = c(2,1), constant =TRUE,distribution ="jsu")mod <- estimate(spec)skewness <- dskewness("jsu", skew = coef(mod)["skew"], shape = coef(mod)["shape"])# kurtosis is dkurtosis is the excess over the Normal (3) so we add back 3# since the test takes the actual not excess kurtosis.kurtosis <- dkurtosis("jsu", skew = coef(mod)["skew"], shape = coef(mod)["shape"])+3test <- gmm_test(residuals(mod, standardize =TRUE), lags =2, skewness = skewness,kurtosis = kurtosis)print(test, collapse =TRUE, include.decision =TRUE)