Tutorials › Econometrics (Graduate) › Deriving Hansen’s J Test

Generalized Method of Moments · Tutorial 218 of 952

Deriving Hansen’s J Test

See how the efficient GMM criterion reduces to the squared length of a projected normal vector, giving Hansen’s J test its chi-squared limit and degrees of freedom.

Advanced 12 min read

What You'll Learn

  • Define Hansen’s J statistic using the fitted sample moments and an estimate of their long-run covariance.
  • State the regularity conditions that yield its asymptotic reference distribution.
  • Derive the projection that removes the parameter-estimation directions from the moment vector.
  • Explain why the chi-squared degrees of freedom equal the number of moments minus the number of estimated parameters.
  • Work through numerical examples with identity and non-identity moment covariance matrices.
  • Recognize why exact identification gives no overidentification test and why arbitrary weighting changes the result.

Why the Minimized GMM Criterion Has a Reference Distribution

GMM estimates parameters by making a vector of sample moments close to zero. When there are more moment conditions than parameters, fitting the parameters can reduce—but generally cannot eliminate—all components of that vector. Hansen’s \(J\) statistic measures the remaining discrepancy using the efficient, covariance-adjusted metric. Under correct specification, its limiting distribution is chi-squared. The degrees of freedom count the moment directions left after estimating the parameters.

The key is not simply that there are \(q\) moments. Estimation uses \(p\) parameter directions to fit them, so only \(q-p\) directions remain for the minimized criterion. The derivation makes this subtraction precise by expressing the criterion as a squared length after projecting out the directions associated with parameter changes.

Model, Statistic, and Assumptions

Definition: Let \(m_i(\theta)\) be a \(q\)-dimensional vector of moment functions for observation \(i\), where \(\theta\) is a \(p\)-dimensional parameter. The sample moment vector is \(\bar{g}_n(\theta)=n^{-1}\sum_{i=1}^n m_i(\theta)\). The parameter value \(\theta_0\) is correctly specified when \(E[m_i(\theta_0)]=0\). Let \(S\) denote the long-run covariance matrix of the moments at \(\theta_0\). For independent observations, \(S=\operatorname{Var}(m_i(\theta_0))\); under suitable dependence, it is the corresponding long-run covariance.

The efficient GMM weight is \(S^{-1}\), assuming \(S\) is positive definite. In practice, \(S\) is unknown and is replaced by a consistent estimate \(\hat{S}\). If \(\hat{\theta}\) minimizes the criterion using this efficient weight, the Hansen statistic is

$$ J_n=n\,\bar{g}_n(\hat{\theta})'\hat{S}^{-1}\bar{g}_n(\hat{\theta}). $$

The factor \(n\) is essential: sample moments fluctuate at order \(n^{-1/2}\), so their squared, covariance-adjusted size is of order \(n^{-1}\) before multiplication by \(n\). The criterion is nonnegative when \(\hat{S}\) is positive definite.

The standard result uses \(q\ge p\), with \(q>p\) for a nontrivial test, and requires the following regularity conditions: the moment restrictions hold at \(\theta_0\); a central limit theorem gives \(\sqrt{n}\bar{g}_n(\theta_0)\) a mean-zero normal limit with covariance \(S\); the moments are differentiable near \(\theta_0\); and their Jacobian

$$ G=E\!\left[\frac{\partial m_i(\theta_0)}{\partial\theta'}\right] $$

has full column rank \(p\). Also assume \(S\) is finite and positive definite, the estimator is consistent and has the usual root-\(n\) local expansion, and the estimated efficient weight converges to \(S^{-1}\). These conditions make the parameter directions locally distinguishable and allow the covariance-adjusted criterion to have a stable limit.

Derivation: Fitting Removes \(p\) Directions

Write \(Z_n=\sqrt{n}\bar{g}_n(\theta_0)\) and \(h_n=\sqrt{n}(\hat{\theta}-\theta_0)\). Differentiability and root-\(n\) consistency give the local approximation

$$ \sqrt{n}\bar{g}_n(\hat{\theta}) = Z_n+Gh_n+o_p(1), \qquad Z_n\ \xrightarrow{d}\ N(0,S). $$

Thus, to first order, minimizing the efficient GMM criterion is equivalent to choosing \(h\) to minimize \((Z_n+Gh)'S^{-1}(Z_n+Gh)\). Since \(G\) has full column rank and \(S\) is positive definite, \(G'S^{-1}G\) is invertible. Differentiating this quadratic with respect to \(h\), setting the derivative to zero, and solving gives

$$ \hat{h} = -(G'S^{-1}G)^{-1}G'S^{-1}Z_n. $$

Substituting this value into the criterion yields the first-order expression for the minimized statistic:

$$ J_n = Z_n'\left[ S^{-1}-S^{-1}G(G'S^{-1}G)^{-1}G'S^{-1} \right]Z_n+o_p(1). $$

To see the distribution clearly, whiten the moment vector. Let \(U_n=S^{-1/2}Z_n\) and \(B=S^{-1/2}G\), where \(S^{-1/2}\) is the symmetric inverse square root. Then \(U_n\) converges in distribution to a \(q\)-dimensional standard normal vector, and the criterion becomes

$$ J_n = U_n'\left[I-B(B'B)^{-1}B'\right]U_n+o_p(1). $$

The matrix \(P_B=B(B'B)^{-1}B'\) is the orthogonal projection onto the column space of \(B\). That space has dimension \(p\), because \(G\) has full column rank. Consequently, \(I-P_B\) is an orthogonal projection of rank \(q-p\). An orthogonal change of coordinates makes this projection diagonal, with \(q-p\) ones and \(p\) zeros. The quadratic form therefore has the same limiting distribution as a sum of squares of \(q-p\) independent standard normal variables.

Theorem: Under correct specification and the regularity conditions above, the minimized, optimally weighted GMM criterion satisfies \(J_n\xrightarrow{d}\chi^2_{q-p}\). The degrees of freedom are the number \(q\) of moment conditions minus the number \(p\) of estimated parameters.

Worked Calculations

Worked Example: Three Moments and One Parameter

Hypothetical local calculation. Suppose \(n=100\), \(q=3\), \(p=1\), and \(S=I\). Near \(\theta_0=0\), take \(\bar{g}_n(\theta)=\bar{g}_n(0)+G\theta\), with \(G=(1,1,0)'\) and \(\bar{g}_n(0)=(0.10,0.20,0.20)'\). These values describe a hypothetical set of sample moment summaries; the assumed covariance and linear approximation are for illustration.

First scale the moments at \(\theta_0\): \(Z=\sqrt{100}\bar{g}_n(0)=(1,2,2)'\). Since \(G'G=2\) and \(G'Z=3\), the minimizing local change is \(h=-3/2=-1.5\), or \(\hat{\theta}=h/\sqrt{100}=-0.15\). The scaled fitted moments are

$$ Z+Gh=(1,2,2)'+(1,1,0)'(-1.5)=(-0.5,0.5,2)'. $$

With identity weighting, \(J_n\) is the squared length of this vector: \(J_n=(-0.5)^2+(0.5)^2+2^2=0.25+0.25+4=4.50\). There are \(q-p=3-1=2\) degrees of freedom. For a chi-squared variable with two degrees of freedom, the upper-tail probability at 4.50 is \(e^{-4.50/2}\approx0.1054\). This calculation illustrates the reference distribution; it does not turn the asymptotic approximation into an exact finite-sample distribution.

Worked Example: Accounting for Unequal Moment Variances

Hypothetical local calculation. Let \(n=100\), \(q=3\), \(p=1\), \(S=\operatorname{diag}(4,1,1)\), and \(G=(2,1,0)'\). Suppose the moment vector at \(\theta_0=0\) is \(\bar{g}_n(0)=(0.20,0.20,0.10)'\), with the same local linear form as in the previous example. The scaled vector is \(Z=(2,2,1)'\), and \(S^{-1}=\operatorname{diag}(0.25,1,1)\).

The minimizing local change uses \(G'S^{-1}Z=3\) and \(G'S^{-1}G=2\), so \(h=-3/2=-1.5\) and \(\hat{\theta}=-0.15\). The fitted scaled moment vector is \(Z+Gh=(-1,0.5,1)'\). Substitution into the weighted criterion gives

$$ J_n=(-1,0.5,1) \begin{pmatrix}0.25&0&0\\0&1&0\\0&0&1\end{pmatrix} \begin{pmatrix}-1\\0.5\\1\end{pmatrix} =0.25+0.25+1=1.50. $$

Equivalently, the minimized value is \(Z'S^{-1}Z-(G'S^{-1}Z)^2/(G'S^{-1}G)=6-9/2=1.50\). Again the degrees of freedom are \(3-1=2\); the chi-squared upper-tail probability is \(e^{-1.50/2}\approx0.4724\). The example shows why the projection is in the covariance-adjusted metric rather than the unweighted Euclidean metric.

Worked Example: Four Moments and Two Parameters

Hypothetical local calculation. Suppose \(n=400\), \(q=4\), \(p=2\), \(S=I\), and \(G\) has columns \((1,0,0,0)'\) and \((0,1,0,0)'\). Let \(\bar{g}_n(0)=(0.05,-0.05,0.10,0.05)'\), so \(Z=(1,-1,2,1)'\). The first two moment directions can be adjusted freely by the two local parameter changes.

Minimizing sets \(h=(-1,1)'\), which leaves \(Z+Gh=(0,0,2,1)'\). Thus \(J_n=0^2+0^2+2^2+1^2=5.00\). Directly, the original fitted sample moments are \((0,0,0.10,0.05)'\), and \(400(0^2+0^2+0.10^2+0.05^2)=400(0.0125)=5.00\), confirming the scale factor. The reference distribution has \(q-p=4-2=2\) degrees of freedom, with upper-tail probability \(e^{-5/2}\approx0.08208\).

Exact Identification and the Weighting Requirement

If \(q=p\) and the Jacobian has full rank, there are no remaining moment directions after fitting the parameters. The degrees of freedom are zero; under regular conditions, the sample moments can be set to zero locally, so the minimized criterion has no nontrivial chi-squared reference distribution. The Hansen \(J\) test is therefore an overidentification test: it requires more moment conditions than parameters.

The covariance weighting is also part of the result. The projection proof relies on weighting by \(S^{-1}\), or by a consistent estimate of it. Minimizing with an arbitrary fixed weight does not generally give the same chi-squared limit for the minimized criterion. Efficient two-step GMM and a regular continuously updated implementation use an estimated efficient weight; consistency of that weight is what preserves the stated limit.

Common Mistake

  • Wrong reasoning: “There are \(q\) moments, so the statistic must have \(q\) degrees of freedom.” This counts directions that were already used to estimate the parameters.
  • Correction: Parameter fitting removes \(p\) locally independent directions. The remaining projection has rank \(q-p\), so that is the chi-squared degrees of freedom. Check that the Jacobian has full column rank; otherwise the usual dimension argument does not apply.
  • Another pitfall: Omitting \(n\) or using the unweighted squared moments changes the statistic. Use \(n\bar{g}_n(\hat{\theta})'\hat{S}^{-1}\bar{g}_n(\hat{\theta})\) for the efficient criterion.
Key takeaway: Under correct specification, efficient weighting and regular identification turn the minimized GMM criterion into the squared length of a standard normal vector projected onto a \(q-p\)-dimensional space. Hence Hansen’s \(J\) statistic is asymptotically \(\chi^2_{q-p}\).

Check Your Understanding

Use the projection argument and assumptions in this tutorial to answer the following.

  1. A model has six moments and three parameters, and the moment Jacobian has full column rank. What is the asymptotic degrees of freedom for its efficient GMM \(J\) statistic?
  2. In the derivation, why is the matrix \(I-B(B'B)^{-1}B'\) a projection, and what is its rank?
  3. Why does exact identification not produce a nontrivial overidentification statistic?
  4. What role does the long-run covariance matrix \(S\) play in the statistic and the derivation?
  5. What condition on an estimated weight matrix is needed for the standard asymptotic result?
Clinical Biostats