Home  /  Products  /  StataNow  /  Mundlak specification test

<- See more new Stata features

Highlights

  • Mundlak specification test for fixed versus random effects

  • Mundlak specification test for correlated random effects versus random effects

  • Test is valid with cluster–robust, bootstrap, or jackknife standard errors

  • See more panel-data features

Use the new estat mundlak postestimation command after xtreg to choose between random-effects (RE), fixed-effects (FE), or correlated random-effects (CRE) models even with cluster–robust, bootstrap, or jackknife standard errors. This feature is part of StataNow™.

Let's see it work

We often use a Hausman specification test to decide between a more efficient RE model or an FE model. But this test cannot be performed after estimation using cluster–robust, bootstrap, or jackknife standard errors. In that case, we can use a fully robust Mundlak specification test. Unlike a Hausman test, we do not need to fit both the RE and FE models to perform a Mundlak test.

We are interested in how the number of registrations of a dog breed with the American Kennel Club (AKC), registered, is affected by dogs being the protagonists in a movie, movie. We surmise that the number of registrations increases if the dog breed appears as the protagonist in a movie. We also think that registrations increase if the dog has won the Best in Show award, best, from the Westminster Kennel Club in the 10 years before 2034 and that we need to control for year effects.

We would like to determine whether the more efficient RE model is applicable to our data instead of a model that accounts for time-invariant unobserved heterogeneity such as an FE model. We believe we should use cluster–robust standard errors during estimation to control for heteroskedasticity and within-breed correlation. As such, we cannot use our traditional Hausman specification test, but we can use the new estat mundlak command to perform a Mundlak specification test.

We first fit an RE model:

. webuse akc
(Fictional dog breed and AKC registration data)

. xtset breed year

Panel variable: breed (strongly balanced)
 Time variable: year, 2031 to 2040
         Delta: 1 unit

. xtreg registered i.movie i.year, vce(cluster breed)

Random-effects GLS regression                   Number of obs     =      1,410
Group variable: breed                           Number of groups  =        141

R-squared:                                      Obs per group:
     Within  = 0.4503                                         min =         10
     Between = 0.8271                                         avg =       10.0
     Overall = 0.5491                                         max =         10

                                                Wald chi2(10)     =    1029.05
corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000

                                (Std. err. adjusted for 141 clusters in breed)
Robust
registered Coefficient std. err. z P>|z| [95% conf. interval]
1.movie 2044.629 84.89458 24.08 0.000 1878.238 2211.019
year
2032 -21.57447 48.27095 -0.45 0.655 -116.1838 73.03485
2033 48.84397 52.5138 0.93 0.352 -54.08118 151.7691
2034 -93.29443 55.78234 -1.67 0.094 -202.6258 16.03694
2035 15.84741 51.68324 0.31 0.759 -85.44988 117.1447
2036 -22.61986 52.46455 -0.43 0.666 -125.4485 80.20877
2037 30.05085 58.58148 0.51 0.608 -84.76674 144.8684
2038 9.667868 52.75853 0.18 0.855 -93.73696 113.0727
2039 103.4693 59.89955 1.73 0.084 -13.93167 220.8702
2040 128.143 61.8632 2.07 0.038 6.893406 249.3927
_cons 1001.901 35.62685 28.12 0.000 932.0734 1071.728
sigma_u 24.169801
sigma_e 494.41332
rho .00238413 (fraction of variance due to u_i)

To perform a Mundlak specification test, we type

. estat mundlak

Mundlak specification test
H0: Covariates are uncorrelated with unobserved panel-level effects

    chi2(1) =   5.73
Prob > chi2 = 0.0167

Notes: Fixed effects and correlated random effects are
       consistent under H0 and Ha.
       Random effects are efficient under H0.

We reject the null hypothesis that regressors are uncorrelated with the breed-specific effects, which is assumed by an RE model. This suggests that fitting an FE model (xtreg, fe) or a CRE model (xtreg, cre) that accounts for time-invariant unobserved heterogeneity is more sensible.

In the example above, we used a cluster–robust variance–covariance matrix estimator, but we could have used bootstrap or jackknife. And we could have fit an FE or CRE model first and then used estat mundlak.

Tell me more

Learn more about Stata's panel-data features.

Read more about Mundlak specification test in [XT] xtreg postestimation.

Also see Correlated random-effects (CRE) model.

View all the new features in Stata 18 and, in particular, New in linear models.

Made for data science.

Get started today.