# The GMM Orthogonality Test of Hansen

### Description

Implements the GMM Orthogonality Test of Hansen.

### Usage

1 | ```
GMMTest(z, lags = 1, skew=0, kurt=3, conf.level = 0.95)
``` |

### Arguments

`z` |
A numeric vector the standardized residuals. |

`lags` |
The number of lags to test for. |

`skew` |
The skewness of the standardized residuals (derived from the estimated model). This can be either a scalar or numeric vector the same size as z. |

`kurt` |
The kurtosis (not excess) of the standardized residuals (derived from the estimated model). This can be either a scalar or numeric vector the same size as z. |

`conf.level` |
The confidence level at which the Null Hypothesis is evaluated. |

### Details

This is a mispecification test based on Hansen's GMM procedure. Under a correctly specified model, certain population moment conditions should be satisfied and hold in the sample using the standardized residuals. The moment conditions can be tested both individually using a t-test or jointly using a Wald test (the vignette gives more details). The test returns a matrix (moment.mat) containing the first 4 moments statistics, their standard errors and t-values (2-sided t-test with alternative hypothesis that the value is not equal to zero). The matrix of joint conditions (joint.mat) contains the t-values and critical values of ‘Q2’, ‘Q3’ and ‘Q4’ representing the autocorrelation, given the chosen lags in the second, third and fourth moments and distributed as chi-squared with n.lag d.o.f, and the joint test (‘J’) for all moment conditions distributed chi-squared with 4+(n.lagx3) d.o.f.

### Value

A list with the following items:

`joint.mat` |
The matrix of the joint tests. |

`moment.mat` |
The matrix of the individual moment tests. |

`H0` |
The Null Hypothesis. |

`Decision` |
Whether to reject or not the Null given the conf.level. |

### Author(s)

Alexios Ghalanos

### References

Hansen, L. (1982), Large Sample Properties of Generalized Method of Moments
Estimators, *Econometrica*, **50(4)**, 1029–1054.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 | ```
## Not run:
data(dji30ret)
spec = ugarchspec(mean.model = list(armaOrder = c(1,1), include.mean = TRUE),
variance.model = list(model = "gjrGARCH"), distribution.model = "sstd")
fit = ugarchfit(spec, data = dji30ret[, 1, drop = FALSE])
z = residuals(fit)\/sigma(fit)
skew = dskewness("sstd",skew = coef(fit)["skew"], shape= coef(fit)["shape"])
# add back 3 since dkurtosis returns the excess kurtosis
kurt = 3+dkurtosis("sstd",skew = coef(fit)["skew"], shape= coef(fit)["shape"])
print(GMMTest(z, lags = 1, skew=skew, kurt=kurt))
## End(Not run)
``` |