Announcement

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

  • Fixed effect with ivregress or ivreg2 command.

    Quick question, is it true that in order to use fixed effect with ivregress or ivreg2, I can ONLY put dummy variables into my main equation?
    Because I must use
    Code:
     weakivtest
    which is a postestimation command ONLY with either ivregress or ivreg2.
    But I have more than 3k groups. Does that mean there is no way to put cross-section fixed effect with the two commands?
    I have tried to modify
    Code:
     set maxvar
    and
    Code:
     set matsize
    , none of them worked.

  • #2
    Xiaoke:
    in order to use -fvvarlist- notation with the user-written programme -ivreg2-, you should prefix your code with -xi:-:
    Code:
    . webuse hsng2
    . ivregress 2sls rent pcturban (hsngval = faminc i.region)
    
    Instrumental variables (2SLS) regression          Number of obs   =         50
                                                      Wald chi2(2)    =      90.76
                                                      Prob > chi2     =     0.0000
                                                      R-squared       =     0.5989
                                                      Root MSE        =     22.166
    
    ------------------------------------------------------------------------------
            rent |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         hsngval |   .0022398   .0003284     6.82   0.000     .0015961    .0028836
        pcturban |    .081516   .2987652     0.27   0.785     -.504053     .667085
           _cons |   120.7065   15.22839     7.93   0.000     90.85942    150.5536
    ------------------------------------------------------------------------------
    Instrumented:  hsngval
    Instruments:   pcturban faminc 2.region 3.region 4.region
    
    . xi: ivreg2 rent pcturban (hsngval  = faminc i.region)
    i.region          _Iregion_1-4        (naturally coded; _Iregion_1 omitted)
    
    IV (2SLS) estimation
    --------------------
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =       50
                                                          F(  2,    47) =    42.66
                                                          Prob > F      =   0.0000
    Total (centered) SS     =     61243.12                Centered R2   =   0.5989
    Total (uncentered) SS   =      2816856                Uncentered R2 =   0.9913
    Residual SS             =  24565.71669                Root MSE      =    22.17
    
    ------------------------------------------------------------------------------
            rent |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         hsngval |   .0022398   .0003284     6.82   0.000     .0015961    .0028836
        pcturban |    .081516   .2987652     0.27   0.785     -.504053     .667085
           _cons |   120.7065   15.22839     7.93   0.000     90.85942    150.5536
    ------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):          27.364
                                                       Chi-sq(4) P-val =    0.0000
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):               13.298
    Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.85
                                             10% maximal IV relative bias    10.27
                                             20% maximal IV relative bias     6.71
                                             30% maximal IV relative bias     5.34
                                             10% maximal IV size             24.58
                                             15% maximal IV size             13.96
                                             20% maximal IV size             10.26
                                             25% maximal IV size              8.31
    Source: Stock-Yogo (2005).  Reproduced by permission.
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):          11.288
                                                       Chi-sq(3) P-val =    0.0103
    ------------------------------------------------------------------------------
    Instrumented:         hsngval
    Included instruments: pcturban
    Excluded instruments: faminc _Iregion_2 _Iregion_3 _Iregion_4
    ------------------------------------------------------------------------------
    
    . weakivtest
    (obs=50)
    
    Montiel-Pflueger robust weak instrument test
    --------------------------------------------
    Effective F statistic:       13.298
    Confidence level alpha:          5%
    --------------------------------------------
    
    --------------------------------------------
    Critical Values             TSLS      LIML
    --------------------------------------------
    % of Worst Case Bias
    tau=5%                    16.720    10.231
    tau=10%                   10.231     6.701
    tau=20%                    6.701     4.749
    tau=30%                    5.421     4.035
    --------------------------------------------
    
    .
    Never heard about 3000 dummies to be included in a regression model: can't you go for a more parsimonious model?
    As an aside, as per FAQ, please note that you're requested (for good reasons) to report the source where non-official Stata commands come from. Thanks.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Xiaoke:
      in order to use -fvvarlist- notation with the user-written programme -ivreg2-, you should prefix your code with -xi:-:
      Code:
      . webuse hsng2
      . ivregress 2sls rent pcturban (hsngval = faminc i.region)
      
      Instrumental variables (2SLS) regression Number of obs = 50
      Wald chi2(2) = 90.76
      Prob > chi2 = 0.0000
      R-squared = 0.5989
      Root MSE = 22.166
      
      ------------------------------------------------------------------------------
      rent | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      hsngval | .0022398 .0003284 6.82 0.000 .0015961 .0028836
      pcturban | .081516 .2987652 0.27 0.785 -.504053 .667085
      _cons | 120.7065 15.22839 7.93 0.000 90.85942 150.5536
      ------------------------------------------------------------------------------
      Instrumented: hsngval
      Instruments: pcturban faminc 2.region 3.region 4.region
      
      . xi: ivreg2 rent pcturban (hsngval = faminc i.region)
      i.region _Iregion_1-4 (naturally coded; _Iregion_1 omitted)
      
      IV (2SLS) estimation
      --------------------
      
      Estimates efficient for homoskedasticity only
      Statistics consistent for homoskedasticity only
      
      Number of obs = 50
      F( 2, 47) = 42.66
      Prob > F = 0.0000
      Total (centered) SS = 61243.12 Centered R2 = 0.5989
      Total (uncentered) SS = 2816856 Uncentered R2 = 0.9913
      Residual SS = 24565.71669 Root MSE = 22.17
      
      ------------------------------------------------------------------------------
      rent | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      hsngval | .0022398 .0003284 6.82 0.000 .0015961 .0028836
      pcturban | .081516 .2987652 0.27 0.785 -.504053 .667085
      _cons | 120.7065 15.22839 7.93 0.000 90.85942 150.5536
      ------------------------------------------------------------------------------
      Underidentification test (Anderson canon. corr. LM statistic): 27.364
      Chi-sq(4) P-val = 0.0000
      ------------------------------------------------------------------------------
      Weak identification test (Cragg-Donald Wald F statistic): 13.298
      Stock-Yogo weak ID test critical values: 5% maximal IV relative bias 16.85
      10% maximal IV relative bias 10.27
      20% maximal IV relative bias 6.71
      30% maximal IV relative bias 5.34
      10% maximal IV size 24.58
      15% maximal IV size 13.96
      20% maximal IV size 10.26
      25% maximal IV size 8.31
      Source: Stock-Yogo (2005). Reproduced by permission.
      ------------------------------------------------------------------------------
      Sargan statistic (overidentification test of all instruments): 11.288
      Chi-sq(3) P-val = 0.0103
      ------------------------------------------------------------------------------
      Instrumented: hsngval
      Included instruments: pcturban
      Excluded instruments: faminc _Iregion_2 _Iregion_3 _Iregion_4
      ------------------------------------------------------------------------------
      
      . weakivtest
      (obs=50)
      
      Montiel-Pflueger robust weak instrument test
      --------------------------------------------
      Effective F statistic: 13.298
      Confidence level alpha: 5%
      --------------------------------------------
      
      --------------------------------------------
      Critical Values TSLS LIML
      --------------------------------------------
      % of Worst Case Bias
      tau=5% 16.720 10.231
      tau=10% 10.231 6.701
      tau=20% 6.701 4.749
      tau=30% 5.421 4.035
      --------------------------------------------
      
      .
      Never heard about 3000 dummies to be included in a regression model: can't you go for a more parsimonious model?
      As an aside, as per FAQ, please note that you're requested (for good reasons) to report the source where non-official Stata commands come from. Thanks.
      Dear Mr Lazzaro

      Thanks for your help and I appreciate it. However, I am still confused, with
      Code:
       xi:ivreg2
      , can I simply use an option such as "fe" to include fixed effect at cross-section dimension?
      My command is the following:
      Code:
       xi: ivreg2 cta lntotal_assets lntotal_assetsquar cfta LnNoE  salegrowth leverage PriGdp markcapGdp Growth (chinapeindDE = chinapeindGR) i.year  i.bvid1, first vce(cluster nace)
      As you can see, I tried to use two-way fixed effect at both time and cross-section level. However, I have more than 3000 groups, if I simply use i.bvid1 to create a dummy for each groups, it is not very feasible.
      In other words, can I still include fixed effect with cross-section group without using dummy variable approach with xi:ivreg2
      Last edited by Xiaoke Ye; 07 Feb 2019, 02:37.

      Comment


      • #4
        Hi Carlos,

        This may be a dumb question but I was wondering when this command: ivregress 2sls rent pcturban (hsngval = faminc i.region)

        is implemented, does that take into account that the fixed effects (i.region) are included in both stages? If not what would be the command to include FE in both stages.

        I appreciate an answer. Thank you.

        Anil

        Comment


        • #5
          Anil:
          you cannot iobtain coefficient for -i.region- in both stages of 2SLS if this regressor is an instrument:
          Code:
          use https://www.stata-press.com/data/r16/hsng
          . ivregress 2sls rent pcturban (hsngval = faminc i.region), first
          
          First-stage regressions
          -----------------------
          
                                                          Number of obs     =         50
                                                          F(   5,     44)   =      19.66
                                                          Prob > F          =     0.0000
                                                          R-squared         =     0.6908
                                                          Adj R-squared     =     0.6557
                                                          Root MSE          =  9253.4821
          
          ------------------------------------------------------------------------------
               hsngval |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
              pcturban |   182.2201   115.0167     1.58   0.120    -49.58092    414.0211
                faminc |   2.731324   .6818931     4.01   0.000     1.357058    4.105589
                       |
                region |
              N Cntrl  |  -5095.038   4122.112    -1.24   0.223    -13402.61    3212.533
                South  |   -1778.05   4072.691    -0.44   0.665    -9986.019    6429.919
                 West  |   13413.79   4048.141     3.31   0.002     5255.296    21572.28
                       |
                 _cons |  -18671.87   11995.48    -1.56   0.127    -42847.17    5503.439
          ------------------------------------------------------------------------------
          
          
          Instrumental variables (2SLS) regression          Number of obs   =         50
                                                            Wald chi2(2)    =      90.76
                                                            Prob > chi2     =     0.0000
                                                            R-squared       =     0.5989
                                                            Root MSE        =     22.166
          
          ------------------------------------------------------------------------------
                  rent |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
               hsngval |   .0022398   .0003284     6.82   0.000     .0015961    .0028836
              pcturban |    .081516   .2987652     0.27   0.785     -.504053     .667085
                 _cons |   120.7065   15.22839     7.93   0.000     90.85942    150.5536
          ------------------------------------------------------------------------------
          Instrumented:  hsngval
          Instruments:   pcturban faminc 2.region 3.region 4.region
          .
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            Thank you, Carlos. If I do the following instead : vregress 2sls rent pcturban (hsngval = faminc) i.region, first

            I can recover fixed regions effects but the coefficient of the instrumented changes (bigger). In my specific case, the size of the coefficient becomes outrageously large. I was wondering your insight on this. Thanks.

            ivregress 2sls rent pcturban (hsngval = faminc) i.region, first

            First-stage regressions
            -----------------------

            Number of obs = 50
            F( 5, 44) = 19.66
            Prob > F = 0.0000
            R-squared = 0.6908
            Adj R-squared = 0.6557
            Root MSE = 9253.4821

            ------------------------------------------------------------------------------
            hsngval | Coef. Std. Err. t P>|t| [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            pcturban | 182.2201 115.0167 1.58 0.120 -49.58092 414.0211
            |
            region |
            N Cntrl | -5095.038 4122.112 -1.24 0.223 -13402.61 3212.533
            South | -1778.05 4072.691 -0.44 0.665 -9986.019 6429.919
            West | 13413.79 4048.141 3.31 0.002 5255.296 21572.28
            |
            faminc | 2.731324 .6818931 4.01 0.000 1.357058 4.105589
            _cons | -18671.87 11995.48 -1.56 0.127 -42847.17 5503.439
            ------------------------------------------------------------------------------


            Instrumental variables (2SLS) regression Number of obs = 50
            Wald chi2(5) = 51.68
            Prob > chi2 = 0.0000
            R-squared = 0.2079
            Root MSE = 31.147

            ------------------------------------------------------------------------------
            rent | Coef. Std. Err. z P>|z| [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            hsngval | .0038683 .0008403 4.60 0.000 .0022212 .0055153
            pcturban | -.4980121 .4859064 -1.02 0.305 -1.450371 .4543469
            |
            region |
            N Cntrl | 1.528672 14.20338 0.11 0.914 -26.30944 29.36679
            South | 7.74279 14.17355 0.55 0.585 -20.03686 35.52244
            West | -40.61235 18.3958 -2.21 0.027 -76.66746 -4.557233
            |
            _cons | 88.26681 29.7293 2.97 0.003 29.99845 146.5352
            ------------------------------------------------------------------------------
            Instrumented: hsngval
            Instruments: pcturban 2.region 3.region 4.region faminc

            Comment

            Working...
            X