strata_match {stratamatch} | R Documentation |
Strata Match
Description
Match within strata in series using optmatch. Note that this function
requires that the R package optmatch
is installed.
Usage
strata_match(object, model = NULL, method = "prop", k = 1)
Arguments
object |
a strata object |
model |
(optional) formula for matching. If left blank, all
columns of the analysis set in |
method |
either "prop" for propensity score matching based on a glm fit
with model |
k |
the number of control individuals to be matched to each treated
individual. If |
Value
a named factor with matching assignments
See Also
https://cran.r-project.org/package=optmatch
Examples
# make a sample data set
set.seed(1)
dat <- make_sample_data(n = 75)
# stratify with auto_stratify
a.strat <- auto_stratify(dat, "treat", outcome ~ X2, size = 25)
# 1:1 match based on propensity formula: treat ~ X1 + X2
# Requires optmatch package to be installed.
strata_match(a.strat, model = treat ~ X1 + X2, k = 1)
# full match within strata based on mahalanobis distance.
# Requires optmatch package to be installed.
strata_match(a.strat, model = treat ~ X1 + X2, method = "mahal", k = 1)
[Package stratamatch version 0.1.9 Index]