2
$\begingroup$

I am trying to match treatment with the control using the R Matching package for the data set nuclearplants (which is available in optmatch package in R). Following is the code for matching:

library (optmatch)# for the dataset nuclearplants
library(Matching) # for performing matching
data(nuclearplants)
# I am using Mahalanobis matching with covariates t1 and t2 and treatment pr
cov<-cbind(nuclearplants$t1,nuclearplants$t2)
sd<-Match(Y=NULL,Tr=nuclearplants$pr,X=cov, Weight.matrix = 2 ) 
    matched<-rbind(nuclearplants[sd$index.treated,],nuclearplants[sd$index.control,])
head(matched)


       cost  date t1 t2  cap pr ne ct bw cum.n pt
A 443.22 67.33 10 85 1065  1  0  1  0     1  0
B 642.23 68.00 11 78 1065  1  1  1  0    12  0
C 457.12 68.42 15 55  822  1  0  0  0     5  0
D 289.66 68.42 15 76  530  1  0  1  0     2  0
E 490.88 68.92 16 59 1050  1  0  0  0     8  0
F 665.99 70.92 22 57  828  1  1  0  0    20  0
> sd$index.treated
      [1]  3  5  9 18 20 22 24 30 31 32
    > sd$index.control
 [1]  2 10  8 19 23 26 26 10 10  2

Now, I am trying to see whether the stata also gives the same results for the same data and the same methodology. For this purpose, I use psmatch 2

psmatch2 pr, mahalanobis(t1 t2)

I was very shocked to see that for the same approach, these two programs give different results. Below is the summary results for the stata:

tre stata control
3   7
5   7
9   6
18  15
20  17
22  19
24  14
30  7
31  7
32  2

tr: treatment observations (row number), stata control=control observations for Stata (row number)

I was wondering whether I missed something implicit in the code.

$\endgroup$
7
  • $\begingroup$ Not an answer, but a picky point. In Stata, which I know much better, psmatch2 [NB] is one user-written program; therefore it is loose to attribute results to Stata. Similar point, I guess, for R. $\endgroup$
    – Nick Cox
    Mar 21, 2013 at 12:26
  • $\begingroup$ @ Nick : Exactly! $\endgroup$
    – Metrics
    Mar 21, 2013 at 13:38
  • $\begingroup$ It doesn't fix the disparity, but in your R code, it seems like you should use Weight=2 rather than Weight.matrix=2. Weight sets it to use Mahalanobis matching, and Weight.matrix sets the weighting matrix manually. $\endgroup$
    – pwfoley
    Mar 21, 2013 at 19:03
  • $\begingroup$ @ pwfoley: Thanks for that (question now updated). Any idea why they are giving different results when the approach is the same and idea of minimizing the distance is same? I would really appreciate the input. $\endgroup$
    – Metrics
    Mar 22, 2013 at 1:00
  • $\begingroup$ @user1493368 What type of matching do you intend to do? Optimal matching? Matching with replacement? (Non)bipartite matching? These are different things. What is the Stata routine doing? $\endgroup$ Mar 22, 2013 at 1:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.