strata_match: Strata Match

Description Usage Arguments Value Examples

View source: R/match_functions.R

Description

Match within strata in series using optmatch. Requires optmatch package to be installed.

Usage

1
strata_match(object, propensity = NULL, k = 1)

Arguments

object

a strata object

propensity

(optional) formula for propensity score. If left blank, all columns of the dataset will be used as covariates (except outcome, treatment and stratum)

k

numeric, the number of control individuals to be matched to each treated individual

Value

a named factor with matching assignments

Examples

1
2
3
4
5
6
7
8
9
# 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, propensity = treat ~ X1 + X2, k = 1)

raikens1/stratamatch documentation built on Aug. 6, 2020, 7:29 a.m.