Announcement

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

  • Panel data issues: xtreg or xtregar?

    Hello everyone, I am doing research on the returns to education in Ecuador between 2010 and 2021 using parent education as an instrument. The problem is that I have a data panel with gaps, since there are individuals who do not answer some valuable questions for my study, such as income received or years of education. I did the entire research using xtreg, fe supported by the hausman test (to select fe over re) and the breusch pagan lagrange test (to disallow the use of pooled ols). The thing is that heteroskedasticity exists, tested by xttest3, so my 2 issues are:
    1) it is possible that there is autocorrelation, since income and experience depend on the values ​​of t-1 years. So how do I test that in stata for my panel data?
    2) in that case, would it be useful to use xtregar instead of xtreg, fe cluster(id) robust? I understand that the AR component just adds autoregressive dynamics for the error term, so could that help? or I'm wrong?
    Thank you all in advance, this forum has been very useful to me. I attach some lines of code:

    Code:
    . use "C:\Users\Sebastián\Desktop\2010_2021 bf.dta", clear
    
    
    . collapse ln_w1 educp educp2 exper exper2 mujer minoria m1t rural p03, by (año ciudad)
    
    
    
    . xtset ciudad año, yearly
    panel variable: ciudad (unbalanced)
    time variable: año, 2010 to 2021, but with gaps
    delta: 1 year
    
    
    . xtregar ln_w1 educp educp2 exper exper2 mujer minoria m1t rural p03, fe
    
    FE (within) regression with AR(1) disturbances Number of obs = 5,515
    Group variable: ciudad Number of groups = 894
    
    R-sq: Obs per group:
    within = 0.2532 min = 1
    between = 0.5020 avg = 6.2
    overall = 0.2854 max = 11
    
    F(9,4612) = 173.77
    corr(u_i, Xb) = 0.1476 Prob > F = 0.0000
    
    ------------------------------------------------------------------------------
    ln_w1 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    educp | .3250868 .0179952 18.07 0.000 .2898076 .360366
    educp2 | -.0104201 .0009198 -11.33 0.000 -.0122233 -.0086169
    exper | .0502268 .0049368 10.17 0.000 .0405482 .0599054
    exper2 | -.0011096 .0000907 -12.24 0.000 -.0012874 -.0009319
    mujer | .7314758 .1191906 6.14 0.000 .4978051 .9651465
    minoria | -.0402982 .0458744 -0.88 0.380 -.130234 .0496376
    m1t | .1645453 .0847799 1.94 0.052 -.001664 .3307545
    rural | .1033847 .0367966 2.81 0.005 .0312459 .1755236
    p03 | .0097972 .001513 6.48 0.000 .0068309 .0127634
    _cons | 2.650756 .0735363 36.05 0.000 2.50659 2.794922
    -------------+----------------------------------------------------------------
    rho_ar | .209674
    sigma_u | .33362442
    sigma_e | .44185069
    rho_fov | .36310511 (fraction of variance because of u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(893,4612) = 0.57 Prob > F = 1.0000
    
    
    . xtreg ln_w1 educp educp2 exper exper2 mujer minoria m1t rural p03, fe
    
    Fixed-effects (within) regression Number of obs = 6,447
    Group variable: ciudad Number of groups = 932
    
    R-sq: Obs per group:
    within = 0.1698 min = 1
    between = 0.5708 avg = 6.9
    overall = 0.3851 max = 12
    
    F(9,5506) = 125.15
    corr(u_i, Xb) = 0.2557 Prob > F = 0.0000
    
    ------------------------------------------------------------------------------
    ln_w1 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    educp | .063477 .0171917 3.69 0.000 .0297745 .0971796
    educp2 | .0015855 .0008532 1.86 0.063 -.0000872 .0032582
    exper | .0317171 .0041832 7.58 0.000 .0235163 .0399179
    exper2 | -.0008562 .0000769 -11.13 0.000 -.001007 -.0007053
    mujer | -.2454476 .1045871 -2.35 0.019 -.4504795 -.0404157
    minoria | -.1415517 .0392788 -3.60 0.000 -.2185536 -.0645499
    m1t | .1815925 .0730974 2.48 0.013 .0382928 .3248923
    rural | -.018495 .0306378 -0.60 0.546 -.0785572 .0415673
    p03 | -.0005702 .0013264 -0.43 0.667 -.0031705 .0020302
    _cons | 4.726372 .1066534 44.32 0.000 4.51729 4.935455
    -------------+----------------------------------------------------------------
    sigma_u | .30402167
    sigma_e | .40692158
    rho | .35823269 (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(931, 5506) = 2.33 Prob > F = 0.0000
    
    .
    end of do-file

  • #2
    There is no instrumentation in the regressions that you show.

    There is a whopping difference in the estimates of returns to education from -xtreg, fe- and -xtregar, fe-. This should not be happening.

    I would say just stick to -xtreg, fe robust-, this takes care of heteroskedasticity and arbitrary within panel autocorrelation.

    Comment


    • #3
      Originally posted by Joro Kolev View Post
      There is no instrumentation in the regressions that you show.

      There is a whopping difference in the estimates of returns to education from -xtreg, fe- and -xtregar, fe-. This should not be happening.

      I would say just stick to -xtreg, fe robust-, this takes care of heteroskedasticity and arbitrary within panel autocorrelation.
      I used the years of education of the parents as an instrument of the calculated schooling of the children, in this case, those who belong to the labor force. The chart shown was between xtregar and xtreg, both under fixed effects. I am attaching the xtreg results for fe and re.
      Code:
      . xtreg ln_w1 educp educp2 exper exper2 mujer minoria m1t rural p03, fe
      
      Fixed-effects (within) regression               Number of obs     =      6,447
      Group variable: ciudad                          Number of groups  =        932
      
      R-sq:                                           Obs per group:
           within  = 0.1698                                         min =          1
           between = 0.5708                                         avg =        6.9
           overall = 0.3851                                         max =         12
      
                                                      F(9,5506)         =     125.15
      corr(u_i, Xb)  = 0.2557                         Prob > F          =     0.0000
      
      ------------------------------------------------------------------------------
             ln_w1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             educp |    .063477   .0171917     3.69   0.000     .0297745    .0971796
            educp2 |   .0015855   .0008532     1.86   0.063    -.0000872    .0032582
             exper |   .0317171   .0041832     7.58   0.000     .0235163    .0399179
            exper2 |  -.0008562   .0000769   -11.13   0.000     -.001007   -.0007053
             mujer |  -.2454476   .1045871    -2.35   0.019    -.4504795   -.0404157
           minoria |  -.1415517   .0392788    -3.60   0.000    -.2185536   -.0645499
               m1t |   .1815925   .0730974     2.48   0.013     .0382928    .3248923
             rural |   -.018495   .0306378    -0.60   0.546    -.0785572    .0415673
               p03 |  -.0005702   .0013264    -0.43   0.667    -.0031705    .0020302
             _cons |   4.726372   .1066534    44.32   0.000      4.51729    4.935455
      -------------+----------------------------------------------------------------
           sigma_u |  .30402167
           sigma_e |  .40692158
               rho |  .35823269   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0: F(931, 5506) = 2.33                   Prob > F = 0.0000
      
      . xtreg ln_w1 educp educp2 exper exper2 mujer minoria m1t rural p03, re
      
      Random-effects GLS regression                   Number of obs     =      6,447
      Group variable: ciudad                          Number of groups  =        932
      
      R-sq:                                           Obs per group:
           within  = 0.1672                                         min =          1
           between = 0.5891                                         avg =        6.9
           overall = 0.3957                                         max =         12
      
                                                      Wald chi2(9)      =    2485.71
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
      
      ------------------------------------------------------------------------------
             ln_w1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             educp |   .0716231   .0153815     4.66   0.000     .0414758    .1017703
            educp2 |   .0014317   .0007613     1.88   0.060    -.0000604    .0029238
             exper |   .0253197    .003797     6.67   0.000     .0178779    .0327616
            exper2 |  -.0008573   .0000691   -12.40   0.000    -.0009928   -.0007218
             mujer |  -.3284188   .0952423    -3.45   0.001    -.5150902   -.1417473
           minoria |  -.2357198   .0266261    -8.85   0.000     -.287906   -.1835335
               m1t |   .1218127   .0688461     1.77   0.077    -.0131231    .2567485
             rural |  -.0161361   .0223751    -0.72   0.471    -.0599906    .0277183
               p03 |   .0001649   .0011713     0.14   0.888    -.0021308    .0024606
             _cons |   4.819936   .0959228    50.25   0.000      4.63193    5.007941
      -------------+----------------------------------------------------------------
           sigma_u |  .20636273
           sigma_e |  .40692158
               rho |  .20457041   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      .

      Comment

      Working...
      X