plot.strat {optrefine}R Documentation

Plot diagnostics for a "strat" object

Description

Plots the standardized mean differences for strat objects in the format of Love (2002).

Usage

## S3 method for class 'strat'
plot(
  x,
  incl_none = TRUE,
  incl_base = TRUE,
  by_strata = FALSE,
  weighted_avg = FALSE,
  legend = c("No strata", "Base strata", "Refined strata"),
  ...
)

Arguments

x

object of S3 class 'strat'

incl_none

whether to plot imbalances before any stratification

incl_base

whether to plot imbalances for the base stratification (if one exists)

by_strata

whether to generate a list of plots, one for each base stratum if incl_base is TRUE, or one for each refined stratum if incl_base is FALSE. Not used if incl_none is TRUE

weighted_avg

whether to take the weighted average instead of the straight average when collapsing standardized mean differences across strata. Default is FALSE

legend

a vector of labels to use for the three stratifications on the plot. The corresponding label for any stratification that is not to be plotted must still be provided but will be ignored and can be set to NA

...

further arguments passed to or from other methods

Value

Either a ggplot object for the Love plot of standardized mean differences or a list of such ggplot objects if by_strata is TRUE

References

Love, T. E. (2002), "Displaying covariate balance after adjustment for selection bias", Joint Statistical Meetings, yumpu.com/en/document/read/41664623.

Examples

# Choose 800 patients and 5 covariates to work with for the example
set.seed(28)
samp <- sample(1:nrow(rhc_X), 800)
cov_samp <- sample(1:26, 5)
ref <- refine(X = rhc_X[samp, cov_samp], z = rhc_X[samp, "z"])
plot(ref)


[Package optrefine version 1.1.0 Index]