profmatch {designmatch} | R Documentation |
Optimal profile matching
Description
Function for optimal profile matching to construct matched samples that are balanced toward a user-specified covariate profile. This covariate profile can represent a specific population or a target individual, facilitating the generalization and personalization of causal inferences (Cohn and Zubizarreta 2022). For each treatment group reservoir, profmatch
finds the largest sample that is balanced relative to the profile. The formulation of profmatch
has been simplified to handle larger data than bmatch
or nmatch
. Similar to bmatch
or nmatch
, the performance of profmatch
is greatly enhanced by using the solver
options cplex
or gurobi
.
Usage
profmatch(t_ind, mom, solver = NULL)
Arguments
t_ind |
treatment indicator: a vector indicating treatment group of each observation. |
mom |
moment balance parameters: a list with three arguments,
|
solver |
Optimization solver parameters: a list with four objects,
|
Value
A list containing the optimal solution, with the following objects:
obj_totals |
values of the objective functions at the optima (one value for each treatment group matching problem); |
ids |
indices of the matched units at the optima; |
times |
time elapsed to find the optimal solutions (one value for each treatment group matching problem). |
Author(s)
Eric R. Cohn <ericcohn@g.harvard.edu>, Jose R. Zubizarreta <zubizarreta@hcp.med.harvard.edu>, Cinar Kilcioglu <ckilcioglu16@gsb.columbia.edu>, Juan P. Vielma <jvielma@mit.edu>.
References
Zubizarreta, J. R. (2012), "Using Mixed Integer Programming for Matching in an Observational Study of Kidney Failure after Surgery," Journal of the American Statistical Association, 107, 1360-1371.
Cohn, E. R. and Zubizarreta, J. R. (2022) "Profile Matching for the Generalization and Personalization of Causal Inferences," Epidemiology
See Also
sensitivitymv, sensitivitymw.
Examples
### Load, sort, and attach data
#data(lalonde)
#lalonde = lalonde[order(lalonde$treatment, decreasing = TRUE), ]
#attach(lalonde)
### Specify covariates
#covs = c("age", "education", "black", "hispanic", "married", "nodegree", "re74", "re75")
### Vector of treatment group indicators
#t_ind = lalonde$treatment
### Covariate matrix
#mom_covs = as.matrix(lalonde[, covs])
### Tolerances will be 0.05 * each covariate's standard deviation
#mom_sds = apply(lalonde[, covs], 2, sd)
#mom_tols = 0.05 * mom_sds
### Target moments will be the overall means in the sample
#mom_targets = colMeans(lalonde[, covs])
### Solver options
#t_max = 60*30
#solver = "gurobi"
#approximate = 0
#solver = list(name = solver, t_max = t_max, approximate = approximate, round_cplex = 0, trace = 0)
#mom = list(covs = mom_covs, tols = mom_tols, targets = mom_targets)
#pmatch_out = profmatch(t_ind, mom, solver)
### Selecting the matched units
#lalonde.matched = lalonde[pmatch_out$id,]
### Comparing TASMDs before and after matching
#TASMD.0.2 = abs(colMeans(lalonde.matched[which(lalonde.matched$treatment == 0), covs])
# - mom_targets) / mom_sds
#TASMD.1.2 = abs(colMeans(lalonde.matched[which(lalonde.matched$treatment == 1), covs])
# - mom_targets) / mom_sds
#TASMD.0.1 = abs(colMeans(lalonde[which(lalonde$treatment == 0), covs]) - mom_targets) / mom_sds
#TASMD.1.1 = abs(colMeans(lalonde[which(lalonde$treatment == 1), covs]) - mom_targets) / mom_sds
### For each treatment group, ASAMDs are reduced after matching (i.e., balance is achieved)
#cbind(TASMD.0.1, TASMD.0.2)
#cbind(TASMD.1.1, TASMD.1.2)