Announcement

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

  • How to predict for residuals after running a RE Panel regression to check for heteroscedasticity manually.

    Hi,

    After running a RE regression model, I could not run a predict residuals command. I did the same for OLS regression, which shows a constant variance. Do the same results apply to RE also? How do we test for heteroskedasticity if my chosen model is RE regression?

    Please help with this
    Thank you
    Radhika C

  • #2
    Radhicka:
    you may want to consider a visual inspection, as there's no test for heteroskedasticity after -xtreg,re-, as far as I know:
    Code:
    use "https://www.stata-press.com/data/r17/nlswork.dta"
    . xtreg ln_wage age, re
    
    Random-effects GLS regression                   Number of obs     =     28,510
    Group variable: idcode                          Number of groups  =      4,710
    
    R-squared:                                      Obs per group:
         Within  = 0.1026                                         min =          1
         Between = 0.0877                                         avg =        6.1
         Overall = 0.0774                                         max =         15
    
                                                    Wald chi2(1)      =    3140.35
    corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
         ln_wage | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .0185667   .0003313    56.04   0.000     .0179174    .0192161
           _cons |   1.120439   .0112038   100.01   0.000      1.09848    1.142398
    -------------+----------------------------------------------------------------
         sigma_u |  .36972456
         sigma_e |  .30349389
             rho |  .59743613   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    
    . predict epsilon, e
    . predict fitted, xb
    
    . twoway (scatter epsilon fitted)
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Radhicka:
      you may want to consider a visual inspection, as there's no test for heteroskedasticity after -xtreg,re-, as far as I know:
      Code:
      use "https://www.stata-press.com/data/r17/nlswork.dta"
      . xtreg ln_wage age, re
      
      Random-effects GLS regression Number of obs = 28,510
      Group variable: idcode Number of groups = 4,710
      
      R-squared: Obs per group:
      Within = 0.1026 min = 1
      Between = 0.0877 avg = 6.1
      Overall = 0.0774 max = 15
      
      Wald chi2(1) = 3140.35
      corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
      
      ------------------------------------------------------------------------------
      ln_wage | Coefficient Std. err. z P>|z| [95% conf. interval]
      -------------+----------------------------------------------------------------
      age | .0185667 .0003313 56.04 0.000 .0179174 .0192161
      _cons | 1.120439 .0112038 100.01 0.000 1.09848 1.142398
      -------------+----------------------------------------------------------------
      sigma_u | .36972456
      sigma_e | .30349389
      rho | .59743613 (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      . predict epsilon, e
      . predict fitted, xb
      
      . twoway (scatter epsilon fitted)
      Thank you Carlo for your kind reply. I have one more question.

      I have run the above commands in my model and the results show that there is no heteroscedasticity in the RE model.

      In addition, I run xtserial command which shows significant p value i.e.., there is serial autocorrelation.

      My panel is short panel with four years and 27 districts. Should I use robust standard errors using the command re, vce(cluster clusterid) or should I run only re with default standard error?

      Please help with this. Thank you a lot for your support.
      Best regards

      Radhika


      Comment


      • #4
        Radhika:
        your diagnosis and therapy are both correct.
        You have a N>T panel dataset with serial correlation of the epsilon: therefore, you should go -vce(cluster panelid)- or -robust- standard errors (they do the very same job under -xtreg-).
        Unfortunately, the devil is in the details: non-default standard errors with less than 30 clusters are at risk of being more misleading that their (theoretically also misleading) default counterparts (see Cameron_Miller_JHR_2015_February.pdf (ucdavis.edu).
        It's up to the researcher to decide which way to go.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Originally posted by Carlo Lazzaro View Post
          Radhika:
          your diagnosis and therapy are both correct.
          You have a N>T panel dataset with serial correlation of the epsilon: therefore, you should go -vce(cluster panelid)- or -robust- standard errors (they do the very same job under -xtreg-).
          Unfortunately, the devil is in the details: non-default standard errors with less than 30 clusters are at risk of being more misleading that their (theoretically also misleading) default counterparts (see Cameron_Miller_JHR_2015_February.pdf (ucdavis.edu).
          It's up to the researcher to decide which way to go.
          Thank you Carlo, for your kind reply.

          It helps a lot.

          Thank you for sharing the reference, which discusses the problem of few clusters and correction mechanisms (though I could not understand it completely ).

          Best Regards

          Radhika C

          Comment

          Working...
          X