View source: R/template_match.R
template_match | R Documentation |
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
)
template |
A dataframe of template units. |
X |
A n-by-p matrix of covariates with column names. |
Z |
A length-n vector of treatment indicator. |
dataset |
Dataset to be matched. |
multiple |
Number of treated units matched to each template unit. Default is 1. |
lambda |
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. |
caliper_gscore |
Size of generalizability caliper. |
k_gscore |
Connect each template unit to k_gscore treated units closest in the generalizability score. |
penalty_gscore |
Penalty for violating the generalizability caliper. Set to Inf by default. |
caliper_pscore |
Size of propensity score caliper. |
k_pscore |
Connect each treated to k_pscore control units closest in the propensity score. |
penalty_pscore |
Penalty for violating the propensity score caliper. Set to Inf by default. |
Please refer to the vignette for reproducible examples.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.