An open API service indexing awesome lists of open source software.

https://github.com/carloscinelli/sensemakr

Suite of sensitivity analysis tools for OLS
https://github.com/carloscinelli/sensemakr

Last synced: 7 months ago
JSON representation

Suite of sensitivity analysis tools for OLS

Awesome Lists containing this project

README

          

---
output: github_document
editor_options:
chunk_output_type: console
---

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

# sensemakr: Sensitivity Analysis Tools for OLS

[![CRAN status](https://www.r-pkg.org/badges/version/sensemakr)](https://CRAN.R-project.org/package=sensemakr)
[![Downloads](https://cranlogs.r-pkg.org/badges/sensemakr)](https://cran.r-project.org/package=sensemakr)
[![R-CMD-check](https://github.com/chadhazlett/sensemakr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/chadhazlett/sensemakr/actions/workflows/R-CMD-check.yaml)

`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).]( https://doi.org/10.1111/rssb.12348)

# News

- Watch the [useR! 2020 presentation](https://www.youtube.com/watch?v=p3dfHj6ki68) for a quick introduction on sensemakr.

- Check out the [software paper preprint](https://www.researchgate.net/publication/340965014_sensemakr_Sensitivity_Analysis_Tools_for_OLS_in_R_and_Stata)!

- Check out the [Stata version](https://github.com/resonance1/sensemakr-stata) of the package!

- Check out the [Python version](https://github.com/nlapier2/PySensemakr) of the package!

- Check out the Robustness Value Shiny App at: https://carloscinelli.shinyapps.io/robustness_value/

- Check out the [package website](http://carloscinelli.com/sensemakr/)!

# Details

For theoretical details, [please see the JRSS-B paper](https://www.researchgate.net/publication/322509816_Making_Sense_of_Sensitivity_Extending_Omitted_Variable_Bias).

For a practical introduction, [please see the software paper](https://www.researchgate.net/publication/340965014_sensemakr_Sensitivity_Analysis_Tools_for_OLS_in_R_and_Stata) or [see the package vignettes](http://carloscinelli.com/sensemakr/articles/sensemakr.html).

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:

```{r, eval = FALSE}
install.packages("sensemakr")
```

# Development version

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

```{r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("carloscinelli/sensemakr")
```

# Citation

Please use the following citations:

- [Cinelli, C., & Hazlett, C. (2020). "Making sense of sensitivity: Extending omitted variable bias." Journal of the Royal Statistical Society: Series B (Statistical Methodology), 82(1), 39-67.](https://doi.org/10.1111/rssb.12348)

- [Cinelli, C., & Ferwerda, J., & Hazlett, C. (2020). "sensemakr: Sensitivity Analysis Tools for OLS in R and Stata."](https://www.researchgate.net/publication/340965014_sensemakr_Sensitivity_Analysis_Tools_for_OLS_in_R_and_Stata)

# Basic usage

```{r basic-usage, fig.align='center', collapse=T, dpi=300}
# 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)
```

```{r results='asis'}
# html code for sensitivity table
ovb_minimal_reporting(sensitivity, format = "pure_html")
```