AI Glossary / Statistics and probability / Advanced
Sargan - Hansen test
Definition
The Sargan - Hansen test is a name used for related tests of overidentifying restrictions in instrumental-variable and generalized method of moments estimation. These tests ask whether the model's surplus moment conditions are jointly compatible with the data. The classical Sargan statistic and Hansen's J statistic have different construction and error assumptions; the combined name should not obscure which test was actually used.
What it means
An instrumental-variable analysis may use several proposed instruments to estimate the effect of one endogenous explanatory variable. Having additional instruments provides restrictions beyond those needed to estimate the coefficients. Those restrictions create an opportunity to check internal consistency.
A rejection raises a specification concern. It does not identify a particular defective instrument. A non-rejection is not proof that every instrument is valid or that the estimated effect is causal. The substantive argument for the instruments still matters.
How it works
For the classical Sargan calculation, regress fitted IV residuals on the full instrument matrix. Compare the residual sum of squares from this auxiliary regression with the original IV residual sum of squares. Multiply the explained fraction by the sample size.
Hansen's J instead uses the minimized, appropriately weighted GMM moment criterion. Heteroskedasticity robustness requires suitable moment-covariance estimation and weighting; it does not follow merely from calling a statistic "Hansen."
Under the relevant null and regularity assumptions, the reference distribution is asymptotically chi-squared, with degrees of freedom equal to the number of independent moment restrictions minus the number of estimated parameters. Just-identified models have no surplus restrictions for this test.
Three practical examples
1. Pricing analysis: a fictional retailer proposes three instruments for price in a demand equation. The analyst checks their joint consistency and separately explains why each instrument should be excluded from the demand equation.
2. AI adoption research: a team estimates the relationship between adoption and productivity using proposed external variation. A small overidentification p-value triggers review of the identification argument and equation specification before the result enters a business presentation.
3. Automated reporting: a model pipeline records the estimator, instrument set, test variant, statistic, degrees of freedom and p-value. A dashboard that stores only "test passed" would conceal information needed to interpret the result.
Think of it this way
Think of several measuring routes that should support the same destination. Disagreement is useful evidence that something needs investigation. Agreement alone cannot establish that all routes were built correctly, especially if they share the same hidden defect.
Worked example
Consider hypothetical output from a two-stage least-squares model using 100 observations. There is one endogenous regressor and three excluded instruments. Assume the required rank conditions and include the same exogenous controls among the regressors and instruments. The number of overidentifying restrictions is 3 - 1 = 2.
Suppose the fitted IV residuals have a sum of squares of 100. Regress those residuals on the full instrument matrix. Stipulate that the auxiliary regression leaves a residual sum of squares of 92. These are illustrative fitted summaries, not results from a real dataset or a claimed software run.
The fraction removed by the auxiliary projection is 1 - 92/100 = 0.08. The Sargan statistic is therefore 100 × 0.08 = 8.
For a chi-squared reference distribution with two degrees of freedom, the upper-tail probability at eight is exp(-8/2) = exp(-4), approximately 0.0183. Using a prespecified five-percent significance level, this reference calculation rejects the joint restrictions. Its validity depends on the classical test's assumptions, including the appropriate error structure; the arithmetic alone does not establish those assumptions.
Now consider a separate hypothetical fitted result with the same sample size and restriction count, but auxiliary residual sum of squares 98 against original residual sum of squares 100. Its statistic is 100 × (1 - 98/100) = 2. The corresponding reference p-value is exp(-1), approximately 0.3679, so the rule does not reject.
The second result does not establish a 36.79-percent probability that the instruments are valid. It describes an upper-tail probability under the stipulated reference distribution. Nor can either result be relabeled a heteroskedasticity-robust Hansen test without the corresponding estimation and weighting calculation.
Illustrative case study
Fictional Birch Analytics uses the first worked result in a report about an operational change. Its initial draft says, "Instrument three failed the test."
The reviewer points out that the reported statistic concerns the restrictions jointly. The calculation contains no instrument-specific verdict. Birch revises the sentence to report the statistic, two degrees of freedom and approximate p-value, followed by the need to investigate the specification.
The team also finds that its report omitted the estimator and error assumptions. It adds those details and revisits whether its proposed instruments could affect the outcome through other channels. This invented case illustrates disciplined interpretation, not evidence that a particular business intervention works.
Common misconceptions and mistakes
"The test tells us whether the model is overidentified." The restriction count establishes that condition before testing; the test assesses the surplus restrictions.
"A rejection names the bad instrument." The joint result does not provide that diagnosis.
"A large p-value validates the causal story." It does not replace the argument about how the instruments operate.
"Changing standard errors automatically changes the test." Check the actual statistic and weighting procedure reported by the implementation.
Business use
Keep a written explanation for each proposed instrument, including the outcome pathways it is assumed not to influence directly. Record specification changes so that an apparently reassuring final result can be understood in the context of earlier analyses.
For AI-assisted analytics, require generated summaries to distinguish a test result from a causal conclusion. The worked example's first result supports investigation; it does not support automatically deleting the third instrument or changing the intervention recommendation.
People also ask
Is Sargan identical to Hansen J?
No; identify the variant and assumptions.
Can a just-identified model use this check?
There are no surplus restrictions to test.
Does non-rejection prove instrument relevance?
No. Relevance needs separate assessment.
Check your understanding
Why are there two restrictions?
Answer: Three excluded instruments are available for one endogenous regressor.
Why is the first statistic eight?
Answer: It is 100 times the explained residual fraction, 0.08.
Which instrument caused rejection?
Answer: The joint calculation does not say.
Related terms
- Instrumental variables
- Instrumental variable
- two-stage least squares
- generalized method of moments
- moment condition
- overidentification
- exclusion restriction
- heteroskedasticity
Learn next
Recalculate the example with auxiliary residual sum of squares 95, then examine why changing the error assumptions requires more than changing the reported label.
More in Statistics and probability
- Sampling fraction - The sampling fraction is the proportion of a defined finite population selected into a sample, commonly written f = n/N, where n is the sample size and N is...
- Sampling probability - Sampling probability, in finite-population sampling, usually means a unit's inclusion probability: the probability that it appears in the sample under the...
- Sampling risk - Sampling risk is the possibility that a conclusion based on a sample differs from the conclusion obtained by applying the same examination procedure to the...
- Satellite image time series - A satellite image time series is a sequence of satellite observations of an area, ordered by acquisition time and prepared so that measurements can be...
- Satterthwaite solution - The Satterthwaite solution is an approximation used to assign effective degrees of freedom when an estimated variance combines contributions with different...
- Saturated array - A saturated array, in experimental design, is an orthogonal array whose factor main effects use all the available degrees of freedom after allowing for the...
Sources
StataCorp, ivregress postestimation, discussion and formulas for overidentification tests: https://www.stata.com/manuals/rivregresspostestimation.pdf
Kevin Sheppard, linearmodels documentation, IVResults.sargan: https://bashtage.github.io/linearmodels/iv/iv/linearmodels.iv.results.IVResults.sargan.html
Lars Peter Hansen, Large Sample Properties of Generalized Method of Moments Estimators, author publication abstract: https://larspeterhansen.org/lph_research/large-sample-properties-of-generalized-method-of-moments-estimators/
Previous: Sardinas - Patterson algorithm Next: SARSA