This function takes as arguments a dataset to be matched and a template, and outputs matched pairs that are closely matched, well balanced, and mimicking the user-supplied template in covariates' distributions of the given template.
template_match(
template,
X,
Z,
dataset,
multiple = 1,
lambda = 1,
caliper_gscore = 1,
k_gscore = NULL,
penalty_gscore = Inf,
caliper_pscore = 1,
k_pscore = NULL,
penalty_pscore = Inf
)
This function returns a list of three objects: 1) feasible: 0/1 depending on the feasibility of the matching problem; 2) match_treated: a data frame of the matched treated units; 3) match_control: a data frame of the matched control units.
A dataframe of template units.
A n-by-p matrix of covariates with column names.
A length-n vector of treatment indicator.
Dataset to be matched.
Number of treated units matched to each template unit. Default is 1.
A tuning parameter controlling the trade-off between internal and external validity. A large lambda favors internal validity of the matched sample. A small lambda favors resemblance to the template.
Size of generalizability caliper.
Connect each template unit to k_gscore treated units closest in the generalizability score.
Penalty for violating the generalizability caliper. Set to Inf by default.
Size of propensity score caliper.
Connect each treated to k_pscore control units closest in the propensity score.
Penalty for violating the propensity score caliper. Set to Inf by default.
Please refer to the vignette for reproducible examples.