thebudget72 m@iii@g oii gm@ii@com
2021-May-05 18:55 UTC
[R] [MatchIt] Naive Estimator for ATT after Full Matching
Dear R-help ML, I would like to compute a Naive Estimator for the Average Treatment Effect (ATT) after a Propensity Score Matching with full matching. Since it is full matching, the resulting post-matching database contains all the observations of the original dataset. I came up with this code, which does a weighted average of the outcomes, using the weights provided by the matching process, but I'm not sure this is the correct way to achieve it. How can I compute the ATT using a Naive Estimator after PSM? I know I am supposed to do a regression, but I am interested in computing a Naive Estimator as a difference between the means across the two groups. ```r library("MatchIt") data("lalonde") m.out2 <- matchit(treat ~ age + educ + race + married + ????????????????? nodegree + re74 + re75, ????????????????? data = lalonde, ????????????????? method = "full", ????????????????? distance = "glm", ????????????????? link = "probit") m.data2 <- match.data(m.out2) te <- weighted.mean(m.data2$re78[m.data2$treat], ??????????????????? m.data2$weights[m.data2$treat]) nte <- weighted.mean(m.data2$re78[!m.data2$treat], ???????????????????? m.data2$weights[!m.data2$treat]) ne2w <- round(te-nte, 2) print(paste0("The ATT estimated with a NE is: ", ne2w)) ``` Thanks in advance and best regards.
Bert Gunter
2021-May-05 20:07 UTC
[R] [MatchIt] Naive Estimator for ATT after Full Matching
Do note, per the posting guide linked below (please read it if you haven't done so already): 1. *"Questions about statistics:* The R mailing lists are primarily intended for questions and discussion about the R software. However, questions about statistical methodology are sometimes posted. If the question is well-asked and of interest to someone on the list, it *may* elicit an informative up-to-date answer. " So do not be surprised if you do not get a response here. stats.stackexchange.com *may* be a better alternative if you do not. 2. "For questions about functions in standard packages distributed with R (see the FAQ Add-on packages in R <https://cran.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R>), ask questions on R-help. If the question relates to a *contributed package* , e.g., one downloaded from CRAN, try contacting the package maintainer first." The matchit package maintainer can be found by: maintainer("matchit") if you think the above applies. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, May 5, 2021 at 11:55 AM <thebudget72 at gmail.com> wrote:> Dear R-help ML, > > I would like to compute a Naive Estimator for the Average Treatment > Effect (ATT) after a Propensity Score Matching with full matching. > > Since it is full matching, the resulting post-matching database contains > all the observations of the original dataset. > > I came up with this code, which does a weighted average of the outcomes, > using the weights provided by the matching process, but I'm not sure > this is the correct way to achieve it. > > How can I compute the ATT using a Naive Estimator after PSM? > > I know I am supposed to do a regression, but I am interested in > computing a Naive Estimator as a difference between the means across the > two groups. > > > ```r > library("MatchIt") > data("lalonde") > > m.out2 <- matchit(treat ~ age + educ + race + married + > nodegree + re74 + re75, > data = lalonde, > method = "full", > distance = "glm", > link = "probit") > > m.data2 <- match.data(m.out2) > > te <- weighted.mean(m.data2$re78[m.data2$treat], > m.data2$weights[m.data2$treat]) > nte <- weighted.mean(m.data2$re78[!m.data2$treat], > m.data2$weights[!m.data2$treat]) > ne2w <- round(te-nte, 2) > > print(paste0("The ATT estimated with a NE is: ", ne2w)) > ``` > > > Thanks in advance and best regards. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]