knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The goal of konfound
is to carry out sensitivity analysis to help analysts to quantify how robust inferences are to potential sources of bias. This R package provides tools to carry out sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) based on Rubin’s (1974) causal model as well as in Frank (2000) based on the impact threshold for a confounding variable.
You can install the CRAN version of konfound with:
install.packages("konfound")
You can install the development version from GitHub with:
install.packages("devtools") devtools::install_github("konfound-project/konfound")
pkonfound()
, for published studies, calculates (1) how much bias there must be in an estimate to invalidate/sustain an inference, and interprets in terms of how much data would need to be replaced to nullify an inference (Robustness of an Inference to Replacement, RIR); (2) the impact of an omitted variable necessary to invalidate/sustain an inference for a regression coefficient (Impact Threshold of a Confounding Variable, ITCV). RIR is reported by default. ITCV can be generated by specifying index = "IT"
.
library(konfound)
pkonfound(est_eff = 2, std_err = .4, n_obs = 100, n_covariates = 3) pkonfound(est_eff = 2, std_err = .4, n_obs = 100, n_covariates = 3, index = "IT")
konfound()
calculates the robustness of inferences for models fit in R. For example, below are the coefficients for a linear model fit with lm()
using the built-in dataset mtcars
:
m1 <- lm(mpg ~ wt + disp, data = mtcars) m1 summary(m1)
Sensitivity analysis for the effect for wt
on mpg
can be carried out as follows, specifying the fitted model object:
konfound(m1, wt)
Similar to pkonfound
, ITCV can be generated by specifying index = "IT"
.
konfound(m1, wt, index = "IT")
mkonfound()
supports sensitivity that can be compared or synthesized across multiple analyses. We can use an existing (and built-in) dataset, such as mkonfound_ex
.
mkonfound_ex
mkonfound(mkonfound_ex, t, df)
To learn more about sensitivity analysis, please visit:
pkonfound()
, konfound()
, and mkounfound()
)We prefer for issues to be filed via GitHub (link to the issues page for konfound
here) though we also welcome questions or feedback requests via email (see the DESCRIPTION file).
Contributing guidelines are here.
Please note that the konfound project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.