Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fixed effects vs Correlated Random Effects coefficients

    I am running a fixed effects regression and a correlated random effects regression (following Mundlak, 1978). The theory says that the time-varying coefficients of both regressions should be the same across the two specifications (in my case, difftax dummysigned and specvd), but I get slightly different coefficients. Do you know why this can be the case? Thank you in advance. See my output attached.

    Attached Files

  • #2
    Clara:
    you're dealing with a bit unbalanced panel dataset and this nuisance explains the slight differences you experienced in the time-vaying coefficients that are common to both your specifications.
    That said, given the coefficients of the panel-specific means for the time-invariant coefficients reported in the hybrid model outcome table (that you should -test-, though) , I'm under the impression that -fe- is not the way to go and -re- should be preferred.
    Last edited by Carlo Lazzaro; 07 Dec 2022, 12:23.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Many thanks, Carlo. This was helpful.

      Comment


      • #4
        Dear Clara,

        When comparing correlated random effects and fixed effects coefficients, it is important to construct the panel-level means using the same estimation sample that -xtreg, fe- uses. I would suggest you do that and report back. Below is an example with an unbalanced and with one of the covariates having missing values in the estimation sample. You get exactly the same slope coefficient estimates for both fitted models.

        Here is the code

        Code:
        webuse nlswork, clear 
        // Panel is unbalanced
        xtset idcode year
        // Fit fixed effects model with some observations missing in wks_ue
        xtreg ln_wage c.wks_ue##i.south, fe 
        // Store my estimates to display using -etable- later
        estimates store fe
        // Getting the estimation sample for panel means
        generate sample = e(sample)
        // Getting a variable list to do Mundlak
        fvexpand c.wks_ue##i.south if sample 
        local varlist "`r(varlist)'"
        //Generating Mundlak regressors
        local k: list sizeof varlist
        forvalues i=1/`k' {
            local x: word `i' of `varlist'
            quietly bysort idcode: egen double mx`i' = mean(`x') if sample
        }
        // Fitting correlated-random-effects model
        xtreg ln_wage `varlist' mx*
        estimates store mundlak
        etable, estimates(fe mundlak) cstat(_r_b, nformat(%9.6f))
        here is the output

        Code:
        . webuse nlswork, clear 
        (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
        
        . // Panel is unbalanced
        . xtset idcode year
        
        Panel variable: idcode (unbalanced)
         Time variable: year, 68 to 88, but with gaps
                 Delta: 1 unit
        
        . // Fit fixed effects model with some observations missing in wks_ue
        . xtreg ln_wage c.wks_ue##i.south, fe 
        
        Fixed-effects (within) regression               Number of obs     =     22,823
        Group variable: idcode                          Number of groups  =      4,645
        
        R-squared:                                      Obs per group:
             Within  = 0.0029                                         min =          1
             Between = 0.0593                                         avg =        4.9
             Overall = 0.0504                                         max =         14
        
                                                        F(3,18175)        =      17.48
        corr(u_i, Xb) = 0.1963                          Prob > F          =     0.0000
        
        --------------------------------------------------------------------------------
               ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        ---------------+----------------------------------------------------------------
                wks_ue |  -.0024934   .0004682    -5.33   0.000    -.0034111   -.0015756
               1.south |  -.0665757   .0139186    -4.78   0.000    -.0938575   -.0392939
                       |
        south#c.wks_ue |
                    1  |   .0014072   .0007115     1.98   0.048     .0000126    .0028017
                       |
                 _cons |    1.66299   .0061003   272.61   0.000     1.651032    1.674947
        ---------------+----------------------------------------------------------------
               sigma_u |  .42311267
               sigma_e |  .32369196
                   rho |  .63080977   (fraction of variance due to u_i)
        --------------------------------------------------------------------------------
        F test that all u_i=0: F(4644, 18175) = 5.88                 Prob > F = 0.0000
        
        . // Store my estimates to display using -etable- later
        . estimates store fe
        
        . // Getting the estimation sample for panel means
        . generate sample = e(sample)
        
        . // Getting a variable list to do Mundlak
        . fvexpand c.wks_ue##i.south if sample 
        
        . local varlist "`r(varlist)'"
        
        . //Generating Mundlak regressors
        . local k: list sizeof varlist
        
        . forvalues i=1/`k' {
          2.         local x: word `i' of `varlist'
          3.         quietly bysort idcode: egen double mx`i' = mean(`x') if sample
          4. }
        
        . // Fitting correlated-random-effects model
        . xtreg ln_wage `varlist' mx*
        note: mx2 omitted because of collinearity.
        note: mx4 omitted because of collinearity.
        
        Random-effects GLS regression                   Number of obs     =     22,823
        Group variable: idcode                          Number of groups  =      4,645
        
        R-squared:                                      Obs per group:
             Within  = 0.0029                                         min =          1
             Between = 0.0719                                         avg =        4.9
             Overall = 0.0702                                         max =         14
        
                                                        Wald chi2(6)      =     437.99
        corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
        
        --------------------------------------------------------------------------------
               ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
        ---------------+----------------------------------------------------------------
                wks_ue |  -.0024934   .0004656    -5.35   0.000     -.003406   -.0015808
               1.south |  -.0665757    .013841    -4.81   0.000    -.0937037   -.0394478
                       |
        south#c.wks_ue |
                    1  |   .0014072   .0007075     1.99   0.047     .0000205    .0027938
                       |
                   mx1 |  -.0122406   .0016735    -7.31   0.000    -.0155206   -.0089607
                   mx2 |          0  (omitted)
                   mx3 |  -.1121623   .0199403    -5.62   0.000    -.1512446   -.0730799
                   mx4 |          0  (omitted)
                   mx5 |  -.0037978   .0025897    -1.47   0.143    -.0088735    .0012779
                 _cons |   1.746899    .008868   196.99   0.000     1.729518     1.76428
        ---------------+----------------------------------------------------------------
               sigma_u |  .36636858
               sigma_e |  .32369196
                   rho |   .5616091   (fraction of variance due to u_i)
        --------------------------------------------------------------------------------
        
        . estimates store mundlak
        
        . etable, estimates(fe mundlak) cstat(_r_b, nformat(%9.6f))
        
        -----------------------------------------------------------
                                                 ln_wage   ln_wage 
        -----------------------------------------------------------
        Weeks unemployed last year              -0.002493 -0.002493
        1 if south                                                 
          1                                     -0.066576 -0.066576
        1 if south # Weeks unemployed last year                    
          1                                      0.001407  0.001407
        mx1                                               -0.012241
        mx3                                               -0.112162
        mx5                                               -0.003798
        Intercept                                1.662990  1.746899
        Number of observations                      22823     22823
        -----------------------------------------------------------

        Comment


        • #5
          The reason for slightly different results in unbalanced panels is what Enrique explained: If one wants to get identical results, the panel averages have to be calculated over the same sample the regression is run. Eric de Souza taught me this no so long ago on this thread here
          https://www.statalist.org/forums/for...an-test-result

          You might find useful this thread too
          https://www.statalist.org/forums/for...dlak-procedure

          Comment


          • #6
            Speaking further about fixed and correlated random effects models, the paper by Schunk & Perales (SJ 17) "Within- and between-cluster effects in generalized linear mixed models: A discussion of approaches and the xthybrid command" gives a more than useful discussion of the whole scenario (IMHO)

            john moran

            Comment

            Working...
            X