I would like to use R to duplicate the treatment effect estimation method used in Stata. Specifically, this is the Stata method I would like to duplicate.
I have tried the package
Zelig in R, but the result was quite different from the result I had in Stata.
m.out1 = matchit(treatment ~ high_peak + hour, method="nearest", data=regres_LNG) z.out1 = zelig(IPPLNG.gen ~ high_peak + hour, data=match.data(m.out1,"control"), model="ls") x.out1 = setx(z.out1, data=match.data(m.out1, "treat", cond=TRUE)) s.out1 = sim(z.out1, x=x.out1) summary(s.out1) z.out2 = zelig(IPPLNG.gen~hour+high_peak, data=match.data(m.out1,"treat"), model="ls") x.out2 = setx(z.out2, data=match.data(m.out1,"control"), cond=TRUE) s.out2 = sim(z.out2, x=x.out2) ate.all = c(s.out1$sim.out[][][], -s.out2$sim.out[][][])
(Also, I learned this method in the pdf)
Besides, I tried the linear regression model including treatment as a independent variable, but the coefficient and p-value was still different.
m.data = match.data(m.out1) lm_treat = lm(IPPLNG.gen~事件+hour+high_peak, data=m.data) summary(lm_treat)
Hence, I would like to know how to duplicate the treatment effect estimation within nearest neighborhood matching in Stata to R and the difference between these two methods.