# Choose 400 patients and 4 covariates to work with for the example
set.seed(15)
samp <- sample(1:nrow(rhc_X), 400)
cov_samp <- sample(1:26, 4)
# 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"])
# Or, specify your own initial strata
ps <- prop_strat(z = rhc_X[samp, "z"],
X = rhc_X[samp, cov_samp], nstrata = 3)
ref <- refine(X = ps$X, z = ps$z, strata = ps$base_strata)
# Can just input the output of prop_strat() directly
ref <- refine(object = ps)
Run the code above in your browser using DataLab