match: Wrapper for MatchIt package

View source: R/match.R

matchR Documentation

Wrapper for MatchIt package

Description

match is the main command of the package MatchIt, which enables parametric models for causal inference to work better by selecting well-matched subsets of the original treated and control groups. This function acts as a wrapper to facilitate propensity-score matching with a tidyverse approach.

Usage

match(
  .data,
  strata,
  explanatory,
  id = NULL,
  dependent = NULL,
  method = "full",
  keep_col = F,
  keep_unmatch = T,
  caliper = NULL,
  replace = FALSE,
  ratio = 1,
  ...
)

Arguments

.data

Dataframe

strata

Column name of the binary treatment indicator (this variable must only have 2 levels).

explanatory

Vector of column names containing variables used to estimate the propensity score (pre-treatment covariates).

id

Vector of column names containing patient identification variables that are to be retained following matching (no use within MatchIt::matchit()).

dependent

Vector of column names containing dependent (outcome) variables that are to be retained following matching (no use within MatchIt::matchit()).

method

As per MatchIt::matchit(). This argument specifies a matching method. Currently, "exact" (exact matching), "full" (full matching), "genetic" (genetic matching), "nearest" (nearest neighbor matching), "optimal" (optimal matching), and "subclass" (subclassification) are available. The default is "nearest". Note that within each of these matching methods, MatchIt offers a variety of options.

keep_col

Keep all columns within the original dataset (default = FALSE)

keep_unmatch

Keep unmatched patients within the output (default = TRUE)

caliper

As per MatchIt::matchit. For methods that allow it, the width(s) of the caliper(s) to use in matching. Should be a numeric vector with each value named according to the variable to which the caliper applies. To apply to the distance measure, the value should be unnamed. See the individual methods pages for information on whether and how this argument is used. The default is NULL for no caliper.

replace

As per MatchIt::matchit. For methods that allow it, whether matching should be done with replacement (TRUE), where control units are allowed to be matched to several treated units, or without replacement (FALSE), where control units can only be matched to one treated unit each. See the individual methods pages for information on whether and how this argument is used. Default is FALSE for matching without replacement.

ratio

As per MatchIt::matchit. For methods that allow it, how many control units should be matched to each treated unit in k:1 matching. Should be a single integer value. See the individual methods pages for information on whether and how this argument is used. The default is 1 for 1:1 matching.

...

Additional arguments to be passed to a variety of matching methods.

Value

Nested list of (1) "object" - the MatchIt::matchit() output and (2) "data": the matched dataset.


kamclean/finalpsm documentation built on Oct. 3, 2023, 3:52 a.m.