Hi there, I hope to build a model Y ~ X1 + X2 + X3 + X4 with X1 has two instrumental variable A and B, and X2 has one instrumental variable A. I have searched the R site and mailling list, and known that the tsls() from sem package and ivreg() from AER package can deal with instrumental variable regression, however, I don't know how to formula the model. Any suggestion will be really appreciated. Thanks in advances! Regards, Jinsong
Dear Jinsong, I assume from your question that X3 and X4 are also available as instruments. Then, if you use tsls() in the sem package, you could formulate the model as tsls(Y ~ X1 + X2 + X3 + X4, instruments = ~ A + B + X3 + X4, data=yourData). See ?tsls for a similar example. It is, by the way, misleading to say that X1 "has" two instruments and that X2 "has" one instrument, in that all instrumental variables, including presumably the variables in the equation that you're taking to be exogenous, must be uncorrelated with the error. I hope this helps, John> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]On> Behalf Of Jinsong Zhao > Sent: December-15-09 10:03 AM > To: r-help at r-project.org > Subject: [R] Instrumental Variables Regression > > Hi there, > > I hope to build a model Y ~ X1 + X2 + X3 + X4 with X1 has two > instrumental variable A and B, and X2 has one instrumental variable A. I > have searched the R site and mailling list, and known that the tsls() > from sem package and ivreg() from AER package can deal with instrumental > variable regression, however, I don't know how to formula the model. > > Any suggestion will be really appreciated. Thanks in advances! > > Regards, > Jinsong > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
On Tue, 15 Dec 2009, Jinsong Zhao wrote:> Hi there, > > I hope to build a model Y ~ X1 + X2 + X3 + X4 with X1 has two > instrumental variable A and B, and X2 has one instrumental variable A. I > have searched the R site and mailling list, and known that the tsls() > from sem package and ivreg() from AER package can deal with instrumental > variable regression, however, I don't know how to formula the model.It's not completely clear to me but it seems that you want to use A and B as well as X3 and X4 as instruments. So you can either use ivreg(Y ~ X1 + X2 + X3 + X4 | A + B + X3 + X4) or tsls(Y ~ X1 + X2 + X3 + X4, instruments = ~ A + B + X3 + X4) If your data are time series data, then dynlm() from package "dynlm" might also be useful. It takes the same model specification as tsls(). See the corresponding man pages for more examples. Best, Z> Any suggestion will be really appreciated. Thanks in advances! > > Regards, > Jinsong > > ______________________________________________ > R-help at r-project.org mailing list > 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. > >