Announcement

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

  • Panel data, county-level data, but state level intercept

    Dear all,

    I'm working on a thesis about the impact of economic growth on local obesity rates. I have US nation wide county-level data (non-metropolitan counties only) and a time period from 2012 through 2017. I'm using the fixed-effects model. There are over 9,000 observations and 1,809 panels (counties). My unit observations are counties.
    The results, however, were insignificant. So I did some modification. I include state dummy variables. So as a result, I have county-level data, but state level intercepts.
    My question is that, how would I test for heteroscedasticity and autocorrelation? I don't think the xttest3 and xtserial will still work in this case.

    Thank you!
    Last edited by Yancheng Li; 21 Jul 2020, 16:00.

  • #2
    Code:
    . global id FIPS
    
    . global t Year
    
    . global ylist Obese
    
    . global xlist Ln_PC_GDP PI Unem Age AfricanA NativeA AsianA HispanicA Ln_Pop Pov FSI dumt* dumtst*
    
    . sort $id $t
    
    . xtset $id $t
           panel variable:  FIPS (strongly balanced)
            time variable:  Year, 2012 to 2017
                    delta:  1 unit
    
    . reg $ylist $xlist
    note: dumtst2 omitted because of collinearity
    note: dumtst10 omitted because of collinearity
    
          Source |       SS           df       MS      Number of obs   =     9,928
    -------------+----------------------------------   F(61, 9866)     =    428.69
           Model |  130822.294        61  2144.62777   Prob > F        =    0.0000
        Residual |  49356.6266     9,866  5.00269882   R-squared       =    0.7261
    -------------+----------------------------------   Adj R-squared   =    0.7244
           Total |  180178.921     9,927  18.1503899   Root MSE        =    2.2367
    
    ------------------------------------------------------------------------------
           Obese |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
       Ln_PC_GDP |  -.1662111    .061285    -2.71   0.007    -.2863421     -.04608
              PI |    .330414   .0078796    41.93   0.000     .3149684    .3458595
            Unem |   .0419582   .0137615     3.05   0.002     .0149829    .0689336
             Age |   -.147153   .0081741   -18.00   0.000    -.1631759   -.1311301
        AfricanA |   .0974043   .0028607    34.05   0.000     .0917968    .1030118
         NativeA |   .0792675   .0044013    18.01   0.000       .07064    .0878949
          AsianA |  -.3008478   .0389516    -7.72   0.000    -.3772008   -.2244948
       HispanicA |   .0044405   .0028539     1.56   0.120    -.0011538    .0100347
          Ln_Pop |   .0282906   .0365977     0.77   0.440    -.0434485    .1000297
             Pov |   .0124562   .0061536     2.02   0.043     .0003938    .0245186
             FSI |   .0122276   .0067539     1.81   0.070    -.0010113    .0254666
           dumt2 |   .1129401   .0766705     1.47   0.141    -.0373498      .26323
           dumt3 |   .5356621   .0798241     6.71   0.000     .3791906    .6921336
           dumt4 |   1.120177   .0824697    13.58   0.000     .9585197    1.281835
           dumt5 |   1.428756   .0884824    16.15   0.000     1.255313      1.6022
           dumt6 |   2.084956   .1041754    20.01   0.000     1.880751    2.289161
         dumtst1 |  -2.301074   1.212767    -1.90   0.058    -4.678345     .076197
         dumtst2 |          0  (omitted)
         dumtst3 |  -4.682929   1.249387    -3.75   0.000    -7.131982   -2.233876
         dumtst4 |  -2.663434   1.203714    -2.21   0.027    -5.022959   -.3039082
         dumtst5 |  -6.043856   1.187723    -5.09   0.000    -8.372036   -3.715676
         dumtst6 |   -10.3035   1.210718    -8.51   0.000    -12.67675   -7.930241
         dumtst7 |  -8.346763    1.48672    -5.61   0.000    -11.26104   -5.432489
         dumtst8 |  -2.567838   1.213167    -2.12   0.034    -4.945893   -.1897823
         dumtst9 |  -5.157617   1.200839    -4.30   0.000    -7.511508   -2.803727
        dumtst10 |          0  (omitted)
        dumtst11 |  -4.128245   1.207748    -3.42   0.001    -6.495679   -1.760811
        dumtst12 |  -3.598398   1.203918    -2.99   0.003    -5.958325   -1.238472
        dumtst13 |  -2.194015   1.209193    -1.81   0.070    -4.564281     .176251
        dumtst14 |  -1.706496    1.19357    -1.43   0.153    -4.046137    .6331458
        dumtst15 |  -.5360579   1.196557    -0.45   0.654    -2.881553    1.809437
        dumtst16 |  -1.968943   1.209388    -1.63   0.104    -4.339591     .401705
        dumtst17 |  -2.396011   1.220001    -1.96   0.050    -4.787462     -.00456
        dumtst18 |  -2.573323    1.22882    -2.09   0.036    -4.982061   -.1645854
        dumtst19 |  -3.247927   1.253463    -2.59   0.010    -5.704971   -.7908824
        dumtst20 |  -8.679261   1.304115    -6.66   0.000    -11.23559   -6.122928
        dumtst21 |  -.4645406   1.203306    -0.39   0.699    -2.823267    1.894186
        dumtst22 |  -2.608897   1.193061    -2.19   0.029     -4.94754   -.2702544
        dumtst23 |  -3.512423   1.213943    -2.89   0.004    -5.891999   -1.132846
        dumtst24 |  -2.515525   1.202097    -2.09   0.036     -4.87188   -.1591703
        dumtst25 |   -6.67561   1.206563    -5.53   0.000    -9.040719   -4.310501
        dumtst26 |  -2.441683   1.204631    -2.03   0.043    -4.803006   -.0803602
        dumtst27 |   -4.44801   1.206213    -3.69   0.000    -6.812435   -2.083586
        dumtst28 |  -3.819311   1.232831    -3.10   0.002    -6.235913    -1.40271
        dumtst29 |  -7.183298   1.209644    -5.94   0.000    -9.554449   -4.812148
        dumtst30 |  -4.458591   1.208229    -3.69   0.000    -6.826968   -2.090214
        dumtst31 |   -4.67003   1.201636    -3.89   0.000    -7.025482   -2.314578
        dumtst32 |  -2.487525   1.210331    -2.06   0.040    -4.860022   -.1150277
        dumtst33 |  -2.122199   1.210159    -1.75   0.080    -4.494358    .2499591
        dumtst34 |  -3.141755   1.202074    -2.61   0.009    -5.498065   -.7854448
        dumtst35 |  -2.428995   1.205262    -2.02   0.044    -4.791554   -.0664363
        dumtst36 |  -1.694886   1.213153    -1.40   0.162    -4.072915    .6831429
        dumtst37 |  -2.113261   1.221135    -1.73   0.084    -4.506935    .2804144
        dumtst38 |  -2.224742   1.202957    -1.85   0.064    -4.582785    .1333002
        dumtst39 |  -3.422371   1.205625    -2.84   0.005    -5.785643     -1.0591
        dumtst40 |  -4.321752    1.20425    -3.59   0.000    -6.682329   -1.961176
        dumtst41 |  -6.784274   1.221157    -5.56   0.000    -9.177991   -4.390557
        dumtst42 |  -5.224776   1.229687    -4.25   0.000    -7.635215   -2.814338
        dumtst43 |  -3.912981   1.209416    -3.24   0.001    -6.283683   -1.542279
        dumtst44 |  -1.611378   1.178494    -1.37   0.172    -3.921467    .6987103
        dumtst45 |  -1.238978   1.213714    -1.02   0.307    -3.618105    1.140148
        dumtst46 |  -1.476022   1.203195    -1.23   0.220    -3.834531    .8824867
        dumtst47 |  -6.825201   1.217414    -5.61   0.000     -9.21158   -4.438821
           _cons |   26.94015   1.469827    18.33   0.000     24.05899    29.82131
    ------------------------------------------------------------------------------
    
    .
    The "dumt"s are time dummies.
    Last edited by Yancheng Li; 21 Jul 2020, 15:42.

    Comment


    • #3
      Is there a question here, or are you just reporting on this great success?

      Comment


      • #4
        Dear Kolev.

        May I ask, in this case, how would I test for heteroscedasticity and autocorrelation? I don't think the xttest3 and xtserial will still work in this case.

        Thank you!

        Comment


        • #5
          For example, I think if I just apply xttest3, Stata will test for county-level heteroscedasticity...but I want to test for state-level heteroscedasticity

          Comment


          • #6
            Hi Yancheng, I cannot see how adding a couple of dummy variables can invalidate the heteroskedasticity and autocorrelation tests you are carrying out. Also nowadays with these huge panels nobody is doing heteroskedasticity and autocorrelation tests anymore, you can make your inference robust to those two by , robust cluster(county)

            However you did not explain your data well at all.

            1. What is the unit of observation? Is it the county, or is it the individual?

            2. What do you call "1,809 panels", are these counties?

            3. Are the counties nested within the states?

            I think something wrong is going on there, because if counties are your panels, you should not be able to include state dummies on the top of the county dummies--they would be perfectly collinear with the county dummies.

            Comment


            • #7
              Heteroskedasticity is not a level phenomenon. It is a relationship between the variance of the error term and the regressors. So you do not have a problem here for sure.

              Correlation is different, indeed the test for correlation in the error would change depending on how you define the set where you are looking for correlation.

              Again both of these problems can be dealt with by , robust cluster(some_level).

              Example given if you think that errors are correlated at county level but uncorrelated for different counties, you do

              regression command, robust cluster(county)

              If you think that errors are correlated across counties and within states, but uncorrelated across states, you do

              regression command, robust cluster(state)


              Originally posted by Yancheng Li View Post
              For example, I think if I just apply xttest3, Stata will test for county-level heteroscedasticity...but I want to test for state-level heteroscedasticity

              Comment


              • #8
                Hi Joro,

                I modified the first post and made some clarifications, and yes, counties are nested within the states.

                Counties are my panels. But I didn't include county dummies. I tried including county dummies, and the results are not so satisfying.
                I think maybe the assumption that the intercept for each county are different is too strong. So, by inserting state dummies, I can have state-level intercept rather than county level intercepts.

                Comment


                • #9
                  Originally posted by Joro Kolev View Post
                  Heteroskedasticity is not a level phenomenon. It is a relationship between the variance of the error term and the regressors. So you do not have a problem here for sure.

                  Correlation is different, indeed the test for correlation in the error would change depending on how you define the set where you are looking for correlation.

                  Again both of these problems can be dealt with by , robust cluster(some_level).

                  Example given if you think that errors are correlated at county level but uncorrelated for different counties, you do

                  regression command, robust cluster(county)

                  If you think that errors are correlated across counties and within states, but uncorrelated across states, you do

                  regression command, robust cluster(state)



                  Hi Joro,

                  Ok. Thank you so much for your clarification. I think I get some clues now. I think I can understand your approach, but do you mind to explain how I can 'test' if there exist autocorrelation at county level or at state level?

                  Thank you!

                  Comment


                  • #10
                    Yancheng: Joro is recommending that you don't even test for autocorrelation or heteroskedasticity, and I concur. You can compute fully robust standard errors and you have plenty of counties so that clustering will produce good results. But you should at least use a robust Hausman test to provide support for not using fixed effects at the county level, as many researchers would (and should) be skeptical. You should set the id variable at the county level, not the state level. I won't use your globals but show you genererically.

                    Code:
                    xtset countyid year
                    xtreg y x1 ... xK i.FIPS i.year, re vce(cluster countyid)
                    xtoverid
                    The xtreg command allows state intercepts and assumes the county effects are uncorrelated with the explanatory variables. The xtoverid command (user written and needs to be installed) compares fixed effects at the county level with random effects, and you hope to not reject. If you do reject, it is saying you should really control for county-
                    level fixed effects. If you don't "like" the results, well, that's just the way it goes. You can try using different variables.

                    JW

                    Comment


                    • #11
                      Yancheng:
                      just an aside to previous helpful comments.
                      Being a bit old-fashioned, the glorious community-contributed command -xtoverid- does not support -fvvarlist- notation; hence, you have to prefix your -xtreg- code with -xi:-.
                      Elaborating a bit on Jeff's code:
                      Code:
                      xtset countyid year
                      xi: xtreg y x1 ... xK i.FIPS i.year, re vce(cluster countyid)
                      xtoverid
                      Kind regards,
                      Carlo
                      (Stata 19.0)

                      Comment


                      • #12
                        Thanks Carlo. I always forget that about the older, user-written commands.

                        Comment


                        • #13
                          Jeff:
                          at least there's something that you're allowed to forget in econometrics!
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            Originally posted by Jeff Wooldridge View Post
                            Yancheng: Joro is recommending that you don't even test for autocorrelation or heteroskedasticity, and I concur. You can compute fully robust standard errors and you have plenty of counties so that clustering will produce good results. But you should at least use a robust Hausman test to provide support for not using fixed effects at the county level, as many researchers would (and should) be skeptical. You should set the id variable at the county level, not the state level. I won't use your globals but show you genererically.

                            Code:
                            xtset countyid year
                            xtreg y x1 ... xK i.FIPS i.year, re vce(cluster countyid)
                            xtoverid
                            The xtreg command allows state intercepts and assumes the county effects are uncorrelated with the explanatory variables. The xtoverid command (user written and needs to be installed) compares fixed effects at the county level with random effects, and you hope to not reject. If you do reject, it is saying you should really control for county-
                            level fixed effects. If you don't "like" the results, well, that's just the way it goes. You can try using different variables.

                            JW
                            Dr. Wooldridge,

                            Thank you very much for the clarification! I will definitely try the method you suggested!
                            There is just one thing I want to make sure; that is, the "FIPS" I use is a county-level id...I'm very sorry I didn't clarify that.So, when writing this line of code:

                            Code:
                            xtreg y x1 ... xK i.FIPS i.year, re vce(cluster countyid)
                            I think what you suggest is to insert "i.stateid", is that correct? Or did I misunderstand anything?...
                            Thank you again for your time!


                            Best regards,
                            Yancheng
                            Last edited by Yancheng Li; 22 Jul 2020, 11:43.

                            Comment


                            • #15
                              Originally posted by Carlo Lazzaro View Post
                              Yancheng:
                              just an aside to previous helpful comments.
                              Being a bit old-fashioned, the glorious community-contributed command -xtoverid- does not support -fvvarlist- notation; hence, you have to prefix your -xtreg- code with -xi:-.
                              Elaborating a bit on Jeff's code:
                              Code:
                              xtset countyid year
                              xi: xtreg y x1 ... xK i.FIPS i.year, re vce(cluster countyid)
                              xtoverid
                              Dr. Lazzaro,

                              Thank you for the complement!

                              Best regards,
                              Yancheng

                              Comment

                              Working...
                              X