This question appears to be off-topic. The users who voted to close gave this specific reason:

"This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – gung

$\begingroup$One immediate thing is that matchit() uses the logit function, i.e., distance = "logit" by default for the distance metric. Specify distance = "mahalanobis" to match what they use in the youtube video.$\endgroup$
– user321627Apr 7 at 14:41

$\begingroup$I just specified distance="mahalanobis". But the result was still different. Thank you for your reply.$\endgroup$
– Hudson CApr 7 at 15:14

$\begingroup$Questions that are only about software (e.g. error messages, code or packages, etc.) are generally off topic here. If you have a substantive machine learning or statistical question, please edit to clarify.$\endgroup$
– gung♦Apr 16 at 18:49

1 Answer
1

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:

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.