bipartite_matches: bipartite_matches

Description Usage Arguments Value

View source: R/bipartite_matches.R

Description

Generates bipartite matched pairs either with replacement, greedily without replacement, or optimally.

Usage

1
2
3
4
5
6
7
8
bipartite_matches(
  dist_mat,
  treat_vec,
  match_method = c("with_replacement", "optimal", "greedy"),
  n_sinks = NULL,
  tol_val = NULL,
  weight_vec = NULL
)

Arguments

dist_mat

Matrix of pairwise distances.

treat_vec

Vector representing all subjects; 0 for control, 1 for treated.

match_method

Choice of the three matching methods:

"with_replacement"

Finds smallest control for each treatment

"greedy"

Greedily generates pairs. Note that the order for choosing the greedy pairs is random, which is not the only possible solution.

"optimal"

Minimum total distance

n_sinks

How many sinks to use; can be vector. Default NULL to match all and ignore sinks.

tol_val

Tolerance for solving optimal matches (how far from the true optimal value is acceptable). Speed with large value, accuracy with small.

weight_vec

Default NULL: optionally supply the weight vector used to generate dist_mat

Value

A list with five elements and an optional sixth:

treat_index

index of treated units, from all units

treat_index_within

index of treated units, from the set of treated

control_index

index of control units, from all units

control_index_within

index of control units, from the set of control

distance

distances between the pairs

weight_vec

weight vector used to generate dist_mat if supplied


rzgross/uRbanmatching documentation built on Dec. 22, 2021, 8:20 p.m.