Estimation of average treatment effect based on nearest neighbor matching 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 MatchIt and 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[[1]][1][[1]][[1]], -s.out2$sim.out[[1]][1][[1]][[1]])

(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. 
 A: Despite good documentation for teffects nnmatch and the R package Matching, the answers are slightly different, but I'm not exactly sure why. However, here is how you can get close to a similar answer in R:
d <- haven::read_dta("http://www.stata-press.com/data/r13/cattaneo2.dta")
library(Matching)
m.out <- with(d, Match(Y = bweight, 
                       Tr = mbsmoke, 
                       X = data.frame(fage, mage, mmarried, prenatal1),
                       Z = data.frame(fage, mage),
                       estimand = "ATE",
                       BiasAdjust = TRUE,
                       exact = c(fage = FALSE, mage = FALSE, 
                                 mmarried = TRUE, prenatal1 = TRUE)))
summary(m.out)

The MatchIt package cannot do this kind of analysis. The philosophy behind it is different from that underlying teffects nnmatch. The Matching package comes quite close in that it has many of the same options as teffects nnmatch and was built on a similar philosophy (and even uses fairly similar syntax elements). Using this code, I get an ATE of -250.18 (27.807), whereas teffects nnmatch in the video gave an ATE of -244.32 (27.269), which lead to the same substantive conclusion.
