R's Match Library
ICS212
Multivariate and Propensity Score Matching Estimator for Causal Inference
Match implements a variety of algorithms for multivariate matching including
- propensity score
- Mahalanobis
- inverse variance matching
The function is intended to be used in conjunction with the MatchBalance function which determines the extent to which Match has been able to achieve covariate balance.
In order to do propensity score matching, one should estimate the propensity model before calling Match, and then send Match the propensity score to use.
Match enables a wide variety of matching options including matching with or without replacement, bias adjustment, different methods for handling ties, exact and caliper matching, and a method for the user to fine tune the matches via a general restriction matrix. Variance estimators include the usual Neyman standard errors, Abadie-Imbens standard errors, and robust variances which do not assume a homogeneous causal effect.
The GenMatch function can be used to automatically find balance via a genetic search algorithm which determines the optimal weight to give each covariate.
Match(Y=NULL, Tr, X, Z = X, V = rep(1, length(Y)), estimand = "ATT", M = 1,
BiasAdjust = FALSE, exact = NULL, caliper = NULL, replace=TRUE, ties=TRUE,
CommonSupport=FALSE,Weight = 1, Weight.matrix = NULL, weights = NULL,
Var.calc = 0, sample = FALSE, restrict=NULL, match.out = NULL,
distance.tolerance = 1e-05, tolerance=sqrt(.Machine$double.eps),
version="standard")
vector containing outcome of interest
vector showing assignment
matrix of variables we wish to match on
number of matches which should be found
NOTE: CLICK on NEXT to reveal content
MatchBalance: Tests for Univariate and Multivariate Balance
This function provides a variety of balance statistics
useful for determining if balance exists in any unmatched dataset and in matched datasets produced by the Match function.
Matching is performed by the Match function, and
MatchBalance is used to determine if Match was successful in achieving balance on the observed covariates.
MatchBalance(formula, data = NULL, match.out = NULL, ks = TRUE,nboots=500, weights=NULL, digits=5, paired=TRUE, print.level=1)
The number of bootstrap samples to be run.
Does not estimate any model. Just an efficient way to list variables we wish to obtain univariate balance statistics for.
NOTE: when it says arg=null in documentation it means that the default value of this argument is null
A data frame which contains all of the variables in the formula
The output object from the Match function
NOTE: CLICK on NEXT to reveal content
R's Match Library Documentation
By Dan Ryan
R's Match Library Documentation
Slides to walk students through Match function in R as used in a workbook to follow in LP19 of ICS212
- 127