Learn R Programming

arm (version 1.1-14)

matching: Matching

Description

Function for processing matching with propensity score

Usage

matching(z, score)

Arguments

z
vector of indicators for treatment or control.
score
vector of the propensity scores in the same order as z.

Value

  • The function returns a vector of indices that the corresponding unit is matched to. 0 means matched to nothing.

Details

Function for matching each treatment unit in turn the control unit (not previously chosen) with the closest propensity score

References

Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2006.

See Also

balance

Examples

Run this code
# matching first
data(lalonde)
attach(lalonde)
fit <- glm(treat ~ re74 + re75 + age + factor(educ) + 
            black + hisp + married + nodegr + u74 + u75, 
            family=binomial(link="logit"))
pscores <- predict(fit, type="link")
matches <- matching(z=lalonde$treat, score=pscores)
matched <- lalonde[matches$matched,]

# balance check!
b.stats <- balance(lalonde, matched, fit)
print(b.stats)
plot(b.stats)

Run the code above in your browser using DataLab