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

Newitcv output #83

Merged
merged 175 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
e299a50
add missing dois
jrosen48 Aug 14, 2023
2422f1d
Update README.md to include coding team meeting note link
qinyun-lin Aug 15, 2023
9fad343
fix typo in title
jrosen48 Aug 15, 2023
e78f146
Merge remote-tracking branch 'origin/master'
jrosen48 Aug 15, 2023
4cacb1a
Update README.md
qinyun-lin Aug 15, 2023
8f07241
change default to control group throughout
qinyun-lin Aug 21, 2023
c9acc79
fixed formatting issues with output
bretsw Sep 1, 2023
0c46c1a
Update helper_output_dataframe.R
wwang93 Oct 1, 2023
42c8ea4
Update nonlinear_auxiliary.R
wwang93 Oct 1, 2023
693a56f
Update helper_plot_threshold.R
wwang93 Oct 1, 2023
c5444b8
Update test_cop.R
wwang93 Oct 12, 2023
ed03a22
Update test_pse.R
wwang93 Oct 12, 2023
5d5b924
Update test_sensitivity_ln.R
wwang93 Oct 12, 2023
bd3f433
Update tkonfound.R
wwang93 Oct 12, 2023
bf509d6
Update tkonfound_fig.R
wwang93 Oct 13, 2023
a0b8bf2
Merge pull request #52 from bretsw/master
jrosen48 Oct 26, 2023
4953fa1
Merge pull request #55 from konfound-project/wwang93-patch-1-Update-h…
jrosen48 Oct 26, 2023
27131c2
Merge pull request #57 from konfound-project/wwang93-patch-1-Update-h…
jrosen48 Oct 26, 2023
cd8da79
Merge pull request #61 from konfound-project/wwang93-Update-tkonfound…
jrosen48 Oct 26, 2023
62b6c65
Merge pull request #59 from konfound-project/wwang93-Update-test_pse.…
jrosen48 Oct 26, 2023
f625c8b
Merge pull request #58 from konfound-project/wwang93-Update-test_cop.…
jrosen48 Oct 26, 2023
53b5a19
Merge pull request #60 from konfound-project/wwang93-Update-test_sens…
jrosen48 Oct 26, 2023
e799c2f
Merge pull request #62 from konfound-project/wwang93-Update-tkonfound…
jrosen48 Oct 26, 2023
4e78f40
Merge pull request #56 from konfound-project/wwang93-patch-1-Update-n…
jrosen48 Oct 26, 2023
70946d9
update nrow issue
jrosen48 Nov 28, 2023
60e2653
Merge branch 'master' of https://github.com/konfound-project/konfound
jrosen48 Nov 28, 2023
2fbcab4
add CONTRIBUTING and update README; also change email for JR
jrosen48 Nov 28, 2023
2ab5d4a
add CONTRIBUTING and update README; also change email for S narvaiz
jrosen48 Nov 28, 2023
e12cad8
update
jrosen48 Nov 29, 2023
7cbac4d
fix the bug pkonfound error #64
qinyun-lin Dec 4, 2023
78ec6f9
fix bug error with thresh_plot output #63
qinyun-lin Dec 5, 2023
f531155
Update links in DESCRIPTION
olivroy Jan 12, 2024
ddd044c
Merge pull request #68 from konfound-project/newitcv
qinyun-lin Feb 5, 2024
26b5868
remove rounding in itcv calculation
qinyun-lin Feb 7, 2024
feed54f
work on tests
jrosen48 Feb 8, 2024
4364b9b
move
jrosen48 Feb 8, 2024
ab1cc88
minor edits to tests
jrosen48 Feb 8, 2024
b07581d
to close #65 and to close #70
jrosen48 Feb 9, 2024
740600b
add tests
jrosen48 Feb 9, 2024
97069f0
update docs
jrosen48 Feb 9, 2024
4adcb2e
update docs
jrosen48 Feb 9, 2024
b72a75f
update README
jrosen48 Feb 9, 2024
353b130
add check badges
jrosen48 Feb 9, 2024
a2118eb
setting covr up again
jrosen48 Feb 9, 2024
2810fd0
undo lme4 edits
jrosen48 Feb 9, 2024
56b2c28
Revert "undo lme4 edits"
jrosen48 Feb 9, 2024
47fb22f
update Matrix depends
jrosen48 Feb 9, 2024
566e2f0
update lme4 version
jrosen48 Feb 9, 2024
f3746b6
update README
jrosen48 Feb 9, 2024
408fedb
edit description
jrosen48 Feb 9, 2024
b427205
update tests and docs
jrosen48 Feb 12, 2024
a316236
update testing with Qinyun
jrosen48 Feb 12, 2024
ade2997
get rid of test_all = TRUE
jrosen48 Feb 12, 2024
1f20639
remove test_all = TRUE
jrosen48 Feb 12, 2024
fcd4dfd
Merge pull request #72 from konfound-project/remove-test-all
jrosen48 Feb 12, 2024
12ae921
remove test_all = TRUE
jrosen48 Feb 12, 2024
d8d240f
Merge pull request #73 from konfound-project/remove-test-all
jrosen48 Feb 12, 2024
e68381b
Merge pull request #71 from konfound-project/improving-testing
jrosen48 Feb 13, 2024
34eb320
patch to konfound to address test_all = TRUE error
jrosen48 Feb 13, 2024
2b93188
add pkgdown action
jrosen48 Feb 13, 2024
164aa4e
address warnings in tests that were due to an unititialized column
jrosen48 Feb 13, 2024
805b21b
iterate version
jrosen48 Feb 13, 2024
43b19ae
fix minor discrepancy with package name
jrosen48 Feb 13, 2024
a566968
continue to update tests, remove unused code
jrosen48 Feb 13, 2024
ce5997b
further enhancing tests
jrosen48 Feb 13, 2024
a6ce0fe
add badges and update README
jrosen48 Feb 13, 2024
dd99195
address error in vignette
jrosen48 Feb 13, 2024
385496b
remove mention of functionality to call multiple forms of output at once
jrosen48 Feb 13, 2024
ba3bfe0
address error in mkonfound
jrosen48 Feb 13, 2024
458f912
remove calling of multiple forms of output
jrosen48 Feb 13, 2024
793040f
remove commented out code
jrosen48 Feb 13, 2024
eb3f9e3
address NOTES in R CMD CHECK
jrosen48 Feb 13, 2024
84d3196
add a few more tests
qinyun-lin Feb 13, 2024
b412100
Merge pull request #76 from konfound-project/add_testing
jrosen48 Feb 13, 2024
edde33c
address note about class(flag_cov)
jrosen48 Feb 13, 2024
3441ab5
Merge branch 'master' of https://github.com/konfound-project/konfound
jrosen48 Feb 13, 2024
f97d0b2
work on documentation to address imports issue
jrosen48 Feb 13, 2024
7c6fe29
edits to JOSS paper in response to feedback from @fartist and @wjaket…
jrosen48 Feb 14, 2024
36300e9
simplify the function test_sensitivity_ln
qinyun-lin Feb 14, 2024
95aad40
Merge pull request #77 from konfound-project/simplify_functions
jrosen48 Feb 14, 2024
138aeca
Merge pull request #66 from olivroy/patch-1
jrosen48 Feb 14, 2024
92b1353
minor edits to DESCRIPTION, removing aes_string and data_frame to add…
jrosen48 Feb 14, 2024
594332f
Update helper_output_print.R
JihoonChoi26 Feb 19, 2024
fda8af9
Update helper_output_print.R
JihoonChoi26 Feb 19, 2024
0b39585
Update cop_pse_auxiliary.R(F - FALSE) (#78)
wwang93 Feb 19, 2024
08632ee
addressing namespace issue - trying to rewrite the NAMESPACE and docs
jrosen48 Feb 20, 2024
dfb3e9d
delete dup doc file
jrosen48 Feb 20, 2024
7951370
remove glue and lifecycle
jrosen48 Feb 20, 2024
752d7e6
Merge pull request #79 from konfound-project/addressing-namespace-issue
jrosen48 Feb 20, 2024
95df1c7
make edits to remove import lavaan and import ggplot2
jrosen48 Feb 20, 2024
2dbfdad
remove summary function
jrosen48 Feb 20, 2024
d87f0d5
remove summary function to simplify codebase and address remaining NA…
jrosen48 Feb 20, 2024
f499f10
Merge pull request #80 from konfound-project/addressing-namespace-issue
jrosen48 Feb 20, 2024
a2ee5b9
Update paper.md
wwang93 Feb 20, 2024
d84a11a
Update paper.bib
wwang93 Feb 20, 2024
9ae72cb
Update paper.bib
wwang93 Feb 20, 2024
30641eb
Update paper.bib
wwang93 Feb 20, 2024
f0be35b
Update paper.bib
wwang93 Feb 20, 2024
d167e35
Update paper.bib
wwang93 Feb 20, 2024
5454ce3
edits to paper.bib to address APA issues
jrosen48 Feb 21, 2024
09c675f
edits to the paper and .bib to related to issues 3 and 5 in #80
jrosen48 Feb 21, 2024
80283da
minor edits to .bib
jrosen48 Feb 21, 2024
813fb6d
Update CONTRIBUTING.md
jrosen48 Feb 21, 2024
8f4897d
a few more edits to address formatting issues with the paper
jrosen48 Feb 21, 2024
48283c1
Merge branch 'master' of https://github.com/konfound-project/konfound
jrosen48 Feb 21, 2024
bb53752
a few more minor edits to the paper after viewing the rendered PDF
jrosen48 Feb 21, 2024
837ec57
update README to link to CONTRIBUTING.md and minor edits to paper.md …
jrosen48 Feb 21, 2024
77eec32
Update helper_output_print.R
JihoonChoi26 Feb 21, 2024
06d556f
Update CONTRIBUTING.md
jrosen48 Feb 21, 2024
308fbc3
edits to paper.bib and paper.md in response to request from @fabian-s…
jrosen48 Feb 22, 2024
4d461d1
minor edit to .bib
jrosen48 Feb 22, 2024
95cd69a
additional edits to .bib
jrosen48 Feb 22, 2024
97d6e08
fix bug when single predictor and test_all == T
qinyun-lin Feb 22, 2024
d0131aa
minor copy edits to paper
jrosen48 Feb 22, 2024
dbe97dd
Update helper_output_print.R
JihoonChoi26 Feb 22, 2024
7cd46dc
a few more edits in response to Ken's feedback
jrosen48 Feb 22, 2024
318071a
Update test_sensitivity_ln.R
JihoonChoi26 Feb 23, 2024
8381ef8
Update helper_output_print.R
JihoonChoi26 Feb 23, 2024
f2e1fdc
Update helper_output_print.R
JihoonChoi26 Feb 23, 2024
3a16309
Update helper_output_print.R
JihoonChoi26 Feb 23, 2024
1f7df46
Update helper_output_print.R
JihoonChoi26 Feb 24, 2024
0fb2b08
Update helper_output_print.R
JihoonChoi26 Feb 24, 2024
16cad9f
remove mice and tibble as they are not used
jrosen48 Feb 24, 2024
869b816
Revert "remove mice and tibble as they are not used"
jrosen48 Feb 24, 2024
7571f82
updates to links
jrosen48 Feb 25, 2024
2920732
add Wei to DESCRIPTION, remove unused license
jrosen48 Feb 25, 2024
37bbc7f
edit license
jrosen48 Feb 25, 2024
17ca542
rename license
jrosen48 Feb 25, 2024
e97ccf7
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
5144084
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
1408b45
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
892e58d
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
51f0f0b
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
f115249
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
4636cac
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
3afc23a
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
7c77c0a
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
f95d7c8
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
e919708
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
44f6e1d
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
97f5e0c
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
c1438f1
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
cd4158b
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
e457556
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
832db74
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
4fea462
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
ff24361
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
80d62e8
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
075f0cf
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
658f135
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
287afd6
Update konfound-lm.R
JihoonChoi26 Feb 26, 2024
8283b4a
Update konfound-lm.R
JihoonChoi26 Feb 26, 2024
5c61df5
Update konfound-lm.R
JihoonChoi26 Feb 26, 2024
1e9925b
Update konfound-lm.R
JihoonChoi26 Feb 26, 2024
765362b
Update konfound-lm.R
JihoonChoi26 Feb 26, 2024
af40a93
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
ff24c46
edits in response to @fabian-s feedback on the paper
jrosen48 Feb 26, 2024
9393001
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
a49cd98
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
cb4feac
Update helper_output_print.R
JihoonChoi26 Feb 26, 2024
17aa181
Update test_sensitivity_ln.R
JihoonChoi26 Feb 26, 2024
bf30566
Update test_sensitivity_ln.R
JihoonChoi26 Feb 26, 2024
11f9300
Update test_sensitivity_ln.R
JihoonChoi26 Feb 26, 2024
2a6522c
Update test_sensitivity_ln.R
JihoonChoi26 Feb 26, 2024
7547b5e
super small edit to the paper - changing &beta so it appears correctl…
jrosen48 Feb 27, 2024
ae1164c
fix the bug when est_eff_start = 0 and needtworows
qinyun-lin Mar 3, 2024
0c76fa1
update URL in README
jrosen48 Mar 9, 2024
9d05319
update urls
jrosen48 Mar 10, 2024
919dcae
CRAN submission
jrosen48 Mar 11, 2024
4f4604c
Update CONTRIBUTING.md
jrosen48 Mar 11, 2024
2317998
Merge branch 'master' of https://github.com/konfound-project/konfound
jrosen48 Mar 11, 2024
fba85b9
Update konfound.R
JihoonChoi26 Mar 13, 2024
04fbc43
update testing
qinyun-lin Mar 14, 2024
fc199f7
Merge branch 'master' into newitcv_output
qinyun-lin Mar 14, 2024
d2f75af
Revert "Merge branch 'master' into newitcv_output"
qinyun-lin Mar 14, 2024
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
85 changes: 41 additions & 44 deletions R/helper_output_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,60 @@ output_print <- function(est_eff, beta_threshhold, bias = NULL, sustain = NULL,
cat("\n")
cat(paste0("RIR = ", round(recase, 3), "\n"))
cat("\n")
cat(paste0("You entered an estimated effect of ", round(est_eff, 3), ". To invalidate"))
cat(paste0("The estimated effect is ", round(est_eff, 3), ". To invalidate the inference of an effect using"))
cat("\n")
cat(paste0("the inference of an effect using the threshold of ", round(beta_threshhold, 3), " for"))
cat(paste0("the threshold of ", round(beta_threshhold, 3), " for statistical significance with alpha = ", alpha, ", ", round(bias, 3), "% of"))
cat("\n")
cat(paste0("statistical significance with alpha = ", alpha, ", ", round(bias, 3), "% of the"))
cat(paste0("the (", round(est_eff, 3), ") estimate would have to be due to bias. This implies that to invalidate"))
cat("\n")
cat(paste0("(", round(est_eff, 3), ") estimate would have to be due to bias. This implies"))
cat(paste0("the inference one would expect to have to replace ", round(recase, 3), " (", round(bias, 3), "%) observations"))
cat("\n")
cat("that to invalidate the inference one would expect to have to\n")
cat(paste0("replace ", round(recase, 3), " (", round(bias, 3), "%) observations with cases for which the"))
cat("\n")
cat(paste0("treatment effect is ", nu, " (RIR = ", round(recase, 3), ").\n"))
cat(paste0("with cases for which the treatment effect is ", nu, " (RIR = ", round(recase, 3), ").\n"))
cat("\n")
} else if ((abs(est_eff) > abs(beta_threshhold)) & is.na(eff_thr) == FALSE) {
cat("TO INVALIDATE:\n")
cat("\n")
cat(paste0("RIR = ", round(recase, 3), "\n"))
cat("\n")
cat(paste0("You entered an effect of ", round(est_eff, 3), ", and specified a threshold"))
cat("\n")
cat(paste0("for inference of ", round(eff_thr, 3), ". To invalidate the inference based on your"))
cat(paste0("The estimated effect is ", round(est_eff, 3), ", and specified threshold for inference is ", round(eff_thr, 3), "."))
cat("\n")
cat(paste0("estimate, ", round(bias, 3), "% of the (", round(est_eff, 3), ") estimate would have to be due to"))
cat(paste0("To invalidate the inference based on your estimate, ", round(bias, 3), "% of the (", round(est_eff, 3), ")"))
cat("\n")
cat(paste0("bias. This implies that to invalidate the inference one would"))
cat(paste0("estimate would have to be due to bias. This implies that to invalidate"))
cat("\n")
cat(paste0("expect to have to replace ", round(recase, 3), " (", round(bias, 3), "%) observations with"))
cat(paste0("the inference one would expect to have to replace ", round(recase, 3), " (", round(bias, 3), "%) observation"))
cat("\n")
cat(paste0("cases for which the treatment effect is ", nu, " (RIR = ", round(recase, 3), ").\n"))
cat(paste0("with cases for which the treatment effect is ", nu, " (RIR = ", round(recase, 3), ").\n"))
cat("\n")
} else if ((abs(est_eff) < abs(beta_threshhold)) & is.na(eff_thr) == TRUE) {
cat("TO SUSTAIN:\n", sep = "")
cat("\n")
cat(paste0("RIR = ", round(recase, 3), "\n"))
cat("\n")
cat(paste0("You entered an estimated effect of ", round(est_eff, 3), ". The threshold value for"))
cat(paste0("The estimated effect is ", round(est_eff, 3), ". The threshold value for statistical significance"))
cat("\n")
cat(paste0("statistical significance is ", round(beta_threshhold, 3), " (alpha = ", alpha, "). To reach that"))
cat(paste0("is ", round(beta_threshhold, 3), " (alpha = ", alpha, "). To reach that threshold, ", round(sustain, 3), "% of the (", round(est_eff, 3), ") estimate"))
cat("\n")
cat(paste0("threshold, ", round(sustain, 3), "% of the (", round(est_eff, 3), ") estimate would have to be due to"))
cat(paste0("would have to be due to bias. This implies to sustain an inference one would"))
cat("\n")
cat("bias. This implies that to sustain an inference one would expect to")
cat(paste0("expect to have to replace ", round(recase, 3), " (", round(sustain, 3), "%) observations with effect of ", nu, " with cases"))
cat("\n")
cat(paste0("have to replace ", round(recase, 3), " (", round(sustain, 3), "%) observations with effect of ", nu, " with\n"))
cat(paste0("cases with effect of ", round(beta_threshhold, 3), " (RIR = ", round(recase, 3), ").\n"))
cat(paste0("with effect of ", round(beta_threshhold, 3), " (RIR = ", round(recase, 3), ").\n"))
cat("\n")
} else if ((abs(est_eff) < abs(beta_threshhold)) & is.na(eff_thr) == FALSE) {
cat("TO SUSTAIN:\n", sep = "")
cat("\n")
cat(paste0("RIR = ", round(recase, 3), "\n"))
cat("\n")
cat(paste0("You entered an effect size of ", round(est_eff, 3), ", and specified a threshold"))
cat("\n")
cat(paste0("for inference of ", round(eff_thr, 3), ". To reach that threshold, ", round(sustain, 3), "% of the" ))
cat(paste0("The estimated effect is ", round(est_eff, 3), ", and specified threshold for inference is ", round(eff_thr, 3), "."))
cat("\n")
cat(paste0("(", round(est_eff, 3), ") estimate would have to be due to bias. This implies"))
cat(paste0("To reach that threshold, ", round(sustain, 3), "% of the (", round(est_eff, 3), ") estimate would have to be due"))
cat("\n")
cat("that to sustain an inference one would expect to have to replace ")
cat(paste0("to bias. This implies that to sustain an inference one would expect to have"))
cat("\n")
cat(paste0(round(recase, 3), " (", round(sustain, 3), "%) observations with effect of ", nu, " with cases"))
cat(paste0("to replace ", round(recase, 3), " (", round(sustain, 3), "%) observations with effect of ", nu, " with cases with effect"))
cat("\n")
cat(paste0("with effect of ", round(beta_threshhold, 3), " (RIR = ", round(recase, 3), ").\n"))
cat(paste0("of ", round(beta_threshhold, 3), " (RIR = ", round(recase, 3), ").\n"))
cat("\n")
} else if (est_eff == beta_threshhold) {
warning("The coefficient is exactly equal to the threshold.\n")
Expand Down Expand Up @@ -105,40 +97,39 @@ if (requireNamespace("htmltools", quietly = TRUE)) {
if (abs(obs_r) > abs(critical_r) & obs_r > 0) {
cat("The minimum impact of an omitted variable to invalidate an inference")
cat("\n")
cat(paste0("for a null hypothesis of 0 effect is based on a correlation of ", r_con))
cat(paste0("for a null hypothesis of 0 effect is based on a correlation of ", round(r_con, 3)))
cat("\n")
cat(paste0("with the outcome and at ", r_con, " with the predictor of interest (conditioning"))
cat(paste0("with the outcome and ", round(r_con, 3), " with the predictor of interest (conditioning"))
cat("\n")
cat(paste0("on all observed covariates in the model) based on a threshold of ", round(critical_r, 3)))
cat("on all observed covariates in the model; signs are interchangeable)")
cat("\n")
cat("for statistical significance (alpha = ", alpha, ").\n",
sep = "")
cat(paste0("based on a threshold of ", round(critical_r, 3), " for statistical significance (alpha = ", alpha, ").\n"))
cat("\n")
cat("Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be ")
cat("\n")
cat(r_con, " X ", r_con, " = ", round(r_con^2, 3), " to invalidate an inference for a null hypothesis of 0 effect.\n", sep = "")
cat(round(r_con, 3), " X ", round(r_con, 3), " = ", round(r_con^2, 3), " to invalidate an inference for a null hypothesis of 0 effect.\n", sep = "")
} else if (abs(obs_r) > abs(critical_r) & obs_r < 0) {
cat("The minimum (in absolute value) impact of an omitted variable to")
cat("\n")
cat(paste0("invalidate an inference for a null hypothesis of 0 effect is based on"))
cat("\n")
cat(paste0("a correlation of ", -r_con, " with the outcome and at ", r_con, " with the predictor"))
cat(paste0("a correlation of ", -round(r_con, 3), " with the outcome and ", round(r_con, 3), " with the predictor"))
cat("\n")
cat("of interest (conditioning on all observed covariates in the model;")
cat("\n")
cat(paste0("signs are interchangeable) based on a threshold of ", round(beta_threshhold, 3), " for"))
cat(paste0("signs are interchangeable) based on a threshold of ", round(critical_r, 3), " for"))
cat("\n")
cat("statistical significance (alpha = ", alpha, ").\n", sep = "")
cat("\n")
cat("Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be ")
cat("\n")
cat(-r_con, " X ", r_con, " = ", -round(r_con^2, 3), " to invalidate an inference for a null hypothesis of 0 effect.\n", sep = "")
cat(-round(r_con, 3), " X ", round(r_con, 3), " = ", -round(r_con^2, 3), " to invalidate an inference for a null hypothesis of 0 effect.\n", sep = "")
} else if (abs(obs_r) < abs(critical_r) & obs_r > 0) {
cat("The maximum impact (in absolute value) of an omitted variable to")
cat("\n")
cat("sustain an inference for a null hypothesis of 0 effect is based on")
cat("\n")
cat(paste0("a correlation of ", -r_con, " with the outcome an at ", r_con, " with the predictor"))
cat(paste0("a correlation of ", -round(r_con, 3), " with the outcome and ", round(r_con, 3), " with the predictor"))
cat("\n")
cat("of interest (conditioning on all observed covariates in the model;")
cat("\n")
Expand All @@ -148,24 +139,30 @@ if (requireNamespace("htmltools", quietly = TRUE)) {
cat("\n")
cat("Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be ")
cat("\n")
cat(-r_con, " X ", r_con, " = ", -round(r_con^2, 3), " to sustain an inference for a null hypothesis of 0 effect.\n", sep = "")
cat(-round(r_con, 3), " X ", round(r_con, 3), " = ", -round(r_con^2, 3), " to sustain an inference for a null hypothesis of 0 effect.\n", sep = "")
} else if (abs(obs_r) < abs(critical_r) & obs_r < 0) {
cat("The maximum impact of an omitted variable to sustain an inference")
cat("\n")
cat(paste0("for a null hypothesis of 0 effect is based on a correlation of ", r_con))
cat(paste0("for a null hypothesis of 0 effect is based on a correlation of ", round(r_con, 3)))
cat("\n")
cat(paste0("with the outcome and at ", r_con, " with the predictor of interest (conditioning"))
cat(paste0("with the outcome and ", round(r_con, 3), " with the predictor of interest (conditioning"))
cat("\n")
cat(paste0("on all observed covariates in the model) based on a threshold of ", round(beta_threshhold, 3)))
cat("on all observed covariates in the model; signs are interchageable)")
cat("\n")
cat("for statistical significance (alpha = ", alpha, ").\n", sep = "")
cat(paste0("based on a threshold of ", round(beta_threshhold, 3), " for statistical significance (alpha = ", alpha, ").\n"))
cat("\n")
cat("Correspondingly the impact of an omitted variable (as defined in Frank 2000) must be ")
cat("\n")
cat(r_con, " X ", r_con, " = ", round(r_con^2, 3), " to sustain an inference for a null hypothesis of 0 effect.\n", sep = "")
cat(round(r_con, 3), " X ", round(r_con, 3), " = ", round(r_con^2, 3), " to sustain an inference for a null hypothesis of 0 effect.\n", sep = "")
} else if (obs_r == critical_r) {
warning("The correlation is exactly equal to the threshold.\n")
}
cat("\n")
cat("For calculation of unconditional ITCV, request raw output. When using pkonfound(),")
cat("\n")
cat("additionally include the R2, sdx, and sdy as input.")
cat("\n")
cat("\n")
cat("See Frank (2000) for a description of the method.")
cat("\n")
cat("\n")
Expand Down
7 changes: 5 additions & 2 deletions R/konfound-lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ konfound_lm <- function(model_object, tested_variable_string, test_all, alpha, t
sdy <- unname(sqrt(diag(var(model_object$model)))[1])
R2 <- summary(model_object)$r.squared

if (test_all == FALSE) {
if (test_all == FALSE | n_covariates == 1) {
out <- test_sensitivity(
est_eff = est_eff,
std_err = std_err,
Expand All @@ -40,7 +40,10 @@ konfound_lm <- function(model_object, tested_variable_string, test_all, alpha, t
)
return(out)
} else {
message("Note that this output is calculated based on the correlation-based approach used in mkonfound()")
message("The mkonfound command is used which evaluates RIR in terms of a correlation-based approach
to support comparison among the robustness of the inferences across the covariates.
ITCV is for conditional correlations. To generate unconditional ITCV, use the pkonfound
command for each predictor separately.")
d <- data.frame(t = est_eff / std_err, df = (n_obs - n_covariates - 1))
o <- mkonfound(d, .data$t, .data$df)
term_names <- dplyr::select(tidy_output, var_name = .data$term) # remove the first row for intercept
Expand Down
2 changes: 1 addition & 1 deletion R/konfound.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ konfound <- function(model_object,
}

if (inherits(model_object, "glm") & two_by_two == FALSE) {
message("Note that for a non-linear model, impact threshold should not be interpreted.")
message("Note that if your model is a logistic regression, we recommend using the pkonfound command for logistic regression with manually entered parameter estimates and other quantities.")
message("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")
message("If a dichotomous independent variable is used, consider using the 2X2 table approach enabled with the argument two_by_two = TRUE")
output <- konfound_glm(
Expand Down
13 changes: 7 additions & 6 deletions R/nonlinear_auxiliary.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ getswitch <- function(table_bstart, thr_t, switch_trm, n_obs) {
b_tryall <- b - (b - 1) * (1 - as.numeric(switch_trm))
tryall_t <- get_t_kfnl(a_tryall, b_tryall, c_tryall, d_tryall)
tryall_est <- log(a_tryall*d_tryall/c_tryall/b_tryall)
allnotenough <- isTRUE(thr_t - tryall_t > 0 & tryall_est*est_eff_start > 0)
allnotenough <- isTRUE(thr_t - tryall_t > 0 &
tryall_est * est_eff_start >= 0)
}
if (t_start > thr_t) {
# transfer cases from A to B or D to C to decrease odds ratio
Expand All @@ -139,7 +140,7 @@ getswitch <- function(table_bstart, thr_t, switch_trm, n_obs) {
b_tryall <- b + (a - 1) * (1 - as.numeric(switch_trm))
tryall_t <- get_t_kfnl(a_tryall, b_tryall, c_tryall, d_tryall)
tryall_est <- log(a_tryall*d_tryall/c_tryall/b_tryall)
allnotenough <- isTRUE(tryall_t - thr_t > 0 & tryall_est*est_eff_start > 0)
allnotenough <- isTRUE(tryall_t - thr_t > 0 & tryall_est*est_eff_start >= 0)
}

### run following if transfering one row is enough
Expand Down Expand Up @@ -388,7 +389,7 @@ if (!dcroddsratio_start) {
b_tryall <- b - (b - 1) * (1 - as.numeric(switch_trm))
tryall_p <- chisq_p(a_tryall, b_tryall, c_tryall, d_tryall)
tryall_est <- log(a_tryall*d_tryall/c_tryall/b_tryall)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est< 0 & tryall_est*est > 0)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est< 0 & tryall_est*est >= 0)
}
if (dcroddsratio_start ) {
# transfer cases from A to B or D to C to decrease odds ratio
Expand All @@ -398,7 +399,7 @@ if (dcroddsratio_start ) {
b_tryall <- b + (a - 1) * (1 - as.numeric(switch_trm))
tryall_p <- chisq_p(a_tryall, b_tryall, c_tryall, d_tryall)
tryall_est <- log(a_tryall*d_tryall/c_tryall/b_tryall)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est> 0 & tryall_est*est > 0)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est> 0 & tryall_est*est >= 0)
}

### run following if transfering one row is enough
Expand Down Expand Up @@ -732,7 +733,7 @@ getswitch_fisher <- function(a, b, c, d, thr_p = 0.05, switch_trm = T){
if (d_tryall == 0) {d_tryall <- d_tryall + 0.5}
tryall_p <- fisher_p(a_tryall, b_tryall, c_tryall, d_tryall)
tryall_est <- log(a_tryall*d_tryall/c_tryall/b_tryall)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est< 0 & tryall_est*est > 0)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est< 0 & tryall_est*est >= 0)
}
if (dcroddsratio_start ) {
# transfer cases from A to B or D to C to decrease odds ratio
Expand All @@ -746,7 +747,7 @@ getswitch_fisher <- function(a, b, c, d, thr_p = 0.05, switch_trm = T){
if (d_tryall == 0) {d_tryall <- d_tryall + 0.5}
tryall_p <- fisher_p(a_tryall, b_tryall, c_tryall, d_tryall)
tryall_est <- log(a_tryall*d_tryall/c_tryall/b_tryall)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est> 0 & tryall_est*est > 0)
allnotenough <- isTRUE((thr_p-tryall_p)*tryall_est> 0 & tryall_est*est >= 0)
}

### run following if transfering one row is enough
Expand Down
2 changes: 1 addition & 1 deletion R/test_sensitivity.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if (signsuppression == 1) warning("signsuppression is defined by a threshold of
itcv <- signITCV * abs(act_r - critical_r) / (1 + mp * abs(critical_r))

# finding correlation of confound to invalidate / sustain inference
r_con <- round(sqrt(abs(itcv)), 3)
r_con <- sqrt(abs(itcv))

## calculate the unconditional ITCV if user inputs sdx, sdy and R2
if (!is.na(sdx) & !is.na(sdy) & !is.na(R2) & (n_covariates > 0)) {
Expand Down
Loading
Loading