View source: R/match_functions.R
strata_match | R Documentation |
Match within strata in series using optmatch. Requires optmatch package to be installed.
strata_match(object, model = NULL, method = "prop", k = 1)
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 |
a named factor with matching assignments
# 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 strata_match(a.strat, model = treat ~ X1 + X2, k = 1) # full match within strata based on mahalanobis distance. strata_match(a.strat, model = treat ~ X1 + X2, method = "mahal", k = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.