Skip to contents

Native variable-ratio ("extremal") nearest-neighbour matching (Ming & Rosenbaum 2000), with the rules of MatchIt::matchit(method = "nearest", ratio = r, min.controls = min_ratio, max.controls = max_ratio): treated units with the most typical scores receive max_ratio controls and the rest min_ratio (one in between takes the remainder), so that about r controls per treated unit are used in all, where r is midway between the bounds. Matching is greedy without replacement on the propensity score (probability scale) within caliper standard deviations of it. Returns MatchIt's weights and subclasses; cross-validated against MatchIt in tests/cross. No MatchIt at runtime.

Usage

morie_matching_variable_ratio(
  data,
  treatment,
  covariates,
  min_ratio = 1L,
  max_ratio = 5L,
  caliper = 0.2,
  ps = NULL
)

Arguments

data

Data frame.

treatment

Binary treatment column name.

covariates

Character vector of covariates.

min_ratio, max_ratio

Match-count bounds per treated unit.

caliper

Caliper on the propensity score, in standard deviations of the score (NULL for none).

ps

Optional propensity scores (as for morie_matching_full()).

Value

A list of class morie_match_result; matched_data holds the matched rows with distance, weights and subclass columns.

References

Ming, K. and Rosenbaum, P. R. (2000). Substantial gains in bias reduction from matching with a variable number of controls. Biometrics, 56(1), 118–124.

Examples

set.seed(1)
df <- data.frame(y = rnorm(200), d = rbinom(200, 1, 0.25),
                 x1 = rnorm(200), x2 = rnorm(200))
vr <- morie_matching_variable_ratio(df, "d", c("x1", "x2"),
                                    min_ratio = 1, max_ratio = 3)
table(table(vr$match_pairs$treated_idx))  # controls per treated unit
#> 
#>  1  2  3 
#> 23  5 21