Skip to contents

Creates a plot showing how treatment effect estimates change under different assumptions about the degree of unobserved confounding, following the framework of Cinelli and Hazlett (2020).

Usage

sensitivity_plot(
  estimate,
  se,
  r2dz_x = seq(0, 0.3, 0.01),
  r2yz_dx = seq(0, 0.3, 0.01),
  benchmark_r2 = NULL,
  conf_level = 0.95,
  title = "Sensitivity to Unobserved Confounding"
)

Arguments

estimate

Numeric. The point estimate of the treatment effect.

se

Numeric. The standard error of the estimate.

r2dz_x

Numeric vector. Partial R-squared of the confounder with the treatment (x-axis values to plot). Default is seq(0, 0.3, 0.01).

r2yz_dx

Numeric vector. Partial R-squared of the confounder with the outcome. Default is seq(0, 0.3, 0.01).

benchmark_r2

Optional named list of benchmark partial R-squared values, e.g., list("Age" = c(r2dz = 0.05, r2yz = 0.1)).

conf_level

Numeric. Confidence level. Default is 0.95.

title

Character. Plot title.

Value

A ggplot2 object showing contour lines of adjusted estimates.

References

Cinelli, C. and Hazlett, C. (2020). "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society: Series B, 82(1), 39-67.