match_2C: Optimal Matching with Two Criteria.

View source: R/match_2C.R

match_2CR Documentation

Optimal Matching with Two Criteria.

Description

This function performs an optimal statistical matching that sequentially balances the nominal levels (near-fine balance), the marginal distribution of the propensity score, and the total within-matched-pair Mahalanobis distance.

Usage

match_2C(
  Z,
  X,
  propensity,
  dataset,
  method = "maha",
  exact = NULL,
  caliper_left = 1,
  caliper_right = 1,
  k_left = NULL,
  k_right = NULL,
  fb_var = NULL,
  controls = 1,
  include = NULL
)

Arguments

Z

A length-n vector of treatment indicator.

X

A n-by-p matrix of covariates with column names.

propensity

A vector of estimated propensity score (length(propensity) = length(Z)).

dataset

Dataset to be matched.

method

Method used to compute treated-control distance on the left. The default is the Mahalanobis distance.

exact

A vector of strings indicating which variables need to be exactly matched.

caliper_left

Size of caliper on the left network.

caliper_right

Size of caliper on the right network.

k_left

Connect each treated to k_left controls closest in the propensity score in the left network.

k_right

Connect each treated to k_right controls closest in the propensity score in the right network.

fb_var

A vector giving names of variables in matrix X to be finely balanced.

controls

Number of controls matched to each treated. Default is 1.

include

A binary vector indicating which controls must be included (length(include) = sum(1-Z)).

Value

This function returns a list of three objects including the feasibility of the matching problem and the matched controls organized in different formats. See the documentation of the function construct_outcome or the vignette for more details.

Examples


# We first prepare the input X, Z, propensity score

attach(dt_Rouse)
X = cbind(female,black,bytest,dadeduc,momeduc,fincome)
Z = IV
propensity = glm(IV~female+black+bytest+dadeduc+momeduc+fincome,
                family=binomial)$fitted.values
detach(dt_Rouse)

matching_output_double_calipers = match_2C(Z = Z, X = X,
propensity = propensity,
caliper_left = 0.05, caliper_right = 0.05,
k_left = 100, k_right = 100,
dataset = dt_Rouse)

# Please refer to the vignette for many more examples.



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