-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathREADME.Rmd
111 lines (78 loc) · 4.37 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/konfound)](https://cran.r-project.org/package=konfound)
[![R-CMD-check](https://github.com/konfound-project/konfound/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/konfound-project/konfound/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/gh/konfound-project/konfound/graph/badge.svg?token=ARijYlxn7O)](https://app.codecov.io/gh/konfound-project/konfound)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05779/status.svg)](https://doi.org/10.21105/joss.05779)
<!-- badges: end -->
# konfound
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.
# Installation
You can install the CRAN version of konfound with:
```{r, eval = F}
install.packages("konfound")
```
You can install the development version from GitHub with:
```{r gh-installation, eval = FALSE}
install.packages("devtools")
devtools::install_github("konfound-project/konfound")
```
# Use of konfound
## pkonfound() for published studies
`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"`.
```{r, eval = T}
library(konfound)
```
```{r}
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() for models fit in R
`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`:
```{r}
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:
```{r}
konfound(m1, wt)
```
Similar to `pkonfound`, ITCV can be generated by specifying `index = "IT"`.
```{r}
konfound(m1, wt, index = "IT")
```
## mkonfound for meta-analyses including sensitivity analysis
`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`.
```{r}
mkonfound_ex
mkonfound(mkonfound_ex, t, df)
```
# Other information
### How to learn more about sensitivity analysis
To learn more about sensitivity analysis, please visit:
* The [KonFound-It website](https://konfound-it.org/), with latest news, links to tools and support
* The [Introduction to konfound vignette](https://konfound-it.org/konfound/articles/introduction-to-konfound.html), with detailed information about each of the functions (`pkonfound()`, `konfound()`, and `mkounfound()`)
* The [Konfound-It! interactive web application](https://konfound-project.shinyapps.io/konfound-it/), with links to PowerPoints and key publications
### Issues, feature requests, and contributing
We prefer for issues to be filed via GitHub (link to the issues page for `konfound` [here](https://github.com/konfound-project/konfound/issues)) though we also welcome questions or feedback requests via email (see the DESCRIPTION file).
Contributing guidelines are [here](https://github.com/konfound-project/konfound/blob/master/.github/CONTRIBUTING.md).
### Code of Conduct
Please note that the konfound project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.