Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: omitted constant with ivregress 2sls but not with ivregress gmm or ivreg


From   pablo martinelli <pab.martinelli@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: omitted constant with ivregress 2sls but not with ivregress gmm or ivreg
Date   Wed, 30 Oct 2013 20:28:36 +0100

related to scaling. It was indeed the scaling I tried. I was focusing
on rescaling some variables but missed another ones (squared monthly
rains). After rescaling, I get with ivregress the original results
obtained with ivreg (with coefficients rescaled), keeping the
constant. Thus, the bug is bypassed either with gmm or with the
orginal ivreg.
Still, "ivregress 2sls" yields an F-statistic in the second stage only
after adjusting for small sample size (even if you have a rather large
sample) and if you add the command "robust" both the first and the
second stages are estimated with robust standard errors. Both of these
are absent from the output of ivreg, and I cannot explain such
differences. Any idea?

Anyway, thank you so much, Mark! You helped me a lot in finding what
was going on!

Yours,
Pablo


2013/10/30 Schaffer, Mark E <M.E.Schaffer@hw.ac.uk>:
> Pablo,
>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
>> statalist@hsphsun2.harvard.edu] On Behalf Of pablo martinelli
>> Sent: 30 October 2013 11:47
>> To: statalist@hsphsun2.harvard.edu
>> Subject: Re: st: RE: omitted constant with ivregress 2sls but not with ivregress
>> gmm or ivreg
>>
>> Mark,
>> I tried to post also the results with ivreg and with ivreg2 but for some reason I
>> was unable (even splitting them further). Yes, both ivreg and ivreg2 behave
>> well. Indeed, I get exactly the same results in the 2nd stage with ivregress,
>> gmm, robust and small sample adjustment than with ivreg (though in the first
>> case the standard errors of the first stage are also robust, something that
>> should not be done according to Wooldrige, 2009). This is what lead me to think
>> that ivreg estimated IV through gmm...
>
> No, definitely not - old ivreg is 2SLS aka traditional IV.
>
> I also initially thought it was a problem
>> with scaling, but rescaling does not fix it (?).
>
> Depends on the rescaling you tried, perhaps...?
>
>> Anyway, in light of what looks like
>> a computationl bug (unlike I am missing something), ivregress seems to be
>> inferior to ivreg (at least under this particular point)...
>
> Internally, ivreg (i.e., regress) is very accurate for the simple estimations that it performs - more accurate than ivregress or ivreg2.  I expect that's because StataCorp invests substantial resources in hard coding it.
>
> --Mark
>
>>
>>
>> Yours,
>> Pablo
>>
>> 2013/10/30 Schaffer, Mark E <M.E.Schaffer@hw.ac.uk>:
>> > Pablo,
>> >
>> > I'll reply to this one.
>> >
>> > My guess is that it's a scaling issue.  I've also seen -ivreg2- and -ivregress-
>> behave differently (including dropping variables) in similar situations.
>> >
>> > You might also want to experiment with the now out-of-date but still working
>> -ivreg-.  It's built on -regress-, and -regress- is pretty good about scaling issues.
>> >
>> > But the cure is probably to scale your variables so that you don't get coeffs
>> ranging across 8 orders of magnitude.
>> >
>> > --Mark
>> >
>> >> -----Original Message-----
>> >> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
>> >> statalist@hsphsun2.harvard.edu] On Behalf Of pablo martinelli
>> >> Sent: 29 October 2013 16:53
>> >> To: statalist@hsphsun2.harvard.edu
>> >> Subject: Re: st: RE: omitted constant with ivregress 2sls but not
>> >> with ivregress gmm or ivreg
>> >>
>> >> Hi everyone again.
>> >>
>> >> No, ivreg2 does not drop the constant.
>> >>
>> >> Yes, sure, Mark. Here are my command lines the results i get. Since I
>> >> have many variables, and tehre is a limit to the message's size we
>> >> can send, I will split them.
>> >>
>> >> First, ivregress.
>> >>
>> >> . ivregress 2sls lnrtw240w tpr eshare avrentp sharecrop tenant
>> >> nonagremp wheatshare wheatyield piemontevalledaosta liguria lombardia
>> >> trentinoaltoadige veneto emilia toscana lazio abruzzi campania pugli
>> >> > e lucania calabria sicilia sardegna avmrain cvavmrain rainwin
>> >> > rainspr rainsum rainaut rainwin2 rainspr2 rainsum2 rainaut2
>> >> > cvrainwin cvrainspr cvrainsum cvrainaut rainintwin rainintspr
>> >> > rainintsum rain intaut cvrainintwin cvrainintspr cvrainintsum
>> >> > cvrainintaut height1 dislivello newslope latitude
>> >> > (LabnewLand3=lnpop31land), first robust
>> >>
>> >> First-stage regressions
>> >> -----------------------
>> >>
>> >>                                                   Number of obs   =        727
>> >>                                                   F(  50,    676) =     368.73
>> >>                                                   Prob > F        =     0.0000
>> >>                                                   R-squared       =     0.9367
>> >>                                                   Adj R-squared   =     0.9320
>> >>                                                   Root MSE        =     0.1811
>> >>
>> >> ------------------------------
>> >> ------------------------------------------------
>> >>              |               Robust
>> >>  LabnewLand3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
>> >> -------------+-------------------------------------------------------
>> >> -------------+---
>> >> -------------+------
>> >>          tpr |  -.0752534    .030686    -2.45   0.014    -.1355048   -.0150021
>> >>       eshare |  -.2042971   .0787484    -2.59   0.010     -.358918   -.0496762
>> >>      avrentp |   2.59e-06   7.47e-06     0.35   0.729    -.0000121    .0000173
>> >>    sharecrop |   .1223223   .0690329     1.77   0.077    -.0132225    .2578671
>> >>       tenant |   .1070509   .1124441     0.95   0.341    -.1137308    .3278327
>> >>    nonagremp |  -.0185542   .0009113   -20.36   0.000    -.0203435   -
>> .0167649
>> >>   wheatshare |   .2611341   .0944493     2.76   0.006     .0756848    .4465834
>> >>   wheatyield |   .0077474   .0026325     2.94   0.003     .0025786    .0129162
>> >> piemonteva~a |   .1687091   .0581959     2.90   0.004     .0544426
>> .2829756
>> >>      liguria |   .1656128   .0810158     2.04   0.041     .0065398    .3246857
>> >>    lombardia |    .051234   .0601551     0.85   0.395    -.0668793    .1693473
>> >> trentinoal~e |   .1392318   .0809547     1.72   0.086     -.019721    .2981846
>> >>       veneto |  -.0195738   .0605925    -0.32   0.747    -.1385459    .0993983
>> >>       emilia |  -.0295481   .0423374    -0.70   0.485    -.1126767    .0535805
>> >>      toscana |   .0268248   .0436844     0.61   0.539    -.0589485    .1125982
>> >>        lazio |   .0405166   .0498447     0.81   0.417    -.0573524    .1383856
>> >>      abruzzi |  -.1850101   .0471699    -3.92   0.000    -.2776273   -.0923929
>> >>     campania |   -.007703   .0852096    -0.09   0.928    -.1750103    .1596043
>> >>       puglie |  -.2555594   .0761643    -3.36   0.001    -.4051065   -.1060124
>> >>      lucania |  -.1024758   .0858727    -1.19   0.233    -.2710851    .0661336
>> >>     calabria |  -.2699014   .0986603    -2.74   0.006    -.4636189    -.076184
>> >>      sicilia |  -.4293593   .1652127    -2.60   0.010     -.753751   -.1049676
>> >>     sardegna |  -.4646977   .0892632    -5.21   0.000    -.6399643   -.2894312
>> >>      avmrain |  -.0081846   .0161084    -0.51   0.612    -.0398132     .023444
>> >>    cvavmrain |   .0811425    .192954     0.42   0.674    -.2977187    .4600036
>> >>      rainwin |   .0013707    .001745     0.79   0.432    -.0020556     .004797
>> >>      rainspr |  -.0015337   .0015158    -1.01   0.312      -.00451    .0014426
>> >>      rainsum |    .001587   .0014179     1.12   0.263    -.0011969     .004371
>> >>      rainaut |   .0022904   .0014189     1.61   0.107    -.0004955    .0050763
>> >>     rainwin2 |   1.97e-07   8.11e-07     0.24   0.808    -1.40e-06    1.79e-06
>> >>     rainspr2 |   1.39e-06   5.14e-07     2.71   0.007     3.83e-07    2.40e-06
>> >>     rainsum2 |  -2.37e-07   6.17e-07    -0.38   0.701    -1.45e-06    9.75e-07
>> >>     rainaut2 |  -2.03e-06   8.34e-07    -2.43   0.015    -3.67e-06   -3.93e-07
>> >>    cvrainwin |  -.1337135   .0910987    -1.47   0.143    -.3125838    .0451569
>> >>    cvrainspr |  -.0919449   .1411574    -0.65   0.515    -.3691047    .1852148
>> >>    cvrainsum |   .0620552   .0583617     1.06   0.288    -.0525368    .1766472
>> >>    cvrainaut |  -.0228216   .1275591    -0.18   0.858    -.2732812     .227638
>> >>   rainintwin |  -.0038742     .01052    -0.37   0.713      -.02453    .0167816
>> >>   rainintspr |    .025346   .0082647     3.07   0.002     .0091184    .0415735
>> >>   rainintsum |  -.0158319   .0053415    -2.96   0.003    -.0263199   -.0053438
>> >>   rainintaut |  -.0026335    .008307    -0.32   0.751    -.0189442    .0136772
>> >> cvrainintwin |   .1142515   .1082358     1.06   0.292    -.0982673    .3267703
>> >> cvrainintspr |  -.1338668    .071614    -1.87   0.062    -.2744795    .0067459
>> >> cvrainintsum |  -.0174779   .0458837    -0.38   0.703    -.1075696    .0726138
>> >> cvrainintaut |   -.047752   .0917345    -0.52   0.603    -.2278708    .1323668
>> >>      height1 |  -.0000976   .0000593    -1.65   0.100    -.0002141    .0000189
>> >>   dislivello |  -.0001469   .0001313    -1.12   0.263    -.0004047    .0001108
>> >>     newslope |   36.73272   10.35384     3.55   0.000     16.40318    57.06227
>> >>     latitude |   .0000167   .0002471     0.07   0.946    -.0004684    .0005018
>> >>  lnpop31land |   .8216411   .0354665    23.17   0.000     .7520034    .8912789
>> >>        _cons |  -.5036778     1.1633    -0.43   0.665    -2.787793    1.780437
>> >> ---------------------------------------------------------------------
>> >> ---------
>> >>
>> >>
>> >> Instrumental variables (2SLS) regression               Number of obs =     727
>> >>                                                        Wald chi2(50) =20562.26
>> >>                                                        Prob > chi2   =  0.0000
>> >>                                                        R-squared     =  0.8932
>> >>                                                        Root MSE      =  .32042
>> >>
>> >> ------------------------------------------------------------------------------
>> >>              |               Robust
>> >>    lnrtw240w |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
>> >> -------------+-------------------------------------------------------
>> >> -------------+---
>> >> -------------+------
>> >>  LabnewLand3 |   .7267861   .0450934    16.12   0.000     .6384046
>> .8151675
>> >>          tpr |   .1458045    .032423     4.50   0.000     .0822565    .2093525
>> >>       eshare |  -.5817712   .1438029    -4.05   0.000    -.8636196   -.2999228
>> >>      avrentp |   .0001137   .0000132     8.63   0.000     .0000879    .0001395
>> >>    sharecrop |  -.2948938    .115277    -2.56   0.011    -.5208325   -.0689551
>> >>       tenant |  -.0748224   .1830473    -0.41   0.683    -.4335884    .2839437
>> >>    nonagremp |   .0045094   .0009825     4.59   0.000     .0025837    .0064351
>> >>   wheatshare |    .268118   .1990714     1.35   0.178    -.1220547    .6582907
>> >>   wheatyield |   .0150569   .0046811     3.22   0.001      .005882    .0242317
>> >> piemonteva~a |    .457105   .1139754     4.01   0.000     .2337173    .6804928
>> >>      liguria |  -.6659745   .1643922    -4.05   0.000    -.9881773   -.3437717
>> >>    lombardia |   .1699226   .1148089     1.48   0.139    -.0550987    .3949439
>> >> trentinoal~e |   .5750365   .1708428     3.37   0.001     .2401908    .9098822
>> >>       veneto |   .3072996   .1069846     2.87   0.004     .0976137    .5169855
>> >>       emilia |  -.0965144   .0759654    -1.27   0.204    -.2454038     .052375
>> >>      toscana |  -.2014353    .068682    -2.93   0.003    -.3360495   -.0668211
>> >>        lazio |   .1704884   .0814061     2.09   0.036     .0109354    .3300414
>> >>      abruzzi |   .3654339   .0807196     4.53   0.000     .2072264    .5236413
>> >>     campania |     .38231   .1131769     3.38   0.001     .1604874    .6041327
>> >>       puglie |   .6174175   .1138966     5.42   0.000     .3941843    .8406508
>> >>      lucania |   .0233558   .1259724     0.19   0.853    -.2235455    .2702572
>> >>     calabria |   .0643192   .1278942     0.50   0.615    -.1863488    .3149872
>> >>      sicilia |   .0892816   .1851743     0.48   0.630    -.2736534    .4522166
>> >>     sardegna |  -.2924706   .1315056    -2.22   0.026    -.5502168   -.0347244
>> >>      avmrain |    .091309   .0299047     3.05   0.002     .0326968    .1499212
>> >>    cvavmrain |   .0704218   .2632369     0.27   0.789    -.4455132    .5863567
>> >>      rainwin |  -.0085437   .0027881    -3.06   0.002    -.0140082   -.0030791
>> >>      rainspr |  -.0065773   .0028433    -2.31   0.021      -.01215   -.0010046
>> >>      rainsum |  -.0078591   .0027321    -2.88   0.004     -.013214   -.0025043
>> >>      rainaut |  -.0064453   .0027802    -2.32   0.020    -.0118943   -.0009963
>> >>     rainwin2 |   8.42e-07   1.35e-06     0.62   0.534    -1.81e-06    3.50e-06
>> >>     rainspr2 |  -1.64e-06   1.41e-06    -1.17   0.244    -4.40e-06    1.12e-06
>> >>     rainsum2 |  -7.44e-07   1.30e-06    -0.57   0.568    -3.30e-06    1.81e-06
>> >>     rainaut2 |  -1.36e-06   1.39e-06    -0.98   0.328    -4.08e-06    1.36e-06
>> >>    cvrainwin |   .5463342   .1663811     3.28   0.001     .2202332    .8724353
>> >>    cvrainspr |  -.1413404   .1943371    -0.73   0.467    -.5222341    .2395533
>> >>    cvrainsum |  -.0781232   .1270969    -0.61   0.539    -.3272285    .1709822
>> >>    cvrainaut |  -.1209869    .209468    -0.58   0.564    -.5315367    .2895629
>> >>   rainintwin |  -.0434683   .0193887    -2.24   0.025    -.0814695   -.0054672
>> >>   rainintspr |   .0229036   .0185125     1.24   0.216    -.0133803    .0591875
>> >>   rainintsum |     -.0028   .0119597    -0.23   0.815    -.0262406    .0206406
>> >>   rainintaut |   .0026536   .0160065     0.17   0.868    -.0287186    .0340258
>> >> cvrainintwin |  -.1953799   .1654534    -1.18   0.238    -.5196627    .1289029
>> >> cvrainintspr |   .1423667   .1475175     0.97   0.335    -.1467623    .4314956
>> >> cvrainintsum |   .0937196   .0911865     1.03   0.304    -.0850026    .2724418
>> >> cvrainintaut |   -.072203   .1696257    -0.43   0.670    -.4046632    .2602572
>> >>      height1 |   -.000493   .0001032    -4.78   0.000    -.0006953   -.0002908
>> >>   dislivello |  -.0001017     .00021    -0.48   0.628    -.0005132    .0003099
>> >>     newslope |          0   .0039293     0.00   1.000    -.0077012    .0077012
>> >>     latitude |  -.0005574    .000063    -8.85   0.000    -.0006808   -.0004339
>> >>        _cons |  (omitted)
>> >> ---------------------------------------------------------------------
>> >> ---------
>> >> Instrumented:  LabnewLand3
>> >> Instruments:   tpr eshare avrentp sharecrop tenant nonagremp wheatshare
>> >>                wheatyield piemontevalledaosta liguria lombardia
>> >>                trentinoaltoadige veneto emilia toscana lazio abruzzi
>> >>                campania puglie lucania calabria sicilia sardegna avmrain
>> >>                cvavmrain rainwin rainspr rainsum rainaut rainwin2 rainspr2
>> >>                rainsum2 rainaut2 cvrainwin cvrainspr cvrainsum cvrainaut
>> >>                rainintwin rainintspr rainintsum rainintaut cvrainintwin
>> >>                cvrainintspr cvrainintsum cvrainintaut height1 dislivello
>> >>                newslope latitude lnpop31land
>> >>
>> >> I know, scaling might be a problem. In particular, if I multiply all
>> >> the values of the variable newslope for 100 or 1000, I get a
>> >> coefficient that is not 0 and a p- value that is not 1 (though is not
>> >> statistically significant). Everything else, remains the same. So the
>> >> problem is not  lack of variation in newslope, as one may be tempted
>> >> to think having a look at the results just above. However, the
>> >> omission of the variable happens only when the 3 variables height1,
>> >> dislivello and newslope (which are correlated) are entered as regressors,
>> although I am not able to conceptually find the reason for the constant being
>> dropped.
>> >>
>> >> 2013/10/28 Schaffer, Mark E <M.E.Schaffer@hw.ac.uk>:
>> >> > Pablo,
>> >> >
>> >> > You need to give us more details, such as the command lines used.
>> >> > Also, you say
>> >> >
>> >> >> A potential explanation is that the original ivreg code estimated
>> >> >> IV by default with gmm
>> >> >
>> >> > but that's impossible, because Stata's official -ivreg- never
>> >> > implemented
>> >> GMM.
>> >> >
>> >> > Does -ivreg2- with and without -gmm2s- keep or drop the constant?
>> >> >
>> >> > --Mark
>> >> >
>> >> >> -----Original Message-----
>> >> >> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
>> >> >> statalist@hsphsun2.harvard.edu] On Behalf Of pablo martinelli
>> >> >> Sent: 28 October 2013 15:22
>> >> >> To: statalist@hsphsun2.harvard.edu
>> >> >> Subject: st: omitted constant with ivregress 2sls but not with
>> >> >> ivregress gmm or ivreg
>> >> >>
>> >> >> Hi all,
>> >> >> I am having some difficulties for replicating some results I get
>> >> >> in
>> >> >> 2011 with an earlier version of Stata (I think it was Stata 7 but
>> >> >> I am not sure). Now I am using Stata 11.
>> >> >> The problem is the following.
>> >> >> When I use ivregress 2sls, Stata omits the constant, even though
>> >> >> it is not perfectly collinear with any exogenous or endogenous
>> >> >> variables. The coefficients are slightly modified with respect to
>> >> >> the original
>> >> results.
>> >> >> (the problem doesn't happen when I use ols).
>> >> >> If I use ivregress gmm with robust standard errors I get the
>> >> >> original resulst I get in 2011, except for the constant whose
>> >> >> estimated value is somewhat different from the orginal.
>> >> >> F-statistics, R2, etc are also the same. I obtain the same results with
>> either ivreg and ivreg2.
>> >> >> A potential explanation is that the original ivreg code estimated
>> >> >> IV by default with gmm, though I have not been able to find
>> >> >> confirmation of
>> >> this point.
>> >> >> Some of the regressors are certainly correlated, but not perfectly.
>> >> >> Anyway, I cannot figure out why should the constant be ommited
>> >> >> with ivregress 2sls and not with ivregress gmm. What is the
>> >> >> econometric problem here? And why should in that case any of the
>> >> >> two methods (2sls or gmm) preferable to the other?
>> >> >> Any explanation, suggestion or hint would be highly appreciated.
>> >> >> Best,
>> >> >> Pablo Martinelli
>> >> >> *
>> >> >> *   For searches and help try:
>> >> >> *   http://www.stata.com/help.cgi?search
>> >> >> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> >> >> *   http://www.ats.ucla.edu/stat/stata/
>> >> >
>> >> >
>> >> > -----
>> >> > Sunday Times Scottish University of the Year 2011-2013 Top in the
>> >> > UK for student experience Fourth university in the UK and top in
>> >> > Scotland (National Student Survey 2012)
>> >> >
>> >> > We invite research leaders and ambitious early career researchers
>> >> > to join us in leading and driving research in key inter-disciplinary themes.
>> >> > Please see www.hw.ac.uk/researchleaders for further information and
>> >> > how to apply.
>> >> >
>> >> > Heriot-Watt University is a Scottish charity registered under
>> >> > charity number SC000278.
>> >> >
>> >> >
>> >> > *
>> >> > *   For searches and help try:
>> >> > *   http://www.stata.com/help.cgi?search
>> >> > *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> >> > *   http://www.ats.ucla.edu/stat/stata/
>> >> *
>> >> *   For searches and help try:
>> >> *   http://www.stata.com/help.cgi?search
>> >> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> >> *   http://www.ats.ucla.edu/stat/stata/
>> >
>> >
>> > -----
>> > Sunday Times Scottish University of the Year 2011-2013 Top in the UK
>> > for student experience Fourth university in the UK and top in Scotland
>> > (National Student Survey 2012)
>> >
>> >
>> > We invite research leaders and ambitious early career researchers to
>> > join us in leading and driving research in key inter-disciplinary themes.
>> > Please see www.hw.ac.uk/researchleaders for further information and
>> > how to apply.
>> >
>> > Heriot-Watt University is a Scottish charity registered under charity
>> > number SC000278.
>> >
>> >
>> > *
>> > *   For searches and help try:
>> > *   http://www.stata.com/help.cgi?search
>> > *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> > *   http://www.ats.ucla.edu/stat/stata/
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
> -----
> Sunday Times Scottish University of the Year 2011-2013
> Top in the UK for student experience
> Fourth university in the UK and top in Scotland (National Student Survey 2012)
>
>
> We invite research leaders and ambitious early career researchers to
> join us in leading and driving research in key inter-disciplinary themes.
> Please see www.hw.ac.uk/researchleaders for further information and how
> to apply.
>
> Heriot-Watt University is a Scottish charity
> registered under charity number SC000278.
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index