strata_match function

Strata Match

Strata Match

Match within strata in series using optmatch. Note that this function requires that the R package optmatch is installed.

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 object will be used as covariates in the propensity model or mahalanobis match (except outcome, treatment and stratum)

  • method: either "prop" for propensity score matching based on a glm fit with model model, or "mahal" for mahalanobis distance matching by the covariates in model.

  • k: the number of control individuals to be matched to each treated individual. If "k = full" is used, fullmatching is done instead of pairmatching

Returns

a named factor with matching assignments

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)

See Also

https://cran.r-project.org/package=optmatch

  • Maintainer: Rachael C. Aikens
  • License: GPL-3
  • Last published: 2022-03-31