data("lalonde")
# Generate random sampling weights, just
# for this example
sw <- rchisq(nrow(lalonde), 2)
# NN PS match using logistic regression PS that doesn't
# include sampling weights
m.out <- matchit(treat ~ age + educ + race + nodegree +
married + re74 + re75, data = lalonde)
m.out
# Add s.weights to the matchit object
m.out <- add_s.weights(m.out, sw)
m.out #note additional output
# Check balance; note that sample sizes incorporate
# s.weights
summary(m.out, improvement = FALSE)
Run the code above in your browser using DataLab