plot.auto_strata: Plot method for 'auto_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. There are four 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. "AC" - produces a Assignment-Control plot of individuals within a stratum

  4. "residual" - produces a residual plot for the prognostic model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'auto_strata'
plot(
  x,
  type = "SR",
  label = FALSE,
  stratum = "all",
  strata_lines = TRUE,
  jitter_prognosis,
  jitter_propensity,
  propensity,
  ...
)

Arguments

x

an auto_strata object returned by auto_stratify

type

string giving the plot type (default = "SR"). Other options are "hist", "AC" 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

stratum

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

strata_lines

default = TRUE. Ignored unless type = "AC". If TRUE, lines on the plot indicate strata cut points.

jitter_prognosis

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

jitter_propensity

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

propensity

ignored unless type = "hist" or type = "AC". 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.

...

other arguments

See Also

Aikens, Greaves, and Baiocchi (2020) in Statistics in Medicine, Section 3.2 for an explaination of Assignment-Control plots (formerly "Fisher-Mill" plots).

plot.manual_strata

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 = "AC", propensity = treat ~ X1, stratum = 1)
plot(a.strat, type = "residual")

raikens1/stratamatch documentation built on May 27, 2021, 10:13 p.m.