Announcement

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

  • RESET test for omitted variables

    Hello,

    I am trying to run diagnostics of my model and I would like to clarify the following uncertainty. I have panel data and I am using fixed effects. Initially, I estimated a model without lagged dependent variable as a regressor but due to suspecting autocorrelation, later I have included it. When I am running Ramsey's RESET test should I run it on the initial or second model? Result for the first one tells about omitted variables, however when the lagged variable is included - there are no omitted variables. How can I interpret this?

  • #2
    Julia:
    how did you perform Ramsey test after -xtreg, fe-?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo Lazzaro oh sorry - performed it before, for simple ols. Then decided to use FE, robust with lagged dependent variable as I also had heteroskedasticity

      Comment


      • #4
        Julia:
        as -estat ovtest- is not supported by -xt- suite, you can test non-linear relationship between predictors and regressand via Pregibon test (see -help linktest-):
        Code:
        use http://www.stata-press.com/data/r15/nlswork.dta
        . xtreg ln_wage age, fe
        
        Fixed-effects (within) regression               Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-sq:                                           Obs per group:
             within  = 0.1026                                         min =          1
             between = 0.0877                                         avg =        6.1
             overall = 0.0774                                         max =         15
        
                                                        F(1,23799)        =    2720.20
        corr(u_i, Xb)  = 0.0314                         Prob > F          =     0.0000
        
        ------------------------------------------------------------------------------
             ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 age |   .0181349   .0003477    52.16   0.000     .0174534    .0188164
               _cons |   1.148214   .0102579   111.93   0.000     1.128107     1.16832
        -------------+----------------------------------------------------------------
             sigma_u |  .40635023
             sigma_e |  .30349389
                 rho |  .64192015   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        F test that all u_i=0: F(4709, 23799) = 8.81                 Prob > F = 0.0000
        
        . predict u, xb
        (24 missing values generated)
        
        . g sq_u=(u)^2
        (24 missing values generated)
        
        . xtreg ln_wage u sq_u, fe
        
        Fixed-effects (within) regression               Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-sq:                                           Obs per group:
             within  = 0.1087                                         min =          1
             between = 0.1006                                         avg =        6.1
             overall = 0.0865                                         max =         15
        
                                                        F(2,23798)        =    1451.88
        corr(u_i, Xb)  = 0.0440                         Prob > F          =     0.0000
        
        ------------------------------------------------------------------------------
             ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                   u |   7.143466    .478902    14.92   0.000     6.204788    8.082144
                sq_u |  -1.816243    .141469   -12.84   0.000    -2.093531   -1.538955
               _cons |  -5.167788   .4037984   -12.80   0.000    -5.959259   -4.376317
        -------------+----------------------------------------------------------------
             sigma_u |   .4039153
             sigma_e |  .30245467
                 rho |  .64073314   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        F test that all u_i=0: F(4709, 23798) = 8.74                 Prob > F = 0.0000
        
        . test sq_u
        
         ( 1)  sq_u = 0
        
               F(  1, 23798) =  164.83
                    Prob > F =    0.0000
        
        .* the statistical significance means that the model is, as expected with one predictor only, misspecified*
        If you suspect/detect autocorrelation and/or heteroskedasticity in the distribution of the idiosyncratic error, just invoke the -cluster- or -robust- option.
        Conversely, lagging the dependent variable, will imply moving from static to dynamic panel data models (a totally different kind of beast).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Carlo:
          Thank you very much for your response and advice! I have one extra question on different topic, when I do -estat vce, corr- after runing me fixed effects regression with lagged dependent variable, there is high correlation between one of my x and yt-1. Is that a big issue, and should I then drop the lagged d. variable?

          Comment


          • #6
            Julia:
            I would advice to get rid of lagging the regressand altogether, as, under -xtreg-, the estimates you get are inconsistent.
            Use -cluster- or -robust- option with -xtreg-, instead.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Carli:
              thank you very much for all your advice!

              Comment


              • #8
                Hi Carlo,

                As you cannot run Ramsey RESET after a fixed effects regression, should I just run Ramsey RESET after using the LSDV version of my FE model to produce estimates?

                Many thanks,
                Jaspal

                Comment


                • #9
                  Jaspal:
                  welcome to this forum.
                  You can use a modified version of the -linktest- command to check for model misspecification, as you can see from the following toy-example:
                  Code:
                  . use "https://www.stata-press.com/data/r16/nlswork.dta"
                  (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
                  
                  . xtreg ln_wage age i.year, fe
                  
                  Fixed-effects (within) regression               Number of obs     =     28,510
                  Group variable: idcode                          Number of groups  =      4,710
                  
                  R-sq:                                           Obs per group:
                       within  = 0.1060                                         min =          1
                       between = 0.0914                                         avg =        6.1
                       overall = 0.0805                                         max =         15
                  
                                                                  F(15,23785)       =     188.00
                  corr(u_i, Xb)  = 0.0467                         Prob > F          =     0.0000
                  
                  ------------------------------------------------------------------------------
                       ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                           age |   .0125992   .0102163     1.23   0.217    -.0074253    .0326238
                               |
                          year |
                           69  |   .0748621   .0159011     4.71   0.000      .043695    .1060292
                           70  |   .0478697   .0235673     2.03   0.042     .0016763     .094063
                           71  |   .0865577   .0327939     2.64   0.008     .0222795     .150836
                           72  |   .0856757   .0424903     2.02   0.044     .0023919    .1689594
                           73  |   .0880069    .052344     1.68   0.093    -.0145906    .1906044
                           75  |   .0778607   .0720304     1.08   0.280    -.0633235    .2190449
                           77  |    .108365   .0922272     1.17   0.240    -.0724063    .2891363
                           78  |   .1309518   .1028143     1.27   0.203    -.0705707    .3324743
                           80  |   .1142649    .122792     0.93   0.352    -.1264152     .354945
                           82  |   .1090451   .1431112     0.76   0.446    -.1714619    .3895522
                           83  |   .1211272   .1532018     0.79   0.429    -.1791581    .4214125
                           85  |   .1465637   .1736146     0.84   0.399    -.1937321    .4868594
                           87  |   .1382642   .1941163     0.71   0.476     -.242216    .5187445
                           88  |   .1799741   .2079871     0.87   0.387    -.2276938     .587642
                               |
                         _cons |   1.203731   .1952306     6.17   0.000     .8210667    1.586396
                  -------------+----------------------------------------------------------------
                       sigma_u |   .4058746
                       sigma_e |  .30300411
                           rho |  .64212421   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  F test that all u_i=0: F(4709, 23785) = 8.80                 Prob > F = 0.0000
                  
                  . predict fitted, xb
                  (24 missing values generated)
                  
                  . g sq_fitted=fitted^2
                  (24 missing values generated)
                  
                  . xtreg ln_wage fitted sq_fitted , fe
                  
                  Fixed-effects (within) regression               Number of obs     =     28,510
                  Group variable: idcode                          Number of groups  =      4,710
                  
                  R-sq:                                           Obs per group:
                       within  = 0.1086                                         min =          1
                       between = 0.0962                                         avg =        6.1
                       overall = 0.0845                                         max =         15
                  
                                                                  F(2,23798)        =    1449.33
                  corr(u_i, Xb)  = 0.0519                         Prob > F          =     0.0000
                  
                  ------------------------------------------------------------------------------
                       ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                        fitted |   4.791882   .4570443    10.48   0.000     3.896046    5.687718
                     sq_fitted |  -1.125657   .1355632    -8.30   0.000    -1.391369   -.8599442
                         _cons |    -3.1774   .3839526    -8.28   0.000    -3.929971   -2.424828
                  -------------+----------------------------------------------------------------
                       sigma_u |  .40489607
                       sigma_e |  .30248347
                           rho |  .64180514   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  F test that all u_i=0: F(4709, 23798) = 8.78                 Prob > F = 0.0000
                  
                  . test sq_fitted=0
                  
                   ( 1)  sq_fitted = 0
                  
                         F(  1, 23798) =   68.95
                              Prob > F =    0.0000
                  The resulst of -test- shows evidence of model misspecification.
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    Hi Carlo,

                    Thanks very much for your help! I tried it but got the results below. I'm not sure what to make of them?

                    Code:
                     xtreg lnyrslost lnalc lngdpnethe lnhe lnhrs lnlru lnobese lnoop lnpol lnpopstruc year2-year17, fe
                    
                    Fixed-effects (within) regression               Number of obs     =        527
                    Group variable: c_id                            Number of groups  =         35
                    
                    R-sq:                                           Obs per group:
                         within  = 0.8838                                         min =          7
                         between = 0.5104                                         avg =       15.1
                         overall = 0.5897                                         max =         17
                    
                                                                    F(25,467)         =     142.12
                    corr(u_i, Xb)  = 0.3047                         Prob > F          =     0.0000
                    
                    ------------------------------------------------------------------------------
                       lnyrslost |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                           lnalc |   .2364279   .0337759     7.00   0.000     .1700564    .3027995
                      lngdpnethe |  -.2018354   .0418138    -4.83   0.000    -.2840018    -.119669
                            lnhe |  -.0614547    .040874    -1.50   0.133    -.1417745    .0188651
                           lnhrs |   .4635103   .1449492     3.20   0.001     .1786769    .7483437
                           lnlru |  -.0137754   .0103706    -1.33   0.185    -.0341542    .0066033
                         lnobese |   .2000181   .0877928     2.28   0.023     .0275001     .372536
                           lnoop |     .04865   .0222948     2.18   0.030     .0048394    .0924606
                           lnpol |   .0221281    .026256     0.84   0.400    -.0294664    .0737227
                      lnpopstruc |    .134221   .0747912     1.79   0.073    -.0127479    .2811899
                           year2 |  -.0190149   .0134847    -1.41   0.159    -.0455131    .0074834
                           year3 |  -.0328363   .0148058    -2.22   0.027    -.0619305   -.0037421
                           year4 |  -.0547662   .0163505    -3.35   0.001    -.0868958   -.0226366
                           year5 |  -.0813504    .018457    -4.41   0.000    -.1176195   -.0450813
                           year6 |  -.0979063   .0209637    -4.67   0.000    -.1391012   -.0567115
                           year7 |  -.1041513   .0243929    -4.27   0.000    -.1520847   -.0562179
                           year8 |  -.1145426   .0277315    -4.13   0.000    -.1690365   -.0600487
                           year9 |   -.149305   .0309592    -4.82   0.000    -.2101415   -.0884684
                          year10 |  -.1706807   .0328238    -5.20   0.000    -.2351814     -.10618
                          year11 |   -.199391   .0350153    -5.69   0.000     -.268198   -.1305841
                          year12 |  -.2170585   .0382028    -5.68   0.000    -.2921293   -.1419878
                          year13 |  -.2455363   .0407991    -6.02   0.000    -.3257087   -.1653638
                          year14 |  -.2567588   .0439462    -5.84   0.000    -.3431156    -.170402
                          year15 |  -.2828465   .0465216    -6.08   0.000     -.374264   -.1914289
                          year16 |  -.3011785   .0493891    -6.10   0.000    -.3982308   -.2041261
                          year17 |    -.30004   .0526682    -5.70   0.000    -.4035359   -.1965441
                           _cons |   6.024674   1.164144     5.18   0.000     3.737065    8.312282
                    -------------+----------------------------------------------------------------
                         sigma_u |  .26531306
                         sigma_e |  .04742289
                             rho |  .96904003   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    F test that all u_i=0: F(34, 467) = 215.81                   Prob > F = 0.0000
                    
                    . 
                    . 
                    . predict fitted, xb
                    (40 missing values generated)
                    
                    . gen sq_fitted = fitted^2
                    (40 missing values generated)
                    
                    . xtreg lnyrslost fitted sq_fitted, fe
                    
                    Fixed-effects (within) regression               Number of obs     =        527
                    Group variable: c_id                            Number of groups  =         35
                    
                    R-sq:                                           Obs per group:
                         within  = 0.8840                                         min =          7
                         between = 0.5160                                         avg =       15.1
                         overall = 0.5934                                         max =         17
                    
                                                                    F(2,490)          =    1866.49
                    corr(u_i, Xb)  = 0.3112                         Prob > F          =     0.0000
                    
                    ------------------------------------------------------------------------------
                       lnyrslost |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                          fitted |   .3421513    .855178     0.40   0.689    -1.338117     2.02242
                       sq_fitted |   .0383396   .0498308     0.77   0.442    -.0595689     .136248
                           _cons |   2.820235     3.6682     0.77   0.442    -4.387108    10.02758
                    -------------+----------------------------------------------------------------
                         sigma_u |  .26461935
                         sigma_e |   .0462686
                             rho |  .97033454   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    F test that all u_i=0: F(34, 490) = 326.92                   Prob > F = 0.0000
                    
                    .
                    Many thanks,
                    Jaspal

                    Comment


                    • #11
                      Jaspal:
                      despite you omitted to -test- sq_fitted=0, since its coefficients does not reach statistical significance, your regression model does not support evidence of misspecification.
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment


                      • #12
                        Thank you Carlo. God bless!

                        Comment


                        • #13
                          I'd be careful constructing the "link" test by hand. I assume that when you used the built-in command, Stata is properly compute the standard error that accounts for the first-step estimation of beta. The procedure proposed by Carlo is sound but I don't think the standard error is correct.

                          I prefer a modification of RESET in which I can compute a valid standard or or joint F test. I will also not that it's almost always a good idea to cluster your standard errors to account for serial correlation and heteroskedasticity.

                          Code:
                          xtreg y x1 x2 ... xK, fe vce(cluster id)
                          predict xbhat, xb
                          gen xbhatsq = xbhat^2
                          gen xbhatcu = xbhat^2
                          xtreg y x1 x2 ... xK xbhatsq xbhatcu, fe vce(cluster id)
                          test xbhatsq xbhatcu
                          I should also point out that RESET is not a general misspecification test no matter how many times this is said. It is a pure test of functional form. Therefore, you might want to expand your model to include squares and interactions to see if the are important -- if the test rejects. For example, in Carlo's example, I'm pretty sure the square of age would be important, and it is omitted from the equation.

                          Comment


                          • #14
                            Thanks for your advise Jeff!

                            Do you mind clarifying the difference between a general misspecification test and a pure test of functional form?

                            Best,
                            Jaspal

                            Comment


                            • #15
                              Just to add another quick question, I am not sure whether or not the clustered errors are appropriate. My model does not have serial correlation, but does have heteroskedasticity. Do I have to use the robust errors? They remove the significance of a few of my findings.

                              Many thanks,
                              Jaspal

                              Comment

                              Working...
                              X