View source: R/manual_stratify.R
manual_stratify | R Documentation |
Stratifies a data set based on a set of blocking covariates specified by the
user. Creates a manual_strata
object, which can be passed to
strata_match
for stratified matching or unpacked by the user to be
matched by some other means.
manual_stratify(data, strata_formula, force = FALSE)
data |
data.frame with observations as rows, features as columns |
strata_formula |
the formula to be used for stratification. (e.g. |
force |
a boolean. If true, run even if a variable appears continuous. (default = FALSE) |
Returns a manual_strata
object. This contains:
treat
- a string giving the name of the column encoding
treatment assignment
covariates
- a character vector with the names of the
categorical columns on which the data were stratified
analysis_set
- the data set with strata assignments
call
- the call to manual_stratify
used to generate this
object
issue_table
- a table of each stratum and potential issues of
size and treat:control balance. In small or imbalanced strata, it may be
difficult or infeasible to find high-quality matches, while very large
strata may be computationally intensive to match.
strata_table
- a table of each stratum and the covariate bin
to which it corresponds
auto_stratify
, new_manual_strata
# make sample data set dat <- make_sample_data(n = 75) # stratify based on B1 and B2 m.strat <- manual_stratify(dat, treat ~ B1 + B2) # diagnostic plot plot(m.strat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.