Announcement

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

  • How to repeat sampling randomly and run GLS regressions with fixed effects?


    Dear all,

    My regression results report less than 200 observations. Thus, I hope to repeat sampling randomly for the GLS regressions with fixed effects.
    I have tried bsample and bootstrap but cannot work.

    My GLS codes are xtgls y x1 x2 i.year i.firm

    Does any one know how to solve this problem?

    Thanks in advance!

    Best,
    Elaine

  • #2
    Elaine:
    if you use default standard errors, thinghs are pretty manageable, as in the following toy-example:
    Code:
    . use "https://www.stata-press.com/data/r18/nlswork.dta"
    (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
    
    . xtreg ln_wage c.age##c.age i.c_city, re
    
    Random-effects GLS regression                   Number of obs     =     28,502
    Group variable: idcode                          Number of groups  =      4,710
    
    R-squared:                                      Obs per group:
         Within  = 0.1087                                         min =          1
         Between = 0.1077                                         avg =        6.1
         Overall = 0.0910                                         max =         15
    
                                                    Wald chi2(3)      =    3417.32
    corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .0594298   .0027187    21.86   0.000     .0541013    .0647583
                 |
     c.age#c.age |  -.0006789   .0000451   -15.07   0.000    -.0007672   -.0005906
                 |
        1.c_city |   .0330141   .0064045     5.15   0.000     .0204615    .0455666
           _cons |   .5271331    .039939    13.20   0.000      .448854    .6054121
    -------------+----------------------------------------------------------------
         sigma_u |  .36328408
         sigma_e |  .30245358
             rho |  .59061651   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . 
     bootstrap, reps(200): xtreg ln_wage c.age##c.age i.c_city, re
    (running xtreg on estimation sample)
    
    Bootstrap replications (200): .........10.........20.........30.........40.........50.........60.........70.........80.........90.........100.........110.........120.........1
    > 30.........140.........150.........160.........170.........180.........190.........200 done
    
    Random-effects GLS regression                   Number of obs     =     28,502
    Group variable: idcode                          Number of groups  =      4,710
    
    R-squared:                                      Obs per group:
         Within  = 0.1087                                         min =          1
         Between = 0.1077                                         avg =        6.1
         Overall = 0.0910                                         max =         15
    
                                                    Wald chi2(3)      =    2940.14
    corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
    
                                      (Replications based on clustering on idcode)
    ------------------------------------------------------------------------------
                 |   Observed   Bootstrap                         Normal-based
         ln_wage | coefficient  std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .0594298    .003096    19.20   0.000     .0533617    .0654979
                 |
     c.age#c.age |  -.0006789   .0000513   -13.23   0.000    -.0007795   -.0005783
                 |
        1.c_city |   .0330141   .0066888     4.94   0.000     .0199043    .0461239
           _cons |   .5271331   .0452976    11.64   0.000     .4383513    .6159148
    -------------+----------------------------------------------------------------
         sigma_u |  .36328408
         sigma_e |  .30245358
             rho |  .59061651   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Elaine:
      if you use default standard errors, thinghs are pretty manageable, as in the following toy-example:
      Code:
      . use "https://www.stata-press.com/data/r18/nlswork.dta"
      (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
      
      . xtreg ln_wage c.age##c.age i.c_city, re
      
      Random-effects GLS regression Number of obs = 28,502
      Group variable: idcode Number of groups = 4,710
      
      R-squared: Obs per group:
      Within = 0.1087 min = 1
      Between = 0.1077 avg = 6.1
      Overall = 0.0910 max = 15
      
      Wald chi2(3) = 3417.32
      corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
      
      ------------------------------------------------------------------------------
      ln_wage | Coefficient Std. err. z P>|z| [95% conf. interval]
      -------------+----------------------------------------------------------------
      age | .0594298 .0027187 21.86 0.000 .0541013 .0647583
      |
      c.age#c.age | -.0006789 .0000451 -15.07 0.000 -.0007672 -.0005906
      |
      1.c_city | .0330141 .0064045 5.15 0.000 .0204615 .0455666
      _cons | .5271331 .039939 13.20 0.000 .448854 .6054121
      -------------+----------------------------------------------------------------
      sigma_u | .36328408
      sigma_e | .30245358
      rho | .59061651 (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      .
      bootstrap, reps(200): xtreg ln_wage c.age##c.age i.c_city, re
      (running xtreg on estimation sample)
      
      Bootstrap replications (200): .........10.........20.........30.........40.........50.........60.........70.........80.........90.........100.........110.........120.........1
      > 30.........140.........150.........160.........170.........180.........190.........200 done
      
      Random-effects GLS regression Number of obs = 28,502
      Group variable: idcode Number of groups = 4,710
      
      R-squared: Obs per group:
      Within = 0.1087 min = 1
      Between = 0.1077 avg = 6.1
      Overall = 0.0910 max = 15
      
      Wald chi2(3) = 2940.14
      corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
      
      (Replications based on clustering on idcode)
      ------------------------------------------------------------------------------
      | Observed Bootstrap Normal-based
      ln_wage | coefficient std. err. z P>|z| [95% conf. interval]
      -------------+----------------------------------------------------------------
      age | .0594298 .003096 19.20 0.000 .0533617 .0654979
      |
      c.age#c.age | -.0006789 .0000513 -13.23 0.000 -.0007795 -.0005783
      |
      1.c_city | .0330141 .0066888 4.94 0.000 .0199043 .0461239
      _cons | .5271331 .0452976 11.64 0.000 .4383513 .6159148
      -------------+----------------------------------------------------------------
      sigma_u | .36328408
      sigma_e | .30245358
      rho | .59061651 (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      .
      Hi Carlo,

      Thank you for sharing the codes and the example!

      I have tried your codes (but reps 300 and 500) and been informed that ''insufficient observations to compute bootstrap standard errors no results will be saved''.

      My GLS regressions showed that only 180 observations of my unbalanced panel dataset were involved in the regressions.

      Are there any methods to deal with the problem?

      Thank you!

      Best regards,
      Elaine

      Comment


      • #4
        Elaine:
        according to one of the bootstrap holy writings (An Introduction to the Bootstrap | Bradley Efron, R.J. Tibshirani | Ta (taylorfrancis.com)) 25 up to 200 (the upper limit is what would seem acceptable to nasty reviewers) bootstrap replications for standard errors are usually enough.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Elaine:
          according to one of the bootstrap holy writings (An Introduction to the Bootstrap | Bradley Efron, R.J. Tibshirani | Ta (taylorfrancis.com)) 25 up to 200 (the upper limit is what would seem acceptable to nasty reviewers) bootstrap replications for standard errors are usually enough.
          Thank you for your reply and guidance, Carlo!

          I have used bsample to do the additional regression analyses. But I will try bootstrap again according to your suggestion.

          Thanks again!

          Best,
          Elaine

          Comment

          Working...
          X