Tutorials › Econometrics (Graduate) › Deriving The Hausman Specification Test

Fixed and Random Effects · Tutorial 267 of 952

Deriving The Hausman Specification Test

See how the fixed-effects and random-effects estimates combine into a Hausman statistic, and learn the null hypothesis and covariance assumptions behind its reference distribution.

Intermediate 10 min read

What You'll Learn

  • State the Hausman test’s null and alternative for panel-data random effects.
  • Explain why fixed-effects slopes remain consistent when unit effects correlate with regressors.
  • Derive the covariance matrix of the difference between fixed-effects and random-effects estimates.
  • Identify the conditions that yield a chi-square reference distribution.
  • Interpret the statistic’s degrees of freedom and recognize singular covariance cases.

Why Compare Fixed- and Random-Effects Estimates?

In a static panel, the fixed-effects (FE) estimator removes time-invariant unit heterogeneity by using within-unit variation. The random-effects (RE) estimator instead uses a variance-components structure and can exploit both within- and between-unit variation. The central Hausman question is whether the extra RE restrictions are compatible with the data. Under the null, RE is consistent and more efficient; under the alternative, correlation between the unit effect and the regressors invalidates RE, while FE can remain consistent under its own exogeneity assumptions.

The test is based on the difference between the two slope estimates. If both estimators converge to the same population value under the null, that difference should be small relative to its sampling variability. The derivation matters because the estimates use the same observations and are generally correlated. Treating them as independent gives the wrong variance for their difference.

Model and assumptions: Consider the static panel model \(y_{it}=x_{it}'\beta+\alpha_i+u_{it}\), where \(i\) indexes units and \(t\) indexes periods. For the standard comparison, FE and RE must estimate the same \(k\)-dimensional slope vector \(\beta\), using the same sample and a common specification. Assume the regressors are strictly exogenous with respect to \(u_{it}\), so that the within estimator is consistent, and assume the usual regularity conditions for both estimators’ asymptotic distributions. Under the RE null, the unit effect is conditionally mean independent of the full regressor history \(X_i=(x_{i1},\ldots,x_{iT})\), after accounting for the intercept: \(E(\alpha_i\mid X_i)=E(\alpha_i)\). The alternative allows this conditional mean independence to fail. The standard chi-square derivation additionally requires RE to be asymptotically efficient under the null and the covariance matrix of the estimator difference to be consistently estimated and nonsingular, or to have a stated lower rank.

This is a specification test, not a test of whether the FE estimate is causal or whether every assumption in the panel model is true. In particular, interpreting FE as consistent still depends on appropriate exogeneity of the idiosyncratic errors. The Hausman comparison focuses on the RE restriction concerning the relation between \(\alpha_i\) and the regressors.

Null, Alternative, and the Estimator Difference

Let \(\hat{\beta}_{FE}\) and \(\hat{\beta}_{RE}\) denote the FE and RE slope estimates, and define their difference as \(d=\hat{\beta}_{FE}-\hat{\beta}_{RE}\). Under the null, both estimate the same \(\beta\). Under the alternative, if \(E(\alpha_i\mid X_i)\) varies with \(X_i\), RE generally does not estimate the same slope target as FE. Provided the strict-exogeneity conditions for FE continue to hold, FE remains consistent for the within slope.

In practice, the null and alternative are often stated in terms of the validity of RE: \(H_0\) says that the RE estimator is consistent (and efficient under the maintained covariance model); \(H_a\) says that RE is inconsistent because the unit effect is correlated with the regressors. The test uses all \(k\) slope differences jointly. Its degrees of freedom are therefore ordinarily \(k\), not the number of units or the number of panel periods.

Definition: Let \(V_{FE}\) and \(V_{RE}\) be the asymptotic covariance matrices of \(\hat{\beta}_{FE}\) and \(\hat{\beta}_{RE}\) under \(H_0\). When the RE estimator is efficient under the null and the covariance difference is positive definite, the Hausman statistic is $$ H=d'\left(V_{FE}-V_{RE}\right)^{-1}d. $$ Under \(H_0\), it has an asymptotic chi-square distribution with \(k\) degrees of freedom. If the covariance difference has rank \(r<k\), the corresponding regular formulation uses the estimable \(r\)-dimensional difference and \(r\) degrees of freedom.

Deriving the Covariance of the Difference

For any two random vectors, the variance of their difference includes their cross-covariance. In particular, $$ \operatorname{Var}(\hat{\beta}_{FE}-\hat{\beta}_{RE}) =V_{FE}+V_{RE} -\operatorname{Cov}(\hat{\beta}_{FE},\hat{\beta}_{RE}) -\operatorname{Cov}(\hat{\beta}_{RE},\hat{\beta}_{FE}). $$ This expression is the general starting point. Under the null, the usual Hausman result simplifies it using the efficiency of RE. In the standard nested linear-estimation setting, the covariance between the efficient RE estimate and the less efficient FE estimate equals the covariance of the RE estimate: $$ \operatorname{Cov}(\hat{\beta}_{FE},\hat{\beta}_{RE})=V_{RE}, \qquad \operatorname{Cov}(\hat{\beta}_{RE},\hat{\beta}_{FE})=V_{RE}. $$ The second equality follows by transposing the first because covariance matrices are symmetric. Substitution gives $$ \operatorname{Var}(d)=V_{FE}+V_{RE}-V_{RE}-V_{RE}=V_{FE}-V_{RE}. $$

The covariance identity is not a claim that the two estimates are independent. It is precisely their dependence, together with RE’s efficiency under the null, that leads to the difference of covariance matrices. If RE were not efficient under the null, or the estimators did not satisfy the conditions that give this cross-covariance identity, the simplification would not follow. The general covariance formula would then need to be used with valid estimates of the cross-covariances.

1
Center the difference under the null.
Both estimators converge to the same \(\beta\), so \(d\) has asymptotic mean zero under \(H_0\).
2
Obtain its covariance.
RE efficiency gives the cross-covariance identity, so \(\operatorname{Var}(d)=V_{FE}-V_{RE}\).
3
Standardize the difference.
A zero-mean asymptotically normal vector, scaled by its covariance matrix, has a quadratic form with a chi-square reference distribution.

To see the final step, write \(D=V_{FE}-V_{RE}\), assumed positive definite. Under \(H_0\), the asymptotic distribution of \(D^{-1/2}d\) is multivariate normal with mean zero and identity covariance matrix. The sum of squares of its \(k\) components therefore has a chi-square distribution with \(k\) degrees of freedom: $$ d'D^{-1}d=(D^{-1/2}d)'(D^{-1/2}d)\ \overset{a}{\sim}\ \chi^2_k. $$ In applications, \(D\) is replaced by a consistent estimate of the covariance difference. The resulting statistic is compared with the appropriate chi-square reference distribution. A large value indicates that the FE and RE estimates differ more than would typically be expected under the null’s covariance conditions.

Worked Examples: Understanding the Covariance Difference

Worked Example: A One-Slope Covariance Derivation

Suppose a hypothetical panel analysis has one slope. Under \(H_0\), suppose the estimated variance of the FE slope is \(0.09\), the estimated variance of the RE slope is \(0.04\), and their covariance is \(0.04\). The observed FE-minus-RE difference is \(0.30\). Work out the variance of the difference and its standardized squared value.

Step 1: Use the general variance formula. For scalar estimates, it becomes $$ \operatorname{Var}(\hat{\beta}_{FE}-\hat{\beta}_{RE}) =\operatorname{Var}(\hat{\beta}_{FE})+\operatorname{Var}(\hat{\beta}_{RE}) -2\operatorname{Cov}(\hat{\beta}_{FE},\hat{\beta}_{RE}). $$ Substituting the hypothetical values gives \(0.09+0.04-2(0.04)=0.05\).

Step 2: Compare with the efficiency simplification. Since the covariance is \(0.04\), equal to the RE variance, the result also equals \(V_{FE}-V_{RE}=0.09-0.04=0.05\).

Step 3: Form the quadratic statistic. The difference is \(0.30\), so its squared standardized value is \(0.30^2/0.05=0.09/0.05=1.80\). This calculation illustrates the scalar form of the Hausman statistic; it does not by itself establish that the assumptions hold for any particular data set.

Worked Example: A Two-Slope Quadratic Form

Consider hypothetical estimates whose difference is \(d=(0.20,-0.10)'\). Suppose the covariance difference under the null is $$ D=V_{FE}-V_{RE} =\begin{pmatrix}0.04&0\\0&0.01\end{pmatrix}. $$ Calculate the statistic, assuming this covariance matrix is valid and positive definite.

The inverse is \(D^{-1}=\begin{pmatrix}25&0\\0&100\end{pmatrix}\), because \(1/0.04=25\) and \(1/0.01=100\). Therefore, $$ H=d'D^{-1}d =(0.20,-0.10) \begin{pmatrix}25&0\\0&100\end{pmatrix} \begin{pmatrix}0.20\\-0.10\end{pmatrix} =25(0.20)^2+100(-0.10)^2=1+1=2.00. $$

The calculation weights each coefficient difference by its covariance-adjusted precision. Under the stated null conditions, the reference distribution has two degrees of freedom because both slope differences are included. This example demonstrates the matrix calculation rather than making a conclusion about a real panel or a particular significance threshold.

Worked Example: Degrees of Freedom with a Rank-Deficient Difference

Suppose a hypothetical two-slope comparison has \(d=(0.20,0)'\) and a covariance difference \(D=\begin{pmatrix}0.04&0\\0&0\end{pmatrix}\). This matrix is not invertible, so the full two-dimensional inverse in the usual formula does not exist. Its rank is one: only the first direction has positive variance in the estimator difference.

The estimable component is the first coordinate. Its squared standardized value is \(0.20^2/0.04=1.00\), and the rank-based quadratic form uses one degree of freedom. The second coordinate contributes no independent direction to this covariance difference.

The zero second component of \(d\) is compatible with the range of \(D\), which consists of vectors with second coordinate zero. If instead \(d=(0.20,0.05)'\), the difference would have a component outside that range. The stated rank-based calculation would not be justified without addressing why the covariance model assigns zero variance to that direction. A singular matrix is not a reason simply to invert by an ordinary inverse or to claim two degrees of freedom.

Conditions Behind the Reference Distribution

The chi-square approximation depends on more than calculating a difference. For the conventional result, the following conditions need to be in place:

  • Same target and specification: FE and RE estimate the same slope coefficients, in the same parameterization, on the same observations.
  • Common null value: under \(H_0\), the RE restriction is valid, so both estimators converge to the same \(\beta\).
  • FE consistency under the alternative: the idiosyncratic error conditions required for the within estimator continue to hold, even if \(\alpha_i\) is correlated with \(X_i\).
  • RE efficiency under the null: the variance-components assumptions make RE asymptotically efficient for the common slope under \(H_0\), yielding the covariance identity used in the derivation.
  • Valid covariance difference: \(V_{FE}-V_{RE}\) must be positive definite for the ordinary inverse and \(k\)-degree-of-freedom statistic, or have a well-defined lower-rank formulation.

The asymptotic chi-square distribution is a reference distribution under these conditions, not a guarantee that every finite-sample statistic follows it exactly. The statistic also does not reveal which specific regressor is responsible for a rejection: it is a joint test of the slope differences. Follow-up interpretation requires substantive knowledge and, where appropriate, other analyses.

Common Mistake: Treating the Estimates as Independent

A frequent error is to set \(\operatorname{Var}(d)=V_{FE}+V_{RE}\), reasoning that the variance of a difference is the sum of the two variances. That formula is valid only if the estimates are uncorrelated. FE and RE are computed from the same panel observations, so they are generally dependent. Under the standard Hausman null conditions, their cross-covariance is \(V_{RE}\), which changes the result to \(V_{FE}-V_{RE}\). Another error is to use that subtraction without checking the efficiency and covariance assumptions that justify it. The covariance identity is a condition of the derivation, not an automatic property of any two estimators.

Key takeaway: The Hausman test compares FE and RE slopes because they estimate the same target under the RE null but differ when the RE restriction fails. RE efficiency under the null gives \(\operatorname{Var}(\hat{\beta}_{FE}-\hat{\beta}_{RE})=V_{FE}-V_{RE}\); standardizing this difference yields the chi-square statistic, with degrees of freedom determined by the rank of the valid covariance difference.

Check Your Understanding

Answer each question by referring to the null conditions and covariance derivation.

  1. State the Hausman null and alternative in terms of the consistency of the RE estimator.
  2. Why is the covariance of the FE and RE estimates needed when finding the variance of their difference?
  3. Under the standard null conditions, what covariance identity simplifies the general variance formula?
  4. If both FE and RE estimate three slopes and the covariance difference is positive definite, how many degrees of freedom does the conventional statistic use?
  5. What does a singular covariance difference imply about using the ordinary inverse in the Hausman formula?
Clinical Biostats