Re: [R] Matching package - Match function

From: sunny <>
Date: Fri, 25 Mar 2011 20:39:27 -0700 (PDT)

I have figured out the solution to this. It appears that "distance" isn't defined as the difference in propensity scores. Instead, this difference is then scaled by the standard deviation of the predicted dependent-variable values of the corresponding logistic regression, and then squared.

Therefore, instead of checking for:

> summary(abs(logit.reg$fitted[match$index.treated]-logit.reg$fitted[match$index.control]))

     Min. 1st Qu. Median Mean 3rd Qu. Max. 7.453e-13 2.959e-07 5.849e-07 5.842e-07 8.741e-07 1.167e-06

the correct form is:

> summary(((logit.reg$fitted[match$index.treated]-logit.reg$fitted[match$index.control])/sd(logit.reg$fitted))^2)

     Min. 1st Qu. Median Mean 3rd Qu. Max. 4.078e-18 6.426e-07 2.512e-06 3.337e-06 5.609e-06 1.000e-05

which then gives the expected maximum value of 1e-5, as set in the distance.tolerance option.

sunny wrote:
> Hi.
> I am using the Matching package for propensity score matching. For each
> treated unit, I want to find all control units whose propensity scores lie
> within a certain distance from the treated unit. The sample code is as
> follows:

>> library(Matching)

>> x <- rnorm(100000)
>> y <- rnorm(100000)
>> z <- rbinom(100000,1,0.002)

>> logit.reg <- glm(z~x+y,family=binomial(link='logit'))

>> match <-
>> Match(Y=NULL,Tr=z,X=logit.reg$fitted,version='fast',ties=TRUE,M=1,distance.tolerance=1e-5)

> According to the function definition
> (
> "distance.tolerance: This is a scalar which is used to determine if
> distances between two observations are different from zero. Values less
> than distance.tolerance are deemed to be equal to zero. This option can be
> used to perform a type of optimal matching"
> Thus, for each treated unit I should get all control units whose
> difference in propensity scores from the treated unit is less than 1e-5.
> However, the actual difference between the treated unit's and the control
> units' propensity is distributed as follows:
>> summary(abs(logit.reg$fitted[match$index.treated]-logit.reg$fitted[match$index.control]))

> Min. 1st Qu. Median Mean 3rd Qu. Max.
> 7.453e-13 2.959e-07 5.849e-07 5.842e-07 8.741e-07 1.167e-06
View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 26 Mar 2011 - 07:43:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 26 Mar 2011 - 09:00:26 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive