[R] ivreg with fixed effect in R?
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Sat Oct 19 13:29:23 CEST 2013
On Sat, 19 Oct 2013, Ignacio Martinez wrote:
> I want to estimate the following fixed effect model:
> y_i,t = alpha_i + beta_1 x1_t + beta_2 x2_i,tx2_i,t = gamma_i + gamma_1
> x1_t + gamma_2 Z1_i + gamma_3 Z2_i
> I can use ivreg from AER to do the iv regression.
> fm <- ivreg(y_i,t ~ x1_t + x2_i,t | x1_t + Z1_i + Z2_i,
> data = DataSet)
> But, I'm not sure how can I add the fixed effects.
You can simply add a factor coding the variable with respect to which you
want to compute fixed effects. In help("Fatalities", package = "AER")
there is an example (starting with "pp. 360") that shows how to do this
for OLS. In principle, the same approach can be used for IV.
> Thanks!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list