plot.strata: Plot method for 'strata' object

Description Usage Arguments See Also Examples

View source: R/S3_methods.R

Description

Generates diagnostic plots for the product of a stratification by auto_stratify or manual_stratify. There are three plot types:

  1. "SR" (default) - produces a scatter plot of strata by size and treat:control ratio

  2. "hist" - produces a histogram of propensity scores within a stratum

  3. "FM" - produces a Fisher-Mill plot of individuals within a stratum (not supported for manual strata objects)

  4. "residual" - produces a residual plot for the prognostic model (not supported for manual strata objects)

Usage

1
2
3
## S3 method for class 'strata'
plot(x, type = "SR", label = FALSE, jitter_prognosis,
  jitter_propensity, propensity, stratum, ...)

Arguments

x

a strata object returned by auto_stratify or manual_stratify

type

string giving the plot type (default = "SR"). Other options are "hist", "FM" and "residual"

label

ignored unless type = "SR". If TRUE, a clickable plot is produced. The user may click on any number of strata and press finish to have those strata labeled. Note: uses identify, which may not be supported on some devices

jitter_prognosis

ignored unless type = "FM". Amount of uniform random noise to add to prognostic scores in plot.

jitter_propensity

ignored unless type = "FM". Amount of uniform random noise to add to propensity scores in plot.

propensity

ignored unless type = "hist" or type = "FM". Specifies propensity score information for plots where this is required. Accepts either a vector of propensity scores, a glm model for propensity scores, or a formula for fitting a propensity score model.

stratum

ignored unless type = "hist" or type = "FM". A number specifying which stratum to plot.

...

other arguments

See Also

Aikens et al. (preprint) https://arxiv.org/abs/1908.09077 . Section 3.2 for an explaination of Fisher-Mill plots

Examples

1
2
3
4
5
6
dat <- make_sample_data()
a.strat <- auto_stratify(dat, "treat", outcome ~ X1 + X2)
plot(a.strat) # makes size-ratio scatter plot
plot(a.strat, type = "hist", propensity = treat ~ X1, stratum = 1)
plot(a.strat, type = "FM", propensity = treat ~ X1, stratum = 1)
plot(a.strat, type = "residual")

raikens1/stratamatch documentation built on Aug. 6, 2020, 7:29 a.m.