Announcement

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

  • #16
    Hi Carlo Lazzaro, I have to deal with cross-sectional dependence and also endogeneity issue. I was trying to apply DK Standard Error with Instrumental Variable, but not successful yet. Could you please suggest me the method and stata command to handle these two issues?

    Many thanks,
    Abdul

    Comment


    • #17
      Abdul:
      as per FAQ, please post what you typed and what Stata gave you back. Thanks.
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #18
        Hi Carlo Lazzaro, thank you very much for responding to my question and sorry for the delayed response as I didn't receive any notification.

        I use Stata 18 to run a DID fixed effects regression model with panel data to estimate the effects of various variables on average fare variable "LnFare". To address the endogeneity issue, I use 2SLS using two instrumental variable (IV) "lnpop" and "lntrade" for the endogenous independent variable "LnPax". Here is the code that I use:

        Code:
        . xtivreg lnfare (lnpax = lnpop lntrade) asam totalcarriers desigcarriers fscper lngdp countryfuel atii i.year, fe vce(ro
        > bust)
        
        Fixed-effects (within) IV regression            Number of obs     =      5,032
        Group variable: routeid                         Number of groups  =        629
        
        R-squared:                                      Obs per group:
             Within  =      .                                         min =          8
             Between = 0.0121                                         avg =        8.0
             Overall = 0.0015                                         max =          8
        
        
                                                        Wald chi2(15)     =   33619.84
        corr(u_i, Xb) = -0.6653                         Prob > chi2       =     0.0000
        
                                       (Std. err. adjusted for 629 clusters in routeid)
        -------------------------------------------------------------------------------
                      |               Robust
               lnfare | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
        --------------+----------------------------------------------------------------
                lnpax |   .5087595    .322941     1.58   0.115    -.1241932    1.141712
                 asam |  -.0898262   .0396187    -2.27   0.023    -.1674775   -.0121749
        totalcarriers |  -.0583593    .031977    -1.83   0.068     -.121033    .0043143
        desigcarriers |  -.0613801   .0325806    -1.88   0.060     -.125237    .0024767
               fscper |   .0023645   .0011204     2.11   0.035     .0001686    .0045604
                lngdp |  -.2661736   .1708156    -1.56   0.119    -.6009659    .0686188
          countryfuel |  -.1371823   .0428347    -3.20   0.001    -.2211367   -.0532279
                 atii |  -.0119196   .0058801    -2.03   0.043    -.0234443   -.0003948
                      |
                 year |
                2013  |  -.1701968   .0547684    -3.11   0.002    -.2775408   -.0628527
                2014  |  -.2884796   .0704503    -4.09   0.000    -.4265597   -.1503994
                2015  |  -.5909791   .1349744    -4.38   0.000    -.8555241   -.3264342
                2016  |  -.6658244   .1440267    -4.62   0.000    -.9481116   -.3835373
                2017  |   -.631819   .1415059    -4.46   0.000    -.9091655   -.3544725
                2018  |  -.5676029   .1322243    -4.29   0.000    -.8267579    -.308448
                2019  |  -.6477493    .137719    -4.70   0.000    -.9176736    -.377825
                      |
                _cons |   3.165659   2.092094     1.51   0.130    -.9347709    7.266089
        --------------+----------------------------------------------------------------
              sigma_u |  .68559818
              sigma_e |  .24511511
                  rho |  .88666584   (fraction of variance due to u_i)
        -------------------------------------------------------------------------------
        Endogenous: lnpax
        Exogenous:  asam totalcarriers desigcarriers fscper lngdp countryfuel atii
                    2013.year 2014.year 2015.year 2016.year 2017.year 2018.year
                    2019.year lnpop lntrade
        
        . 
        end of do-file
        Due to the presence of cross-sectional dependence, I am addressing this issue using Driscoll and Kraay standard errors. Therefore, I want to combine the instrumental variable with DK standard error.
        I am using the following code to combine those two models:

        Code:
        . xtscc lnfare (lnpax = lnpop lntrade) asam totalcarriers desigcarriers fscper lngdp countryfuel atii i.year, fe lag(7)
        parentheses unbalanced
        r(132);
        
        end of do-file
        I assume that -xtscc- does not support 2SLS directly. I am trying to solve the problem by using the fitted value of the endogeneous variable "LnPax" using the following code:

        Code:
        . reg lnpax lnpop lntrade
        
              Source |       SS           df       MS      Number of obs   =     5,032
        -------------+----------------------------------   F(2, 5029)      =    398.67
               Model |  1028.50044         2  514.250218   Prob > F        =    0.0000
            Residual |  6487.01765     5,029  1.28992198   R-squared       =    0.1369
        -------------+----------------------------------   Adj R-squared   =    0.1365
               Total |  7515.51809     5,031   1.4938418   Root MSE        =    1.1357
        
        ------------------------------------------------------------------------------
               lnpax | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
               lnpop |   .2790867    .027533    10.14   0.000       .22511    .3330634
             lntrade |   .1553236   .0083099    18.69   0.000     .1390326    .1716145
               _cons |   5.081224   .4201694    12.09   0.000     4.257509    5.904939
        ------------------------------------------------------------------------------
        
        . 
        . predict lnpax_hat, xb
        
        . 
        . xtscc lnfare lnpax_hat asam  totalcarriers desigcarriers fscper lngdp countryfuel atii ttci i.year, fe lag(7)
        
        Regression with Driscoll-Kraay standard errors   Number of obs     =      5032
        Method: Fixed-effects regression                 Number of groups  =       629
        Group variable (i): routeid                      F( 16,     7)     =  11181.27
        maximum lag: 7                                   Prob > F          =    0.0000
                                                         within R-squared  =    0.3708
        
        -------------------------------------------------------------------------------
                      |             Drisc/Kraay
               lnfare | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        --------------+----------------------------------------------------------------
            lnpax_hat |   .3538949   .0937294     3.78   0.007       .13226    .5755298
                 asam |  -.0406039   .0062793    -6.47   0.000     -.055452   -.0257557
        totalcarriers |  -.0115533   .0045423    -2.54   0.038    -.0222942   -.0008125
        desigcarriers |  -.0203208    .002651    -7.67   0.000    -.0265895   -.0140521
               fscper |   .0006812   .0001883     3.62   0.009     .0002359    .0011266
                lngdp |   -.111765   .0497855    -2.24   0.060    -.2294891    .0059591
          countryfuel |  -.1129794   .0179368    -6.30   0.000    -.1553933   -.0705656
                 atii |  -.0062816    .003112    -2.02   0.083    -.0136403    .0010771
                 ttci |   .1281825   .0313967     4.08   0.005     .0539412    .2024238
                      |
                 year |
                2012  |          0  (empty)
                2013  |   -.085067   .0021041   -40.43   0.000    -.0900425   -.0800916
                2014  |  -.1569831   .0072683   -21.60   0.000    -.1741699   -.1397963
                2015  |  -.3878346    .029912   -12.97   0.000    -.4585653    -.317104
                2016  |  -.4711428   .0368914   -12.77   0.000    -.5583772   -.3839084
                2017  |  -.4301512    .031408   -13.70   0.000    -.5044193   -.3558831
                2018  |   -.379408   .0225107   -16.85   0.000    -.4326374   -.3261787
                2019  |  -.4560955   .0254834   -17.90   0.000    -.5163543   -.3958368
                      |
                _cons |   2.484622   .9346575     2.66   0.033      .274508    4.694735
        -------------------------------------------------------------------------------
        
        
        . 
        end of do-file
        I am not confident at all with stages that I followed and I would like to ask your advice on:

        1. Can Stata address endogeneity and cross-sectional dependence issues together in one model?
        2. How to combine 2SLS IV with DK standard errors to handle the issues of endogeneity, cross-sectional dependence, heteroskedasticity, and autocorrelation?

        Thank you very much.

        Best,
        Abdul

        Comment


        • #19
          Abdul:
          see if JanDitzen 's -xtdcce2- module can help you out.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #20
            I would be careful mixing the CCE estimator with IV regressions. See also my post here

            Comment


            • #21
              Jan:
              I knew you posted on that, but was not able to recall the thread!
              Thanks for chiming in.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment

              Working...
              X