Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge in changes from master branch #93

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
udpate readme to include ITCV
  • Loading branch information
qinyun-lin committed Oct 15, 2024
commit cd47e2eaf7f2eae7327d7340b5f7523983c19be8
12 changes: 11 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ devtools::install_github("konfound-project/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; (2) the impact of an omitted variable necessary to invalidate/sustain an inference for a regression coefficient:
`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)
@@ -53,6 +53,11 @@ 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
@@ -71,6 +76,11 @@ Sensitivity analysis for the effect for `wt` on `mpg` can be carried out as foll
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`.
71 changes: 69 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -40,8 +40,11 @@ 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; (2) the impact of an omitted variable necessary to
invalidate/sustain an inference for a regression coefficient:
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
library(konfound)
@@ -76,6 +79,39 @@ pkonfound(est_eff = 2,
#> For other forms of output, run
#> ?pkonfound and inspect the to_return argument
#> For models fit in R, consider use of konfound().
pkonfound(est_eff = 2,
std_err = .4,
n_obs = 100,
n_covariates = 3,
index = "IT")
#> Impact Threshold for a Confounding Variable (ITCV):
#>
#> The minimum impact of an omitted variable to invalidate an inference for
#> a null hypothesis of an effect of nu (0) is based on a correlation of 0.566
#> with the outcome and 0.566 with the predictor of interest (conditioning
#> on all observed covariates in the model; signs are interchangeable). This is
#> based on a threshold effect of 0.2 for statistical significance (alpha = 0.05).
#>
#> Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be
#> 0.566 X 0.566 = 0.321 to invalidate an inference for a null hypothesis of an effect of nu (0).
#>
#> For calculation of unconditional ITCV using pkonfound(), additionally include
#> the R2, sdx, and sdy as input, and request raw output.
#>
#> See Frank (2000) for a description of the method.
#>
#> Citation:
#> Frank, K. (2000). Impact of a confounding variable on the inference of a
#> regression coefficient. Sociological Methods and Research, 29 (2), 147-194
#>
#> Accuracy of results increases with the number of decimals reported.
#>
#> The ITCV analysis was originally derived for OLS standard errors. If the
#> standard errors reported in the table were not based on OLS, some caution
#> should be used to interpret the ITCV.
#> For other forms of output, run
#> ?pkonfound and inspect the to_return argument
#> For models fit in R, consider use of konfound().
```

## konfound() for models fit in R
@@ -141,6 +177,37 @@ konfound(m1, wt)
#> NULL
```

Similar to `pkonfound`, ITCV can be generated by specifying
`index = "IT"`.

``` r
konfound(m1, wt, index = "IT")
#> Impact Threshold for a Confounding Variable (ITCV):
#>
#> The minimum (in absolute value) impact of an omitted variable to invalidate
#> an inference for a null hypothesis of an effect of nu (0) is based on
#> a correlation of -0.425 with the outcome and 0.425 with the predictor of
#> interest (conditioning on all observed covariates in the model; signs are
#> interchangeable). This is based on a threshold effect of -0.355 for statistical
#> significance (alpha = 0.05).
#>
#> Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be
#> -0.425 X 0.425 = -0.18 to invalidate an inference for a null hypothesis of an effect of nu (0).
#>
#> See Frank (2000) for a description of the method.
#>
#> Citation:
#> Frank, K. (2000). Impact of a confounding variable on the inference of a
#> regression coefficient. Sociological Methods and Research, 29 (2), 147-194
#>
#> Accuracy of results increases with the number of decimals reported.
#>
#> The ITCV analysis was originally derived for OLS standard errors. If the
#> standard errors reported in the table were not based on OLS, some caution
#> should be used to interpret the ITCV.
#> NULL
```

## mkonfound for meta-analyses including sensitivity analysis

`mkonfound()` supports sensitivity that can be compared or synthesized
Loading