Last updated on 2020-07-25 05:48:39 CEST.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.2.1 | 5.05 | 59.89 | 64.94 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 0.2.1 | 4.43 | 45.48 | 49.91 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 0.2.1 | 85.05 | ERROR | |||
r-devel-linux-x86_64-fedora-gcc | 0.2.1 | 73.80 | ERROR | |||
r-devel-windows-ix86+x86_64 | 0.2.1 | 20.00 | 96.00 | 116.00 | ERROR | |
r-patched-linux-x86_64 | 0.2.1 | 5.92 | 58.16 | 64.08 | ERROR | |
r-patched-solaris-x86 | 0.2.1 | 108.80 | ERROR | |||
r-release-linux-x86_64 | 0.2.1 | 5.70 | 58.87 | 64.57 | ERROR | |
r-release-windows-ix86+x86_64 | 0.2.1 | 11.00 | 70.00 | 81.00 | ERROR | |
r-oldrel-macos-x86_64 | 0.2.1 | NOTE | ||||
r-oldrel-windows-ix86+x86_64 | 0.2.1 | 9.00 | 69.00 | 78.00 | ERROR |
Version: 0.2.1
Check: examples
Result: ERROR
Running examples in 'konfound-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: konfound
> ### Title: Perform sensitivity analysis on fitted models
> ### Aliases: konfound
>
> ### ** Examples
>
> # using lm() for linear models
> m1 <- lm(mpg ~ wt + hp, data = mtcars)
> konfound(m1, wt)
Percent Bias Necessary to Invalidate the Inference:
To invalidate an inference, 66.664% of the estimate would have to be due to bias. This is based on a threshold of -1.293 for statistical significance (alpha = 0.05).
To invalidate an inference, 21 observations would have to be replaced with cases for which the effect is 0.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 0.787 with the outcome and at 0.787 with the predictor of interest (conditioning on observed covariates) based on a threshold of -0.36 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 0.787 X 0.787 = 0.619 to invalidate an inference for a null hypothesis of 0 effect.
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
For more detailed output, consider setting `to_return` to table
To consider other predictors of interest, consider setting `test_all` to TRUE.
> konfound(m1, wt, test_all = TRUE)
Note that this output is calculated based on the correlation-based approach used in mkonfound()
Warning in data.frame(t = est_eff/std_err, df = (n_obs - n_covariates - :
row names were found from a short variable and have been discarded
# A tibble: 2 x 8
var_name t df action inference pct_bias_to_change_in~ itcv r_con
<chr> <dbl> <dbl> <chr> <chr> <dbl> <dbl> <dbl>
1 wt -6.13 30 to_invali~ reject_null 53.1 0.609 0.78
2 hp -3.56 30 to_invali~ reject_null 35.8 0.3 0.548
> konfound(m1, wt, to_return = "table")
Dependent variable is mpg
Warning: Unknown or uninitialised column: `itcv`.
Warning: Unknown or uninitialised column: `impact`.
# A tibble: 3 x 7
term estimate std.error statistic p.value itcv impact
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 37.2 1.60 23.3 0 NA NA
2 wt -3.88 0.633 -6.13 0 0.62 NA
3 hp -0.032 0.009 -3.52 0.001 NA 0.511
>
> # using glm() for non-linear models
> if (requireNamespace("forcats")) {
+ d <- forcats::gss_cat
+
+ d$married <- ifelse(d$marital == "Married", 1, 0)
+
+ m2 <- glm(married ~ age, data = d, family = binomial(link = "logit"))
+ konfound(m2, age)
+ }
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Percent Bias Necessary to Invalidate the Inference:
To sustain an inference, 80.978% of the estimate would have to be due to bias. This is based on a threshold of 0.013 for statistical significance (alpha = 0.05).
To sustain an inference, 17334 of the cases with 0 effect would have to be replaced with cases at the threshold of inference.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 5.535 with the outcome and at 5.535 with the predictor of interest (conditioning on observed covariates) based on a threshold of 1.003 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 5.535 X 5.535 = 30.636 to invalidate an inference for a null hypothesis of 0 effect.
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
NULL
>
> # using lme4 for mixed effects (or multi-level) models
> if (requireNamespace("lme4")) {
+ library(lme4)
+ m3 <- fm1 <- lme4::lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
+ konfound(m3, Days)
+ }
Loading required namespace: lme4
Loading required package: Matrix
Error: No tidy method for objects of class lmerMod
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.2.1
Check: tests
Result: ERROR
Running 'testthat.R' [6s/7s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
-- 1. Error: (unknown) (@test-mkonfound.r#12) ---------------------------------
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
-- 2. Error: (unknown) (@test-pkonfound.R#11) ---------------------------------
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
== testthat results ===========================================================
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.2.1
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building 'introduction-to-konfound.Rmd' using rmarkdown
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Quitting from lines 173-178 (introduction-to-konfound.Rmd)
Error: processing vignette 'introduction-to-konfound.Rmd' failed with diagnostics:
No tidy method for objects of class lmerMod
--- failed re-building 'introduction-to-konfound.Rmd'
SUMMARY: processing the following file failed:
'introduction-to-konfound.Rmd'
Error: Vignette re-building failed.
Execution halted
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-patched-linux-x86_64, r-release-linux-x86_64
Version: 0.2.1
Check: examples
Result: ERROR
Running examples in ‘konfound-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: konfound
> ### Title: Perform sensitivity analysis on fitted models
> ### Aliases: konfound
>
> ### ** Examples
>
> # using lm() for linear models
> m1 <- lm(mpg ~ wt + hp, data = mtcars)
> konfound(m1, wt)
Percent Bias Necessary to Invalidate the Inference:
To invalidate an inference, 66.664% of the estimate would have to be due to bias. This is based on a threshold of -1.293 for statistical significance (alpha = 0.05).
To invalidate an inference, 21 observations would have to be replaced with cases for which the effect is 0.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 0.787 with the outcome and at 0.787 with the predictor of interest (conditioning on observed covariates) based on a threshold of -0.36 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 0.787 X 0.787 = 0.619 to invalidate an inference for a null hypothesis of 0 effect.
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
For more detailed output, consider setting `to_return` to table
To consider other predictors of interest, consider setting `test_all` to TRUE.
> konfound(m1, wt, test_all = TRUE)
Note that this output is calculated based on the correlation-based approach used in mkonfound()
Warning in data.frame(t = est_eff/std_err, df = (n_obs - n_covariates - :
row names were found from a short variable and have been discarded
# A tibble: 2 x 8
var_name t df action inference pct_bias_to_change_in… itcv r_con
<chr> <dbl> <dbl> <chr> <chr> <dbl> <dbl> <dbl>
1 wt -6.13 30 to_invali… reject_null 53.1 0.609 0.78
2 hp -3.56 30 to_invali… reject_null 35.8 0.3 0.548
> konfound(m1, wt, to_return = "table")
Dependent variable is mpg
Warning: Unknown or uninitialised column: `itcv`.
Warning: Unknown or uninitialised column: `impact`.
# A tibble: 3 x 7
term estimate std.error statistic p.value itcv impact
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 37.2 1.60 23.3 0 NA NA
2 wt -3.88 0.633 -6.13 0 0.62 NA
3 hp -0.032 0.009 -3.52 0.001 NA 0.511
>
> # using glm() for non-linear models
> if (requireNamespace("forcats")) {
+ d <- forcats::gss_cat
+
+ d$married <- ifelse(d$marital == "Married", 1, 0)
+
+ m2 <- glm(married ~ age, data = d, family = binomial(link = "logit"))
+ konfound(m2, age)
+ }
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Percent Bias Necessary to Invalidate the Inference:
To sustain an inference, 80.978% of the estimate would have to be due to bias. This is based on a threshold of 0.013 for statistical significance (alpha = 0.05).
To sustain an inference, 17334 of the cases with 0 effect would have to be replaced with cases at the threshold of inference.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 5.535 with the outcome and at 5.535 with the predictor of interest (conditioning on observed covariates) based on a threshold of 1.003 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 5.535 X 5.535 = 30.636 to invalidate an inference for a null hypothesis of 0 effect.
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
NULL
>
> # using lme4 for mixed effects (or multi-level) models
> if (requireNamespace("lme4")) {
+ library(lme4)
+ m3 <- fm1 <- lme4::lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
+ konfound(m3, Days)
+ }
Loading required namespace: lme4
Loading required package: Matrix
Error: No tidy method for objects of class lmerMod
Execution halted
Flavors: r-devel-linux-x86_64-debian-gcc, r-patched-linux-x86_64, r-release-linux-x86_64
Version: 0.2.1
Check: tests
Result: ERROR
Running ‘testthat.R’ [4s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
── 1. Error: (unknown) (@test-mkonfound.r#12) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
── 2. Error: (unknown) (@test-pkonfound.R#11) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.2.1
Check: dependencies in R code
Result: NOTE
Namespace in Imports field not imported from: ‘mice’
All declared Imports should be used.
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-patched-solaris-x86, r-oldrel-macos-x86_64
Version: 0.2.1
Check: examples
Result: ERROR
Running examples in ‘konfound-Ex.R’ failed
The error most likely occurred in:
> ### Name: konfound
> ### Title: Perform sensitivity analysis on fitted models
> ### Aliases: konfound
>
> ### ** Examples
>
> # using lm() for linear models
> m1 <- lm(mpg ~ wt + hp, data = mtcars)
> konfound(m1, wt)
Percent Bias Necessary to Invalidate the Inference:
To invalidate an inference, 66.664% of the estimate would have to be due to bias. This is based on a threshold of -1.293 for statistical significance (alpha = 0.05).
To invalidate an inference, 21 observations would have to be replaced with cases for which the effect is 0.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 0.787 with the outcome and at 0.787 with the predictor of interest (conditioning on observed covariates) based on a threshold of -0.36 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 0.787 X 0.787 = 0.619 to invalidate an inference for a null hypothesis of 0 effect.
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
For more detailed output, consider setting `to_return` to table
To consider other predictors of interest, consider setting `test_all` to TRUE.
> konfound(m1, wt, test_all = TRUE)
Note that this output is calculated based on the correlation-based approach used in mkonfound()
Warning in data.frame(t = est_eff/std_err, df = (n_obs - n_covariates - :
row names were found from a short variable and have been discarded
# A tibble: 2 x 8
var_name t df action inference pct_bias_to_change_in… itcv r_con
<chr> <dbl> <dbl> <chr> <chr> <dbl> <dbl> <dbl>
1 wt -6.13 30 to_invali… reject_null 53.1 0.609 0.78
2 hp -3.56 30 to_invali… reject_null 35.8 0.3 0.548
> konfound(m1, wt, to_return = "table")
Dependent variable is mpg
Warning: Unknown or uninitialised column: `itcv`.
Warning: Unknown or uninitialised column: `impact`.
# A tibble: 3 x 7
term estimate std.error statistic p.value itcv impact
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 37.2 1.60 23.3 0 NA NA
2 wt -3.88 0.633 -6.13 0 0.62 NA
3 hp -0.032 0.009 -3.52 0.001 NA 0.511
>
> # using glm() for non-linear models
> if (requireNamespace("forcats")) {
+ d <- forcats::gss_cat
+
+ d$married <- ifelse(d$marital == "Married", 1, 0)
+
+ m2 <- glm(married ~ age, data = d, family = binomial(link = "logit"))
+ konfound(m2, age)
+ }
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Percent Bias Necessary to Invalidate the Inference:
To sustain an inference, 80.978% of the estimate would have to be due to bias. This is based on a threshold of 0.013 for statistical significance (alpha = 0.05).
To sustain an inference, 17334 of the cases with 0 effect would have to be replaced with cases at the threshold of inference.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 5.535 with the outcome and at 5.535 with the predictor of interest (conditioning on observed covariates) based on a threshold of 1.003 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 5.535 X 5.535 = 30.636 to invalidate an inference for a null hypothesis of 0 effect.
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
NULL
>
> # using lme4 for mixed effects (or multi-level) models
> if (requireNamespace("lme4")) {
+ library(lme4)
+ m3 <- fm1 <- lme4::lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
+ konfound(m3, Days)
+ }
Loading required namespace: lme4
Loading required package: Matrix
Error: No tidy method for objects of class lmerMod
Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-patched-solaris-x86
Version: 0.2.1
Check: tests
Result: ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
── 1. Error: (unknown) (@test-mkonfound.r#12) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
── 2. Error: (unknown) (@test-pkonfound.R#11) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc
Version: 0.2.1
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
--- re-building ‘introduction-to-konfound.Rmd’ using rmarkdown
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Quitting from lines 173-178 (introduction-to-konfound.Rmd)
Error: processing vignette 'introduction-to-konfound.Rmd' failed with diagnostics:
No tidy method for objects of class lmerMod
--- failed re-building ‘introduction-to-konfound.Rmd’
SUMMARY: processing the following file failed:
‘introduction-to-konfound.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-ix86+x86_64, r-release-windows-ix86+x86_64, r-oldrel-windows-ix86+x86_64
Version: 0.2.1
Check: examples
Result: ERROR
Running examples in 'konfound-Ex.R' failed
The error most likely occurred in:
> ### Name: konfound
> ### Title: Perform sensitivity analysis on fitted models
> ### Aliases: konfound
>
> ### ** Examples
>
> # using lm() for linear models
> m1 <- lm(mpg ~ wt + hp, data = mtcars)
> konfound(m1, wt)
Percent Bias Necessary to Invalidate the Inference:
To invalidate an inference, 66.664% of the estimate would have to be due to bias. This is based on a threshold of -1.293 for statistical significance (alpha = 0.05).
To invalidate an inference, 21 observations would have to be replaced with cases for which the effect is 0.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 0.787 with the outcome and at 0.787 with the predictor of interest (conditioning on observed covariates) based on a threshold of -0.36 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 0.787 X 0.787 = 0.619 to invalidate an inference for a null hypothesis of 0 effect.
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
For more detailed output, consider setting `to_return` to table
To consider other predictors of interest, consider setting `test_all` to TRUE.
> konfound(m1, wt, test_all = TRUE)
Note that this output is calculated based on the correlation-based approach used in mkonfound()
Warning in data.frame(t = est_eff/std_err, df = (n_obs - n_covariates - :
row names were found from a short variable and have been discarded
# A tibble: 2 x 8
var_name t df action inference pct_bias_to_change_in~ itcv r_con
<chr> <dbl> <dbl> <chr> <chr> <dbl> <dbl> <dbl>
1 wt -6.13 30 to_invali~ reject_null 53.1 0.609 0.78
2 hp -3.56 30 to_invali~ reject_null 35.8 0.3 0.548
> konfound(m1, wt, to_return = "table")
Dependent variable is mpg
Warning: Unknown or uninitialised column: `itcv`.
Warning: Unknown or uninitialised column: `impact`.
# A tibble: 3 x 7
term estimate std.error statistic p.value itcv impact
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 37.2 1.60 23.3 0 NA NA
2 wt -3.88 0.633 -6.13 0 0.62 NA
3 hp -0.032 0.009 -3.52 0.001 NA 0.511
>
> # using glm() for non-linear models
> if (requireNamespace("forcats")) {
+ d <- forcats::gss_cat
+
+ d$married <- ifelse(d$marital == "Married", 1, 0)
+
+ m2 <- glm(married ~ age, data = d, family = binomial(link = "logit"))
+ konfound(m2, age)
+ }
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Percent Bias Necessary to Invalidate the Inference:
To sustain an inference, 80.978% of the estimate would have to be due to bias. This is based on a threshold of 0.013 for statistical significance (alpha = 0.05).
To sustain an inference, 17334 of the cases with 0 effect would have to be replaced with cases at the threshold of inference.
See Frank et al. (2013) for a description of the method
Citation: Frank, K.A., Maroulis, S., Duong, M., and Kelcey, B. 2013. What would it take to change an inference? Using Rubin's causal model to interpret the robustness of causal inferences. Education, Evaluation and Policy Analysis, 35 437-460.
Impact Threshold for a Confounding Variable:
The minimum impact to invalidate an inference for a null hypothesis of 0 effect is based on a correlation of 5.535 with the outcome and at 5.535 with the predictor of interest (conditioning on observed covariates) based on a threshold of 1.003 for statistical significance (alpha = 0.05).
Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be 5.535 X 5.535 = 30.636 to invalidate an inference for a null hypothesis of 0 effect.
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
NULL
>
> # using lme4 for mixed effects (or multi-level) models
> if (requireNamespace("lme4")) {
+ library(lme4)
+ m3 <- fm1 <- lme4::lmer(Reaction ~ Days + (1 | Subject), sleepstudy)
+ konfound(m3, Days)
+ }
Loading required namespace: lme4
Loading required package: Matrix
Error: No tidy method for objects of class lmerMod
Execution halted
Flavors: r-devel-windows-ix86+x86_64, r-release-windows-ix86+x86_64, r-oldrel-windows-ix86+x86_64
Version: 0.2.1
Check: tests
Result: ERROR
Running 'testthat.R' [7s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
-- 1. Error: (unknown) (@test-mkonfound.r#12) ---------------------------------
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
-- 2. Error: (unknown) (@test-pkonfound.R#11) ---------------------------------
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
== testthat results ===========================================================
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-windows-ix86+x86_64
Version: 0.2.1
Check: tests
Result: ERROR
Running ‘testthat.R’ [6s/7s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
── 1. Error: (unknown) (@test-mkonfound.r#12) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
── 2. Error: (unknown) (@test-pkonfound.R#11) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavor: r-patched-linux-x86_64
Version: 0.2.1
Check: tests
Result: ERROR
Running ‘testthat.R’ [9s/13s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
── 1. Error: (unknown) (@test-mkonfound.r#12) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
── 2. Error: (unknown) (@test-pkonfound.R#11) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavor: r-patched-solaris-x86
Version: 0.2.1
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building ‘introduction-to-konfound.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
Loading required namespace: forcats
Note that for a non-linear model, impact threshold should not be interpreted.
Note that this is only an approximation. For exact results in terms of the number of cases that must be switched from treatment success to treatment failure to invalidate the inference see: https://msu.edu/~kenfrank/non%20linear%20replacement%20treatment.xlsm
Quitting from lines 173-178 (introduction-to-konfound.Rmd)
Error: processing vignette 'introduction-to-konfound.Rmd' failed with diagnostics:
No tidy method for objects of class lmerMod
--- failed re-building ‘introduction-to-konfound.Rmd’
SUMMARY: processing the following file failed:
‘introduction-to-konfound.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-patched-solaris-x86
Version: 0.2.1
Check: tests
Result: ERROR
Running ‘testthat.R’ [5s/6s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
── 1. Error: (unknown) (@test-mkonfound.r#12) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
── 2. Error: (unknown) (@test-pkonfound.R#11) ─────────────────────────────────
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavor: r-release-linux-x86_64
Version: 0.2.1
Check: tests
Result: ERROR
Running 'testthat.R' [5s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(konfound)
Sensitivity analysis as described in Frank, Maroulis, Duong, and Kelcey (2013) and in Frank (2000).
For more information visit http://konfound-it.com.
>
> test_check("konfound")
-- 1. Error: (unknown) (@test-mkonfound.r#12) ---------------------------------
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
-- 2. Error: (unknown) (@test-pkonfound.R#11) ---------------------------------
No tidy method for objects of class lmerMod
Backtrace:
1. konfound::konfound(testmod2, texp, test_all = TRUE, to_return = "raw_output")
2. konfound:::konfound_lmer(...)
4. broom:::tidy.default(model_object)
== testthat results ===========================================================
[ OK: 0 | SKIPPED: 0 | WARNINGS: 2 | FAILED: 2 ]
1. Error: (unknown) (@test-mkonfound.r#12)
2. Error: (unknown) (@test-pkonfound.R#11)
Error: testthat unit tests failed
Execution halted
Flavors: r-release-windows-ix86+x86_64, r-oldrel-windows-ix86+x86_64