buildCaliper {matchMulti} | R Documentation |
Construct propensity score caliper
Description
Fits a propensity score for an individual-level or group-level treatment, computes a caliper for the propensity score (based on a fractional number of standard deviations provided by the user), and creates a matrix containing information about which treated-control pairings are excluded by the caliper.
Usage
buildCaliper(data, treatment, ps.vars, group.id = NULL, caliper = 0.2)
Arguments
data |
A data frame containing the treatment variable, the variables to be used in fitting the propensity score and (if treatment is at the group level) a group ID. |
treatment |
Name of the treatment indicator. |
ps.vars |
Vector of names of variables to use in fitting the propensity score. |
group.id |
Name of group ID variable, if applicable. |
caliper |
Desired size of caliper, in number of standard deviations of the fitted propensity score. |
Details
The treatment
variable should be binary with 1 indicating treated
units and 0 indicating controls. When group.id
is NULL
,
treatment is assumed to be at the individual level and the propensity score
is fitted using the matrix data
. When a group ID is specified, data
frame data
is first aggregated into groups, with variables in
ps.vars
replaced by their within-group means, and the propensity
score is fitted on the group matrix.
Value
A matrix with nrow
equal to the number of treated individuals
or groups and ncol
equal to the number of control individuals, with
0
entries indicating pairings permitted by the caliper and Inf
entries indicating forbidden pairings.
Author(s)
Luke Keele, Penn State University, ljk20@psu.edu
Sam Pimentel, University of California, Berkeley, spi@berkeley.edu
Examples
## Not run:
# Load Catholic school data
data(catholic_schools)
student.cov <- c('minority','female','ses','mathach')
# Check balance student balance before matching
balanceTable(catholic_schools[c(student.cov,'sector')], treatment = 'sector')
#fit a propensity score caliper on mean values of student covariates within schools
school.caliper <- buildCaliper(data = catholic_schools, treatment = 'sector',
ps.vars = student.cov, group.id = 'school')
#Match schools but not students within schools
match.simple <- matchMulti(catholic_schools, treatment = 'sector',
school.caliper = school.caliper, school.id = 'school', match.students = FALSE)
#Check balance after matching - this checks both student and school balance
balanceMulti(match.simple, student.cov = student.cov)
## End(Not run)