Hausman Test
A test that evaluates whether there is a systematic difference between two estimators.
Are home prices higher in areas closer to a subway station? If you compare home prices and transit access across many areas, home prices may appear higher where public transit is convenient. But areas with good transit access may also have more commercial and educational facilities, and may have long been popular places to live.
If you don't adequately account for these area characteristics, it is hard to estimate the relationship between transit access and home prices accurately. With panel data that observe the same areas over several years, you can use a fixed effects model or a random effects model.
But if the regression coefficients from the two models turn out differently, which result should you use? The standard way to compare the estimates from the two models in this situation is the Hausman test.
The Hausman test evaluates whether there is a systematic difference between the fixed effects and random effects estimators, helping you review whether the key assumption of the random effects model is appropriate. In this article we look at how the Hausman test works and its hypotheses, a real panel data analysis example, how to interpret the test statistic and p-value, how to choose a model, and points to watch.
What is the Hausman test?
The Hausman test is a statistical test that compares two estimators to check whether the assumptions of a particular estimation method are valid.
In panel data analysis, it is mainly used to compare fixed effects and random effects models. The fixed effects model allows for correlation between characteristics of each unit that don't change over time and the explanatory variables. The basic random effects model, by contrast, assumes there is no correlation between the unobserved unit effects and the explanatory variables.
If this assumption holds, both estimators can be consistent under appropriate conditions, and the random effects estimator can be more efficient. But if the assumption does not hold, the random effects estimator can be biased or inconsistent. The Hausman test checks whether the difference between the two estimators is statistically significant in this situation.
However, the test result does not confirm all of a particular model's assumptions. Nor is it a test that directly judges which of fixed effects or random effects correctly estimates a causal relationship.
How do fixed effects and random effects differ?
Once you understand how the two models differ, the purpose of the Hausman test is easy to understand too.
| Aspect | Fixed effects model (FE) | Random effects model (RE) |
|---|---|---|
| Unit-specific characteristics | Controlled with unit fixed effects | Modeled as random unit effects |
| Correlation between unit effects and explanatory variables | Allowed | Not allowed in the basic model |
| Main information used | Within-unit change | Within-unit and between-unit variation |
| Time-invariant variables | Separate coefficients cannot be estimated | Can be estimated under appropriate conditions |
| Key conditions | Strict exogeneity, etc. | Exogeneity and the assumption that unit effects are uncorrelated |
For example, suppose areas differ in residential preferences that formed long ago. These preferences may affect home prices and may also be related to investment in transit facilities. A fixed effects model can control for area preferences that don't change during the observation period.
In a random effects model, however, if these area characteristics are correlated with transit access, the basic assumption can be violated. So you need to check why the two models estimate different regression coefficients.
How are the hypotheses of the Hausman test set up?
The hypotheses of the traditional Hausman test used with panel data are as follows.
Null hypothesis (H₀)
There is no systematic difference between the random effects and fixed effects estimators. Under the relevant assumptions, the random effects estimator is consistent.
Alternative hypothesis (H₁)
There is a systematic difference between the two estimators. The assumptions supporting the consistency of the random effects estimator may not hold.
For example, if the significance level is set at 0.05, you can judge according to the test result as follows.
| Test result | Interpretation |
|---|---|
| p < 0.05 | Reject the null hypothesis. Evidence of a statistically significant difference between the two estimators |
| p ≥ 0.05 | Not enough evidence to reject the null hypothesis |
The important point is that a p-value greater than 0.05 does not prove that the random effects model is correct. If power is insufficient or the model is misspecified, you may fail to get a significant result even when a difference really exists.
So the Hausman test is a test you can consult when choosing a model, not a procedure that automatically determines the right answer.
Real-world example: the relationship between transit access and home prices
Suppose a researcher collected data on 80 neighborhoods within a city over 7 years, from 2019 to 2025.
If every neighborhood was observed every year, there are 560 neighborhood-year observations in total. The main research question is as follows.
"When public transit access improves in the same neighborhood, how do home prices change?"
Analysis variables
| Variable | Role | Description |
|---|---|---|
| Home price | Dependent variable | Average home price by neighborhood, in thousands of dollars |
| Transit access | Main explanatory variable | Public transit access index, 0–100 points |
| Employment rate | Control variable | Annual employment rate by neighborhood |
| New housing supply | Control variable | Annual number of newly supplied homes by neighborhood |
| Neighborhood ID | Unit identifier | 80 neighborhoods |
| Year | Time identifier | 2019–2025 |
We define a higher transit access index as meaning public transit is more convenient to use. To account for characteristics that don't change within each neighborhood and for changes common to all neighborhoods each year, the researcher estimated both a fixed effects model and a random effects model. Both models included the same time-varying explanatory variables and year dummy variables.
This lets you compare how the estimated relationship between transit access and home prices differs depending on the model.
What if the fixed effects and random effects results differ?
Suppose applying the two models to the data above gave the following results.
Comparison of regression coefficients by model
| Explanatory variable | Fixed effects (FE) | Random effects (RE) |
|---|---|---|
| Transit access (+1 point) | 7.0 | 12.4 |
| Employment rate (+1 percentage point) | 16.0 | 19.0 |
| New housing supply (+100 homes) | -2.4 | -3.6 |
The regression coefficients are in thousands of dollars of the dependent variable, home price.
The fixed effects regression coefficient for transit access was 7.0. This means that in periods when the transit access index rose by 1 point within the same neighborhood, home prices were on average 7.0 thousand dollars, that is, $7,000, higher. In the random effects model, by contrast, the regression coefficient was 12.4.
The random effects model uses not only change within neighborhoods but also differences between neighborhoods, so its estimate can differ. What matters here is not which value is larger, but whether unobserved neighborhood characteristics are correlated with the explanatory variables.
The Hausman test is used to evaluate whether this difference is statistically significant.
How is the Hausman test statistic calculated?
The traditional Hausman test compares the regression coefficient vectors and estimated covariance matrices of fixed effects and random effects.
The standard test statistic is as follows.
H = (β̂FE − β̂RE)⊤ · [ Var(β̂FE) − Var(β̂RE) ]−1 · (β̂FE − β̂RE)
Here each symbol means the following.
| Symbol | Meaning |
|---|---|
| β̂FE | Regression coefficient vector of the fixed effects model |
| β̂RE | Regression coefficient vector of the random effects model |
| Var | Covariance matrix of the coefficient estimators |
| H | Hausman test statistic |
This calculation uses a property of the covariance difference between the two estimators under appropriate assumptions. Under the null hypothesis and the necessary asymptotic conditions such as normality, the test statistic can be evaluated using the chi-square distribution. If there are three time-varying explanatory variables that can be compared and the test is on those coefficients, the degrees of freedom are generally 3.
However, if the difference of the covariance matrices is not positive definite or cannot be inverted, the traditional Hausman test may not work properly.
Also, when cluster-robust standard errors are used, simply applying the formula above may not be appropriate, so a separate robust test method should be considered.
How do you interpret actual Hausman test results?
Suppose the following results were obtained from the neighborhood home price data above.
Hausman test results
| Item | Result |
|---|---|
| Models compared | Fixed effects vs random effects |
| Test statistic χ² | 11.42 |
| Degrees of freedom (df) | 3 |
| p-value | .010 |
| Significance level | .05 |
These values were not calculated from the actual covariance matrices of the coefficient table above.
The test gave a p-value of 0.010. Since this is smaller than the significance level of 0.05, the null hypothesis can be rejected. So there is evidence of a statistically significant difference between the fixed effects and random effects estimators.
This suggests that the no-correlation assumption between unit effects and explanatory variables required by the basic random effects model may not be appropriate. In this situation, the fixed effects model can be considered first.
However, even in the fixed effects model there may be time-varying confounders or reverse causation, so the regression coefficients should not be interpreted directly as causal effects.
If the p-value is not significant, do you choose the random effects model?
It is sometimes presented as the standard explanation that if the Hausman test is not significant, you choose the random effects model.
In actual analysis, however, a more careful judgment is needed. For example, suppose the following result was obtained.
χ²(3) = 2.15, p = .542
In this case, no evidence of a statistically significant difference between the two estimators was found. But that does not mean the random effects model's assumption is necessarily correct. If the sample is small or the explanatory variables have too little within-unit variation, power may be low.
Also, if both the fixed effects and random effects models are misspecified, it is hard to judge the results appropriate even if the two estimators look similar. So when the test result is not significant, check the study design and the nature of the explanatory variables, and review whether the no-correlation assumption between unit effects and explanatory variables is valid.
If needed, you can also estimate a correlated random effects model and compare.
What conditions must be met when comparing in a Hausman test?
When running a Hausman test, it is important to have conditions under which the two models can be compared.
The same analysis sample
If the fixed effects and random effects models use different subjects and observations, the difference in estimates may arise from differences in the data. So compare the two models on the same sample wherever possible.
The same explanatory variables
The Hausman test should compare coefficients that can be estimated in both models. For example, even if the random effects model includes time-invariant neighborhood variables, the fixed effects model cannot estimate separate coefficients for them. So the coefficients of such variables are excluded from the usual fixed effects–random effects comparison.
Statistical properties of the estimators
The traditional Hausman test uses conditions on the consistency and efficiency of the two estimators under the null hypothesis. If these conditions don't hold, interpreting the test statistic and p-value may not be appropriate.
How standard errors and covariances are estimated
When heteroskedasticity or within-unit correlation is present and cluster-robust standard errors are used, consider a test method that reflects that structure. The mere fact that a test statistic can be calculated does not mean the test suits the data structure.
What are the robust Hausman test and the Mundlak approach?
The traditional Hausman test uses the difference of covariance matrices, so it can be tricky to apply when robust standard errors are used.
One alternative in such cases is the Mundlak approach. The Mundlak approach adds the unit-specific means of time-varying explanatory variables to the random effects model.
For example, if each neighborhood's transit access index was observed for 7 years, you can calculate each neighborhood's average transit access. You then include both each year's transit access index and that neighborhood's average transit access in the model.
This approach is the standard way of building a correlated random effects model, which reflects the correlation between unit effects and explanatory variables in the model.
Comparison example
| Variable | Role |
|---|---|
| Yearly transit access | Observed values containing within- and between-neighborhood variation |
| Average transit access by neighborhood | Information representing differences between neighborhoods |
| Neighborhood random effect | Unobserved differences between neighborhoods |
Testing whether the coefficients of the unit-mean terms are jointly 0 helps you review the no-correlation assumption of the basic random effects model. When set up properly, this approach is also more convenient to use together with cluster-robust variance estimation. However, applying the Mundlak approach does not solve every endogeneity problem.
Time-varying confounding, reverse causation, measurement error and the like can still remain.
Points to watch in the Hausman test
The Hausman test is often used with panel data, but several things need checking when interpreting the results.
Do not decide on a model by the p-value alone.
A significant result is statistical evidence about the difference between the two estimators. A non-significant result is not proof that the random effects model is correct either.
It does not test the causal validity of the fixed effects model.
Even the fixed effects model can be biased by reverse causation, time-varying confounding, measurement error and so on. So you should not interpret fixed effects estimates as causal effects just because the Hausman test is significant.
Covariance matrix problems can occur.
In the traditional Hausman test, if the difference of the covariance matrices does not have a proper form, a negative test statistic or a calculation error can occur. In such cases, check the estimation method and test procedure rather than interpreting the result as is.
Take the structure of the panel data into account.
There may be error correlation within the same unit or common shocks across different units. So you need standard errors and test methods that fit the data structure.
There must be enough within-unit change.
The fixed effects model mainly uses change that occurs within the same unit. If the explanatory variables barely change, the fixed effects estimates can become unstable and comparing the two models can also become difficult.
How do you report Hausman test results?
When reporting Hausman test results, it is good to present the two models compared, the analysis sample, the common explanatory variables, the test statistic, the degrees of freedom and the p-value.
You should also explain which model you used based on the test result and present an interpretation of the regression coefficients. Using the neighborhood home price example above, you could write it as follows.
Example results report
To analyze the relationship between neighborhood transit access and home prices, a fixed effects model and a random effects model were each estimated. The analysis covered 560 neighborhood-year observations from 80 neighborhoods from 2019 to 2025. Both models included transit access, the employment rate, new housing supply and year dummy variables. A traditional Hausman test conducted to check the difference in estimates between the models showed a statistically significant difference between the two estimators (χ²(3) = 11.42, p = .010). Because this suggests that the basic random effects model's assumption of no correlation between unit effects and explanatory variables may not be appropriate, the fixed effects model is presented as the main analysis result in this example. In the fixed effects model, the regression coefficient for transit access was 7.0, meaning that in periods when the transit access index rose by 1 point within the same neighborhood, the average home price was observed to be $7,000 (7.0 thousand dollars) higher.
In an actual analysis, present the regression coefficients and standard errors of both models and state clearly the covariance estimation method used for the Hausman test. Also, if the statistical assumptions of the Hausman test are not appropriate, you can report the results of an alternative analysis such as a correlated random effects model.
The Hausman test evaluates the difference between two estimators.
The Hausman test is a method that compares the regression coefficients of fixed effects and random effects models to check whether there is a systematic difference between the two estimators.
In panel data analysis, it lets you review whether the key assumption of the basic random effects model, that unit effects and explanatory variables are uncorrelated, is appropriate. If the test result is significant, there is evidence of a systematic difference between the two estimators, so the fixed effects model can be considered first.
On the other hand, even if the test result is not significant, you should not conclude that the random effects model's assumption necessarily holds. Also, the Hausman test is not a test that judges which of the two models gives the correct causal effect for every problem.
So consider the research purpose, the data structure, the exogeneity of the explanatory variables, how standard errors are calculated and so on, all together.
The core of the Hausman test is not mechanically choosing a model by the p-value, but using the difference between fixed effects and random effects estimates to review the key assumption of the random effects model.