Announcement

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

  • #16
    sorry forgot to mention, that the variable names this is concerning is epad (automotive diesel) and epop (oil products)

    Comment


    • #17
      Anne:
      some comments about your query:
      1) it may be due to heteroskedasticity (hence, cluster-robust standard errors are the way to go, even if your groups are only 20);
      2) it may be due to too many predictors in the right-hand side of your regression equation (some of them seem redundant).
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #18
        Carlo, thank you! I had completely overlooked, that I didn't get cluster-robust std. errors.
        Code:
        .
        xtreg bincw povri dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re cluster()
        
        Random-effects GLS regression                   Number of obs     =        209
        Group variable: cntry                           Number of groups  =         20
        
        R-squared:                                      Obs per group:
             Within  = 0.5041                                         min =          6
             Between = 0.7673                                         avg =       10.4
             Overall = 0.7141                                         max =         11
        
                                                        Wald chi2(14)     =     295.04
        corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
        
        ------------------------------------------------------------------------------
               bincw | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
               povri |   1.077634     .10159    10.61   0.000     .8785216    1.276747
                dipa |  -.0344149   .0358914    -0.96   0.338    -.1047607    .0359309
                ddpa |   .0040692   .0350314     0.12   0.908     -.064591    .0727294
               noren |   -.443122   2.643103    -0.17   0.867    -5.623508    4.737264
               noown |  -7.269417   2.877654    -2.53   0.012    -12.90952   -1.629318
                hhgp |   .2621671   .2772514     0.95   0.344    -.2812356    .8055698
                hhep |   .0435926   .1259867     0.35   0.729    -.2033368    .2905219
                epad |  -.2321981   .0585484    -3.97   0.000    -.3469508   -.1174453
                epop |  -.1155069   .1115238    -1.04   0.300    -.3340895    .1030757
                epug |   .4527002   .1237078     3.66   0.000     .2102374     .695163
                wgge |    .017569   .0935747     0.19   0.851    -.1658341    .2009721
               wgphs |  -.0157227    .095093    -0.17   0.869    -.2021015    .1706561
               wgsst |  -.2055807   .2426368    -0.85   0.397    -.6811401    .2699787
                 rec |   -.125298    .054656    -2.29   0.022    -.2324219   -.0181742
               _cons |   3.483138   8.441969     0.41   0.680    -13.06282    20.02909
        -------------+----------------------------------------------------------------
             sigma_u |  2.7264747
             sigma_e |  2.3243363
                 rho |  .57911706   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        
        . xtreg bincw povri dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re vce(cluster cntry)
        
        Random-effects GLS regression                   Number of obs     =        209
        Group variable: cntry                           Number of groups  =         20
        
        R-squared:                                      Obs per group:
             Within  = 0.5041                                         min =          6
             Between = 0.7673                                         avg =       10.4
             Overall = 0.7141                                         max =         11
        
                                                        Wald chi2(14)     =     741.71
        corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
        
                                         (Std. err. adjusted for 20 clusters in cntry)
        ------------------------------------------------------------------------------
                     |               Robust
               bincw | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
               povri |   1.077634   .1645577     6.55   0.000     .7551071    1.400162
                dipa |  -.0344149   .0399869    -0.86   0.389    -.1127877     .043958
                ddpa |   .0040692   .0303355     0.13   0.893    -.0553873    .0635257
               noren |   -.443122   2.420777    -0.18   0.855    -5.187757    4.301513
               noown |  -7.269417    2.72881    -2.66   0.008    -12.61779   -1.921048
                hhgp |   .2621671   .3862824     0.68   0.497    -.4949324    1.019267
                hhep |   .0435926   .1389173     0.31   0.754    -.2286803    .3158655
                epad |  -.2321981   .0671894    -3.46   0.001    -.3638869   -.1005092
                epop |  -.1155069   .0935965    -1.23   0.217    -.2989526    .0679388
                epug |   .4527002    .121722     3.72   0.000     .2141295    .6912709
                wgge |    .017569   .0910043     0.19   0.847    -.1607962    .1959342
               wgphs |  -.0157227   .1796008    -0.09   0.930    -.3677338    .3362885
               wgsst |  -.2055807   .3137024    -0.66   0.512    -.8204261    .4092648
                 rec |   -.125298   .0752764    -1.66   0.096    -.2728371    .0222411
               _cons |   3.483138   16.28392     0.21   0.831    -28.43276    35.39903
        -------------+----------------------------------------------------------------
             sigma_u |  2.7264747
             sigma_e |  2.3243363
                 rho |  .57911706   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        Would you recommend me performing a wald test on the predictor variables, to figure out if some of my variables are redundant? Is this a compatible method with re?

        BR Anne

        Comment


        • #19
          Anne:
          as some p-values are alarmingly high, I would recommend you to check the correlation of the coefficients via:
          Code:
          estat vce, corr
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #20
            I think i attached the data with a new variable (povri) that shouldn't be included. so the true results is as follows:

            Code:
             xtreg bincw dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re vce(cluster cntry)
            
            Random-effects GLS regression                   Number of obs     =        209
            Group variable: cntry                           Number of groups  =         20
            
            R-squared:                                      Obs per group:
                 Within  = 0.1957                                         min =          6
                 Between = 0.7145                                         avg =       10.4
                 Overall = 0.6331                                         max =         11
            
                                                            Wald chi2(13)     =     164.14
            corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
            
                                             (Std. err. adjusted for 20 clusters in cntry)
            ------------------------------------------------------------------------------
                         |               Robust
                   bincw | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                    dipa |    -.11896    .070824    -1.68   0.093    -.2577725    .0198524
                    ddpa |   .0269258   .0503971     0.53   0.593    -.0718507    .1257023
                   noren |   -1.45799   3.079142    -0.47   0.636    -7.492997    4.577017
                   noown |  -8.542249   3.339083    -2.56   0.011    -15.08673   -1.997767
                    hhgp |   .3165467   .4411764     0.72   0.473    -.5481432    1.181237
                    hhep |  -.0073165   .2191188    -0.03   0.973    -.4367815    .4221485
                    epad |  -.2064444   .0897387    -2.30   0.021    -.3823291   -.0305598
                    epop |  -.2397357   .1423787    -1.68   0.092    -.5187928    .0393214
                    epug |    .611444   .1795668     3.41   0.001     .2594995    .9633884
                    wgge |   .1650103   .1214228     1.36   0.174     -.072974    .4029946
                   wgphs |  -.4320382    .188689    -2.29   0.022    -.8018619   -.0622145
                   wgsst |  -.1977692   .3755178    -0.53   0.598    -.9337706    .5382321
                     rec |  -.1316739   .0690174    -1.91   0.056    -.2669455    .0035976
                   _cons |     51.801   15.00813     3.45   0.001     22.38561    81.21639
            -------------+----------------------------------------------------------------
                 sigma_u |  4.1444811
                 sigma_e |  3.0344652
                     rho |   .6510107   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            
            . xtreg bincw dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re cluster()
            
            Random-effects GLS regression                   Number of obs     =        209
            Group variable: cntry                           Number of groups  =         20
            
            R-squared:                                      Obs per group:
                 Within  = 0.1957                                         min =          6
                 Between = 0.7145                                         avg =       10.4
                 Overall = 0.6331                                         max =         11
            
                                                            Wald chi2(13)     =     100.08
            corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
            
            ------------------------------------------------------------------------------
                   bincw | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                    dipa |    -.11896   .0437347    -2.72   0.007    -.2046785   -.0332416
                    ddpa |   .0269258   .0433534     0.62   0.535    -.0580454     .111897
                   noren |   -1.45799   3.400739    -0.43   0.668    -8.123315    5.207335
                   noown |  -8.542249   3.724434    -2.29   0.022    -15.84201   -1.242492
                    hhgp |   .3165467   .3465723     0.91   0.361    -.3627226     .995816
                    hhep |  -.0073165   .1588096    -0.05   0.963    -.3185776    .3039445
                    epad |  -.2064444   .0724658    -2.85   0.004    -.3484749    -.064414
                    epop |  -.2397357    .136564    -1.76   0.079    -.5073962    .0279248
                    epug |    .611444   .1521178     4.02   0.000     .3132985    .9095894
                    wgge |   .1650103     .11456     1.44   0.150    -.0595232    .3895438
                   wgphs |  -.4320382    .108138    -4.00   0.000    -.6439849   -.2200916
                   wgsst |  -.1977692   .3066784    -0.64   0.519    -.7988478    .4033094
                     rec |  -.1316739   .0720012    -1.83   0.067    -.2727936    .0094458
                   _cons |     51.801   8.780813     5.90   0.000     34.59092    69.01108
            -------------+----------------------------------------------------------------
                 sigma_u |  4.1444811
                 sigma_e |  3.0344652
                     rho |   .6510107   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            I tried running the wald test on my control variables and got the following results.
            Code:
             quietly xtreg bincw dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re vce(cluster cntry)
            
            . test epug
            
             ( 1)  epug = 0
            
                       chi2(  1) =   11.59
                     Prob > chi2 =    0.0007
            
            . test epad
            
             ( 1)  epad = 0
            
                       chi2(  1) =    5.29
                     Prob > chi2 =    0.0214
            
            . test epop
            
             ( 1)  epop = 0
            
                       chi2(  1) =    2.84
                     Prob > chi2 =    0.0922
            
            . test hhep
            
             ( 1)  hhep = 0
            
                       chi2(  1) =    0.00
                     Prob > chi2 =    0.9734
            
            . test hhgp
            
             ( 1)  hhgp = 0
            
                       chi2(  1) =    0.51
                     Prob > chi2 =    0.4731
            
            . test noren
            
             ( 1)  noren = 0
            
                       chi2(  1) =    0.22
                     Prob > chi2 =    0.6359
            
            . test noown
            
             ( 1)  noown = 0
            
                       chi2(  1) =    6.54
                     Prob > chi2 =    0.0105
            
            . test dipa
            
             ( 1)  dipa = 0
            
                       chi2(  1) =    2.82
                     Prob > chi2 =    0.0930
            
            . test ddpa
            
             ( 1)  ddpa = 0
            
                       chi2(  1) =    0.29
                     Prob > chi2 =    0.5932
            and then i ran a regression without the variables which were rejected by the test

            Code:
            . xtreg bincw noown epad epug wgge wgphs wgsst rec, re vce(cluster cntry)
            
            Random-effects GLS regression                   Number of obs     =        231
            Group variable: cntry                           Number of groups  =         21
            
            R-squared:                                      Obs per group:
                 Within  = 0.2132                                         min =         11
                 Between = 0.7439                                         avg =       11.0
                 Overall = 0.6784                                         max =         11
            
                                                            Wald chi2(7)      =      97.00
            corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
            
                                             (Std. err. adjusted for 21 clusters in cntry)
            ------------------------------------------------------------------------------
                         |               Robust
                   bincw | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
            -------------+----------------------------------------------------------------
                   noown |  -9.780402   1.765615    -5.54   0.000    -13.24094    -6.31986
                    epad |   -.240446   .0632929    -3.80   0.000    -.3644978   -.1163943
                    epug |   .3978157   .0599291     6.64   0.000     .2803568    .5152746
                    wgge |   .1708338   .1125525     1.52   0.129    -.0497651    .3914326
                   wgphs |  -.5015039   .1865653    -2.69   0.007    -.8671652   -.1358426
                   wgsst |   -.290375   .2950817    -0.98   0.325    -.8687244    .2879745
                     rec |  -.0852776    .063578    -1.34   0.180    -.2098882     .039333
                   _cons |   57.30752   15.07934     3.80   0.000     27.75257    86.86248
            -------------+----------------------------------------------------------------
                 sigma_u |  4.1072983
                 sigma_e |  3.1159158
                     rho |  .63471188   (fraction of variance due to u_i)
            ------------------------------------------------------------------------------
            But it still seems weird with the automotive diesel price, maybe the wald test isn't that compatible with re?

            BR Anne

            Comment


            • #21
              Anne:
              I would still recommend:
              Code:
              estat vce, corr
              after -xtreg, re-.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment


              • #22
                Code:
                . quietly xtreg bincw dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re vce(cluster cntry)
                
                . estat vce, correlation
                
                Correlation matrix of coefficients of xtreg model
                
                        e(V) |     dipa      ddpa     noren     noown      hhgp      hhep      epad      epop      epug      wgge     wgphs     wgsst       rec     _cons
                -------------+--------------------------------------------------------------------------------------------------------------------------------------------
                        dipa |   1.0000                                                                                                                                  
                        ddpa |   0.1914    1.0000                                                                                                                        
                       noren |  -0.2742   -0.2549    1.0000                                                                                                              
                       noown |  -0.0898   -0.0810   -0.7883   1.0000                                                                                                    
                        hhgp |  -0.5144  -0.1604    0.2086    0.0330    1.0000                                                                                          
                        hhep |   0.4092    0.0340    0.1889   -0.4310   -0.4325    1.0000                                                                                
                        epad |   0.0703   -0.1226   -0.2697   0.4269   -0.3018   -0.0822    1.0000                                                                      
                        epop |   0.2765   -0.1567   -0.0039   -0.0479   -0.1742    0.7017  -0.2785    1.0000                                                            
                        epug |  -0.2474    0.2431    0.0988   -0.1811    0.1987   -0.6428   -0.2074   -0.8600   1.0000                                                  
                        wgge |  -0.0558   -0.0777    0.2690   -0.3212    0.1674    0.4044  -0.3154   0.2655   -0.1130    1.0000                                        
                       wgphs | -0.3942   -0.0875   -0.1615    0.2365    0.3764   -0.1515   -0.1846    0.0306    0.1044    0.2155    1.0000                              
                       wgsst |   0.1600    0.2074   -0.2336    0.2188   -0.2621   -0.3663    0.2730   -0.2681    0.1506   -0.9172   -0.3305    1.0000                    
                         rec |   0.2264   -0.3334  -0.2148    0.1738    0.0568   -0.2142   -0.1832    0.1100   -0.0044    0.1518   -0.0059   -0.2286    1.0000          
                       _cons |   0.2615   -0.0413    0.2253   -0.2564   -0.2556    0.1961    0.1154    0.0736   -0.2063   -0.2052   -0.9539    0.2406    0.0413    1.0000
                
                . quietly xtreg bincw dipa ddpa noren noown hhgp hhep epad epop epug wgge wgphs wgsst rec, re
                
                . estat vce, correlation
                
                Correlation matrix of coefficients of xtreg model
                
                        e(V) |     dipa      ddpa     noren     noown      hhgp      hhep      epad      epop      epug      wgge     wgphs     wgsst       rec     _cons
                -------------+--------------------------------------------------------------------------------------------------------------------------------------------
                        dipa |   1.0000                                                                                                                                  
                        ddpa |   0.2220    1.0000                                                                                                                        
                       noren |   0.0248   -0.1601    1.0000                                                                                                              
                       noown |  -0.1406    0.0760   -0.7590    1.0000                                                                                                    
                        hhgp |  -0.0658   -0.1347    0.0254   -0.0011    1.0000                                                                                          
                        hhep |  -0.0025    0.0146   -0.0239   -0.1927   -0.3595    1.0000                                                                                
                        epad |  -0.0577    0.1352   -0.0889    0.2579   -0.0265   -0.0094    1.0000                                                                      
                        epop |   0.1273   -0.0130   -0.0236   -0.0959   -0.1853    0.2209   -0.2687    1.0000                                                            
                        epug |  -0.0927   -0.0440    0.0699   -0.0704    0.1289   -0.2212   -0.3079   -0.8177    1.0000                                                  
                        wgge |   0.0416   -0.0464   -0.1982    0.1930    0.0777    0.2829    0.0538   -0.0857    0.0169    1.0000                                        
                       wgphs |  -0.0004   -0.0141   -0.0301   -0.1735   -0.0542    0.1027   -0.1609    0.0600    0.0703   -0.1137    1.0000                              
                       wgsst |  -0.0397    0.1767    0.0788   -0.0744   -0.1764   -0.3493    0.0484    0.0193   -0.0169   -0.7933   -0.0174    1.0000                    
                         rec |   0.1363    0.1546    0.1531   -0.1070   -0.0871   -0.1273    0.1570    0.1369   -0.2398    0.0093    0.0659   -0.0108    1.0000          
                       _cons |  -0.0871   -0.2636    0.1057   -0.0771    0.1003   -0.0718    0.0364    0.0796   -0.1504   -0.1013   -0.8055   -0.0090   -0.1328    1.0000
                if i understand a matrix like this correctly, then its best if the values are below 0.3 right? So my main concern should be epop which has a high value with electricity price(hhep) and unleaded gasoline(epug) as well as the relationship between wgsst and wgge. Am i understanding it correctly? this is based on the first correlation matrix depicted

                Comment


                • #23
                  Anne:
                  a rho=|0.3| threshold value is probably too severe, but what is above rho=|0.6| should be considered with a bit of caution.
                  Kind regards,
                  Carlo
                  (StataNow 18.5)

                  Comment


                  • #24
                    Ah okay, that's nice.
                    Can I do anything about the variables that score above 0.6 to improve my data or should I just be attentive to it while analysing my results? I am thinking if I should remove some of the variables or just let it all stay?

                    Comment


                    • #25
                      I might have found a feasible solution. If I use the total count for energy prices (eptot) and give up the nuances and use a total variable for noren/noown (notot), then i get the following results

                      Code:
                      . xtreg tincw povri dipa ddpa notot eptot wgswe wgge wgphs wgsst rec, re vce(cluster cntry)
                      
                      Random-effects GLS regression                   Number of obs     =        237
                      Group variable: cntry                           Number of groups  =         22
                      
                      R-squared:                                      Obs per group:
                           Within  = 0.6273                                         min =          6
                           Between = 0.7228                                         avg =       10.8
                           Overall = 0.7025                                         max =         11
                      
                                                                      Wald chi2(10)     =     380.55
                      corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
                      
                                                       (Std. err. adjusted for 22 clusters in cntry)
                      ------------------------------------------------------------------------------
                                   |               Robust
                             tincw | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                      -------------+----------------------------------------------------------------
                             povri |   .8328126   .1228118     6.78   0.000     .5921059    1.073519
                              dipa |  -.0080761   .0300793    -0.27   0.788    -.0670305    .0508782
                              ddpa |   .0323115   .0211811     1.53   0.127    -.0092028    .0738257
                             notot |  -3.328045   1.486655    -2.24   0.025    -6.241835   -.4142544
                             eptot |   .0226989   .0203902     1.11   0.266    -.0172651     .062663
                             wgswe |   .1324678   .2119847     0.62   0.532    -.2830146    .5479501
                              wgge |  -.0179962   .0384817    -0.47   0.640    -.0934189    .0574265
                             wgphs |  -.0192147   .0845137    -0.23   0.820    -.1848585    .1464291
                             wgsst |  -.2201606   .3028445    -0.73   0.467    -.8137249    .3734037
                               rec |   .0216543    .041773     0.52   0.604    -.0602193    .1035278
                             _cons |  -3.272447   7.710654    -0.42   0.671    -18.38505    11.84016
                      -------------+----------------------------------------------------------------
                           sigma_u |  3.3348653
                           sigma_e |  1.3819794
                               rho |  .85343882   (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------
                      
                      . estat vce, corr
                      
                      Correlation matrix of coefficients of xtreg model
                      
                              e(V) |    povri      dipa      ddpa     notot     eptot     wgswe      wgge     wgphs     wgsst       rec     _cons 
                      -------------+--------------------------------------------------------------------------------------------------------------
                             povri |   1.0000                                                                                                     
                              dipa |   0.4565    1.0000                                                                                           
                              ddpa |   0.2919    0.5822    1.0000                                                                                 
                             notot |   0.0655   -0.3291   -0.1500    1.0000                                                                       
                             eptot |  -0.6048    0.1182    0.1440   -0.2114    1.0000                                                             
                             wgswe |   0.0743    0.0073   -0.4271    0.0150   -0.3714    1.0000                                                   
                              wgge |  -0.5370   -0.0253   -0.0077   -0.2415    0.1710    0.3337    1.0000                                         
                             wgphs |  -0.1374   -0.1301    0.3546    0.3251   -0.0478   -0.0784    0.1395    1.0000                               
                             wgsst |   0.1197   -0.0251    0.2643   -0.0067    0.2511   -0.8992   -0.6114   -0.0531    1.0000                     
                               rec |   0.3589    0.6488    0.6014   -0.2658   -0.1384    0.0048    0.0055    0.2109   -0.1457    1.0000           
                             _cons |  -0.2097   -0.1693   -0.5171   -0.4564    0.0815    0.1108    0.1167   -0.8772   -0.0785   -0.3176    1.0000
                      I still have a few above 0.6, but this might be a better solution when thinking of my data size?

                      BR Anne

                      Comment


                      • #26
                        Anne:
                        your solution sounds good.
                        What I'd do next is investigating the correctness of the functional form of the regressand via a procedure that is explained in the -linktest- entry, Stata .manual but cannot be invoked as a built-in command after -xtreg-:
                        Code:
                        . use "https://www.stata-press.com/data/r17/nlswork.dta"
                        (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
                        
                        . xtreg ln_wage c.age##c.age c.tenure##c.tenure, re vce(cluster idcode)
                        
                        Random-effects GLS regression                   Number of obs     =     28,101
                        Group variable: idcode                          Number of groups  =      4,699
                        
                        R-squared:                                      Obs per group:
                             Within  = 0.1437                                         min =          1
                             Between = 0.2289                                         avg =        6.0
                             Overall = 0.1681                                         max =         15
                        
                                                                        Wald chi2(4)      =    2426.91
                        corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
                        
                                                          (Std. err. adjusted for 4,699 clusters in idcode)
                        -----------------------------------------------------------------------------------
                                          |               Robust
                                  ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                        ------------------+----------------------------------------------------------------
                                      age |   .0461889   .0041115    11.23   0.000     .0381306    .0542473
                                          |
                              c.age#c.age |  -.0005838   .0000696    -8.38   0.000    -.0007203   -.0004473
                                          |
                                   tenure |   .0474832   .0020656    22.99   0.000     .0434347    .0515317
                                          |
                        c.tenure#c.tenure |  -.0015861   .0001342   -11.82   0.000    -.0018491   -.0013231
                                          |
                                    _cons |   .7415106   .0582342    12.73   0.000     .6273737    .8556474
                        ------------------+----------------------------------------------------------------
                                  sigma_u |  .33095116
                                  sigma_e |  .29558703
                                      rho |  .55626445   (fraction of variance due to u_i)
                        -----------------------------------------------------------------------------------
                        
                        . predict fitted, xb
                        (433 missing values generated)
                        
                        . g sq_fitted=fitted^2
                        (433 missing values generated)
                        
                        . xtreg ln_wage c.age##c.age c.tenure##c.tenure fitted sq_fitted , re vce(cluster idcode)
                        note: c.tenure#c.tenure omitted because of collinearity.
                        
                        Random-effects GLS regression                   Number of obs     =     28,101
                        Group variable: idcode                          Number of groups  =      4,699
                        
                        R-squared:                                      Obs per group:
                             Within  = 0.1464                                         min =          1
                             Between = 0.2328                                         avg =        6.0
                             Overall = 0.1735                                         max =         15
                        
                                                                        Wald chi2(5)      =    2538.71
                        corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
                        
                                                          (Std. err. adjusted for 4,699 clusters in idcode)
                        -----------------------------------------------------------------------------------
                                          |               Robust
                                  ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                        ------------------+----------------------------------------------------------------
                                      age |  -.0145133   .0066019    -2.20   0.028    -.0274528   -.0015739
                                          |
                              c.age#c.age |   .0002411   .0001001     2.41   0.016     .0000448    .0004374
                                          |
                                   tenure |   .0123218   .0029328     4.20   0.000     .0065736    .0180701
                                          |
                        c.tenure#c.tenure |          0  (omitted)
                                          |
                                   fitted |   5.277864    .484001    10.90   0.000     4.329239    6.226488
                                sq_fitted |  -1.323279   .1496981    -8.84   0.000    -1.616682   -1.029876
                                    _cons |  -3.250836   .3637134    -8.94   0.000    -3.963701   -2.537971
                        ------------------+----------------------------------------------------------------
                                  sigma_u |  .32974949
                                  sigma_e |  .29511262
                                      rho |  .55526142   (fraction of variance due to u_i)
                        -----------------------------------------------------------------------------------
                        
                        .
                        As -sq_fited- reaches statistical significance, the model is misspecified.
                        Kind regards,
                        Carlo
                        (StataNow 18.5)

                        Comment


                        • #27
                          Is it correct if i understand this as something similar to the ramsay reset test?
                          Sq_fitted turned out to be insignificant in my case, but not by much.
                          Is this like a one-time test or should i include it in the regression output - i see that it changes some of the p values.

                          Code:
                          xtreg tincw povri dipa ddpa notot eptot rec wgswe wgge wgsst wgphs, re vce(cluster cntry)
                          
                          Random-effects GLS regression                   Number of obs     =        237
                          Group variable: cntry                           Number of groups  =         22
                          
                          R-squared:                                      Obs per group:
                               Within  = 0.6273                                         min =          6
                               Between = 0.7228                                         avg =       10.8
                               Overall = 0.7025                                         max =         11
                          
                                                                          Wald chi2(10)     =     380.55
                          corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
                          
                                                           (Std. err. adjusted for 22 clusters in cntry)
                          ------------------------------------------------------------------------------
                                       |               Robust
                                 tincw | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                                 povri |   .8328126   .1228118     6.78   0.000     .5921059    1.073519
                                  dipa |  -.0080761   .0300793    -0.27   0.788    -.0670305    .0508782
                                  ddpa |   .0323115   .0211811     1.53   0.127    -.0092028    .0738257
                                 notot |  -3.328045   1.486655    -2.24   0.025    -6.241835   -.4142544
                                 eptot |   .0226989   .0203902     1.11   0.266    -.0172651     .062663
                                   rec |   .0216543    .041773     0.52   0.604    -.0602193    .1035278
                                 wgswe |   .1324678   .2119847     0.62   0.532    -.2830146    .5479501
                                  wgge |  -.0179962   .0384817    -0.47   0.640    -.0934189    .0574265
                                 wgsst |  -.2201606   .3028445    -0.73   0.467    -.8137249    .3734037
                                 wgphs |  -.0192147   .0845137    -0.23   0.820    -.1848585    .1464291
                                 _cons |  -3.272447   7.710654    -0.42   0.671    -18.38505    11.84016
                          -------------+----------------------------------------------------------------
                               sigma_u |  3.3348653
                               sigma_e |  1.3819794
                                   rho |  .85343882   (fraction of variance due to u_i)
                          ------------------------------------------------------------------------------
                          
                          . predict fitted, xb
                          (5 missing values generated)
                          
                          . g sq_fitted=fitted^2
                          (5 missing values generated)
                          
                          . xtreg tincw povri dipa ddpa notot eptot rec wgswe wgge wgsst wgphs fitted sq_fitted, re vce(cluster cntry)
                          note: fitted omitted because of collinearity.
                          
                          Random-effects GLS regression                   Number of obs     =        237
                          Group variable: cntry                           Number of groups  =         22
                          
                          R-squared:                                      Obs per group:
                               Within  = 0.6584                                         min =          6
                               Between = 0.7135                                         avg =       10.8
                               Overall = 0.6985                                         max =         11
                          
                                                                          Wald chi2(11)     =     290.51
                          corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
                          
                                                           (Std. err. adjusted for 22 clusters in cntry)
                          ------------------------------------------------------------------------------
                                       |               Robust
                                 tincw | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                          -------------+----------------------------------------------------------------
                                 povri |   .2368448   .2841926     0.83   0.405    -.3201625    .7938521
                                  dipa |  -.0050196   .0247749    -0.20   0.839    -.0535775    .0435383
                                  ddpa |   .0138938   .0209791     0.66   0.508    -.0272245    .0550122
                                 notot |  -1.604156   1.412062    -1.14   0.256    -4.371746    1.163434
                                 eptot |   .0139983   .0245837     0.57   0.569    -.0341849    .0621815
                                   rec |   .0191002   .0346225     0.55   0.581    -.0487586    .0869589
                                 wgswe |   .0655763    .198184     0.33   0.741    -.3228572    .4540098
                                  wgge |   .0172704   .0337686     0.51   0.609    -.0489148    .0834556
                                 wgsst |  -.1718185   .2905914    -0.59   0.554    -.7413671    .3977301
                                 wgphs |  -.0521056   .0753834    -0.69   0.489    -.1998544    .0956431
                                fitted |          0  (omitted)
                             sq_fitted |   .0216232   .0125354     1.72   0.085    -.0029457     .046192
                                 _cons |    7.19012   9.232625     0.78   0.436    -10.90549    25.28573
                          -------------+----------------------------------------------------------------
                               sigma_u |  3.4893001
                               sigma_e |  1.3255965
                                   rho |  .87387648   (fraction of variance due to u_i)
                          ------------------------------------------------------------------------------

                          Comment


                          • #28
                            Anne:
                            1) do not mumble that much on sq_fitted: it does not reach ststistocal significance. Therefore, you shoud be happy, after all this going back and forth from tables, that your model is not misspecified;
                            2) yes, you're right it is similat to -estat ovtest- (that you cannot call after -xtreg-, though). Replicatiing your terminology, it is a one-shot test that should not be reported in the main regression otcome table. That said, I would mention in your dissertation/research report/whatever that you checked your regression for the possible misspecification of the functional form of the regressand (and that the null of no evidence of misspecification was not rejected)
                            Kind regards,
                            Carlo
                            (StataNow 18.5)

                            Comment

                            Working...
                            X