template_match: Optimal Matching with Two Criteria.

View source: R/template_match.R

template_matchR Documentation

Optimal Matching with Two Criteria.

Description

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.

Usage

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
)

Arguments

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.

Details

Please refer to the vignette for reproducible examples.

Value

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.


match2C documentation built on March 31, 2023, 6:39 p.m.