Home  /  Products  /  StataNow  /  Correlated random-effects (CRE) model

<- See more new Stata features

Highlights

  • Correlated random-effects panel-data models with xtreg, cre

  • Coefficients for time-invariant regressors while controlling for endogeneity

  • See more panel-data features

Easily fit correlated random-effects (CRE) models to panel data with the new cre option of the xtreg command. Similarly to a fixed-effects (FE) model, estimate coefficients for time-invariant regressors while controlling for endogeneity. Perform a fully robust Mundlak specification test to help you choose between the random-effects (RE), FE, or CRE models. This feature is part of StataNow™.

Let's see it work

We study the effect on wages of time-changing variables, such as age or tenure. At the same time, we are interested in the effects of time-invariant variables, such as race. An FE model will omit any variable that remains constant across time and thus cannot fully answer our research question. An RE model may yield inconsistent estimates because of the possible correlation between individual time-invariant heterogeneity and the regressors age and tenure.

We can use a CRE model to circumvent both problems. Let's see it in action.

. webuse nlswork
(National Longitudinal Survey of Young Women, 14-24 years old in 1968)

. xtreg ln_wage tenure age i.race, cre vce(cluster idcode)
note: 2.race omitted from xt_means because of collinearity.
note: 3.race omitted from xt_means because of collinearity.

Correlated random-effects regression             Number of obs     =     28,101
Group variable: idcode                           Number of groups  =      4,699

R-squared:                                       Obs per group:
     Within  = 0.1296                                          min =          1
     Between = 0.2346                                          avg =        6.0
     Overall = 0.1890                                          max =         15

                                                 Wald chi2(4)      =    1685.18
corr(xit_vars*b, xt_means*γ) = 0.5474            Prob > chi2       =     0.0000

                              (Std. err. adjusted for 4,699 clusters in idcode)
Robust
ln_wage Coefficient std. err. z P>|z| [95% conf. interval]
xit_vars
tenure .0211313 .0012113 17.44 0.000 .0187572 .0235055
age .0121949 .0007414 16.45 0.000 .0107417 .013648
race
Black -.1312068 .0117856 -11.13 0.000 -.1543061 -.1081075
Other .1059379 .0593177 1.79 0.074 -.0103225 .2221984
_cons 1.2159 .0306965 39.61 0.000 1.155736 1.276064
xt_means
tenure .0376991 .002281 16.53 0.000 .0332283 .0421698
age -.0011984 .0013313 -0.90 0.368 -.0038077 .0014109
race
Black 0 (omitted)
Other 0 (omitted)
sigma_u .33334407
sigma_e .29808194
rho .55567161 (fraction of variance due to u_i)
Mundlak test (xt_means = 0): chi2(2) = 331.5144  Prob > chi2 = 0.0000

xtreg, cre reports coefficients for the variables in the model (xit_vars) and for their respective panel means (xt_means). In CRE models, panel means are added to the regression to control for potential endogeneity and correct bias. This procedure gives us the same coefficients we obtain from the corresponding FE model for the time-variant regressors:

. xtreg ln_wage tenure age, fe vce(cluster idcode)

Fixed-effects (within) regression               Number of obs     =     28,101
Group variable: idcode                          Number of groups  =      4,699

R-squared:                                      Obs per group:
     Within  = 0.1296                                         min =          1
     Between = 0.1916                                         avg =        6.0
     Overall = 0.1456                                         max =         15

                                                F(2, 4698)        =     766.79
corr(u_i, Xb) = 0.1302                          Prob > F          =     0.0000

                             (Std. err. adjusted for 4,699 clusters in idcode)
Robust Equal-tailed
ln_wage Coefficient std. err. t P>|t| [95% conf. interval]
tenure .0211313 .0012112 17.45 0.000 .0187568 .0235059
age .0121949 .0007414 16.45 0.000 .0107414 .0136483
_cons 1.256467 .0194187 64.70 0.000 1.218397 1.294537
sigma_u .39034493
sigma_e .29808194
rho .63165531 (fraction of variance due to u_i)

We get the benefits of an FE model but do not lose information about time-invariant features of our model.

xtreg, cre performs a Mundlak specification test to help you choose between an RE, FE, or CRE model. Unlike a Hausman test, this test is fully robust and remains valid even when a robust vce, such as vce(cluster idcode), is specified. In our example above, the test provides strong evidence in favor of the fitted CRE model.

Tell me more

Learn more about Stata's panel-data features.

Read more about CRE models in [XT] xtreg.

Also see Mundlak specification test.

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

Made for data science.

Get started today.