calc_smds {optrefine}R Documentation

Calculate standardized mean differences for initial and refined strata

Description

Summarizes initial and/or refined strata in terms of standardized mean differences (SMDs).

Usage

calc_smds(
  object = NULL,
  z = NULL,
  X = NULL,
  base_strata = NULL,
  refined_strata = NULL,
  abs = TRUE
)

Arguments

object

an optional object of class strat, typically created using strat() or as a result of a call to prop_strat(). If not provided, z and X must be specified

z

vector of treatment assignment; only used if object is not supplied

X

covariate matrix/data.frame; only used if object is not supplied

base_strata

optional initial stratification for which to calculate SMDs; only used if object is not supplied

refined_strata

optional refined stratification for which to calculate SMDs; only used if object is not supplied

abs

boolean whether to return absolute standardized mean differences or raw values. Default is TRUE for absolute values

Value

List with two elements, "base" and "refined", each containing a matrix of standardized mean differences for each stratum (row) and covariate (column).

Examples

# Choose 500 patients and 5 covariates to work with for the example
set.seed(15)
samp <- sample(1:nrow(rhc_X), 500)
cov_samp <- sample(1:26, 5)

# Let it create propensity score strata for you and then refine them
ref <- refine(X = rhc_X[samp, cov_samp], z = rhc_X[samp, "z"])

# Look at covariate balance for propensity score and refined strata
calc_smds(object = ref)


[Package optrefine version 1.1.0 Index]