Home  /  Products  /  Stata 19  /  Correlated random-effects (CRE) model

← See Stata 19's new 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

Want coefficient estimates of time-invariant covariates in your panel-data model? Fit a random-effects model. Want to allow for correlation between covariates and unobserved panel-level effects? Fit a fixed-effects model. Want both? With xtreg, cre, you can now fit a correlated random-effects model.

Let's see it work

We study the effect on wages of time-varying 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 to correct bias. This procedure gives us the same coefficients we obtain from the corresponding FE model for the time-varying 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 and 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. From the earlier output of xtreg, cre, the Mundlak test, reported beneath the coefficient table, provides strong evidence in favor of the CRE model.

Tell me more

Read more about CRE models in [XT] xtreg in the Stata Longitudinal-Data/Panel-Data Reference Manual.

Learn more about Stata's panel-data features.

Also see Mundlak specification test.

View all the new features in Stata 19, and, in particular, new in panel data and new in linear models.

Ready to get started?

Experience powerful statistical tools, reproducible workflows, and a seamless user experience—all in one trusted platform.