gmm_test | R Documentation |
The GMM orthogonality test of Hansen (1982).
gmm_test(x, lags = 1, skewness = 0, kurtosis = 3, ...)
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. |
For parametric models estimated with a particular distribution, the
skewness and kurtosis should flow from the distributional model. See for example
dskewness
and
dkurtosis
.
An object of class “tstest.gmm” which has a print and as_flextable method.
Hansen1982tstests
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"]) + 3
test <- gmm_test(residuals(mod, standardize = TRUE), lags = 2, skewness = skewness,
kurtosis = kurtosis)
print(test, collapse = TRUE, include.decision = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.