knitr::opts_chunk$set(
  collapse = TRUE,
  fig.align = "center",
  comment = "#>",
  fig.path = "man/figures/figures-"
)

sensemakr: Sensitivity Analysis Tools for OLS

Travis-CI build Status Appveyor build status CRAN status Coverage status Downloads

sensemakr implements a suite of sensitivity analysis tools that extends the traditional omitted variable bias framework and makes it easier to understand the impact of omitted variables in regression models, as discussed in Cinelli, C. and Hazlett, C. (2020) "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).

News

Details

For theoretical details, please see the JRSS-B paper.

For a practical introduction, please see the software paper or see the package vignettes.

For a quick start, watch the 15 min tutorial on sensitivity analysis using sensemakr prepared for useR! 2020:

CRAN

To install the current CRAN version run:

install.packages("sensemakr")

Development version

To install the development version on GitHub make sure you have the package devtools installed.

# install.packages("devtools") 
devtools::install_github("chadhazlett/sensemakr")

Citation

Please use the following citations:

Basic usage

# loads package
library(sensemakr)

# loads dataset
data("darfur")

# runs regression model
model <- lm(peacefactor ~ directlyharmed + age + farmer_dar + herder_dar +
                         pastvoted + hhsize_darfur + female + village, data = darfur)

# runs sensemakr for sensitivity analysis
sensitivity <- sensemakr(model = model, 
                         treatment = "directlyharmed",
                         benchmark_covariates = "female",
                         kd = 1:3)

# short description of results
sensitivity

# long description of results
summary(sensitivity)

# plot bias contour of point estimate
plot(sensitivity)

# plot bias contour of t-value
plot(sensitivity, sensitivity.of = "t-value")

# plot bias contour of lower limit of confidence interval
plot(sensitivity, sensitivity.of = "lwr")

# plot extreme scenario
plot(sensitivity, type = "extreme")

# latex code for sensitivity table
ovb_minimal_reporting(sensitivity)
# html code for sensitivity table
ovb_minimal_reporting(sensitivity, format = "pure_html")


chadhazlett/sensemakr documentation built on Dec. 12, 2023, 11:20 a.m.