stefania innocenti
2016-Mar-08 21:31 UTC
[R] ivreg with two endogenous variables and 1 instrument respectively
Hello, I am trying to use the ivregress function to estimate a second stage model which looks like the following: LogGDP=GEO+RULE+OPENNESS I would like to instrument Rule (RULE) with Settler mortality (SETTLER) and Openness (OPENNESS) with logFrankelRomer (FR). I thus have one instrument per each endogenous variable. Thus the second stage look like: RULE=GEO+logFR+SETTLER OPENNESS=GEO+logFR+SETTLER Can I do this simultaneously with the ivregress function? Maybe I got something wrong with the syntax but if I do: ivregress(logGDP ~RULE+GEO+OPENNESS, c(RULE~SETTLER+FR+GEO, OPENNESS~SETTLER+FR+GEO), mydata), the function bugs and I cannot proceed. Of course, I could run the two first stages separately, but the coefficient of the first stage are then wrong. The command ivreg(logGDP ~ RULE + GEO +OPEN| GEO + SETTLER+FR) gives me correct second stage coefficients (I checked with what I obtained doing the 2sls by hand). But how do I retrieve the first stage coefficients for RULE=GEO+logFR+SETTLER and OPENNESS=GEO+logFR+SETTLER in this case? Any advice is more than appreciated. Thanks a lot in advance. Best regards, Stefania
Achim Zeileis
2016-Mar-09 17:02 UTC
[R] ivreg with two endogenous variables and 1 instrument respectively
On Tue, 8 Mar 2016, stefania innocenti wrote:> Hello, > I am trying to use the ivregress function to estimate a second stage > model which looks like the following: > > LogGDP=GEO+RULE+OPENNESS > > I would like to instrument Rule (RULE) with Settler mortality (SETTLER) > and Openness (OPENNESS) with logFrankelRomer (FR). I thus have one > instrument per each endogenous variable. > > Thus the second stage look like: > RULE=GEO+logFR+SETTLER > OPENNESS=GEO+logFR+SETTLER > > Can I do this simultaneously with the ivregress function?Which package is this?> Maybe I got something wrong with the syntax but if I do: > ivregress(logGDP ~RULE+GEO+OPENNESS, c(RULE~SETTLER+FR+GEO, > OPENNESS~SETTLER+FR+GEO), mydata), the function bugs and I cannot > proceed. > > Of course, I could run the two first stages separately, but the > coefficient of the first stage are then wrong. > > The command ivreg(logGDP ~ RULE + GEO +OPEN| GEO + SETTLER+FR) gives me > correct second stage coefficients (I checked with what I obtained doing > the 2sls by hand).That's package "AER", I presume?> But how do I retrieve the first stage coefficients for > RULE=GEO+logFR+SETTLER and OPENNESS=GEO+logFR+SETTLER in this case?The ivreg() function from "AER" does not store the first stage results but just returns the IV estimates from the second stage. If you want the first stage you need to run lm() manually: lm(cbind(RULE, OPENNESS) ~ GEO + logFR + SETTLER, ...)> Any advice is more than appreciated. > Thanks a lot in advance. > Best regards, > Stefania > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >