Add tbl_proportion() and proportion comparison verbs - #304
Conversation
tbl_proportion() summarizes a binary or multinomial variable as proportions with confidence intervals, with a selectable CI method and conf.level. add_proportion_difference() appends the difference in rates, its CI, and a p-value; add_proportion_odds_ratio() appends an odds ratio. Both comparison verbs support stratified (Cochran-Mantel-Haenszel) analysis via strata. Fixes #303
Unit Tests Summary 1 files 324 suites 1m 50s ⏱️ Results for commit 4324432. ♻️ This comment has been updated with latest results. |
Unit Test Performance Difference
Additional test case details
Results for commit f61892d ♻️ This comment has been updated with latest results. |
Code Coverage SummaryDiff against mainResults for commit: 4324432 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
The difference confidence interval keeps its continuity correction, but the chi-squared p-value now has its own test_correct flag (default FALSE) so it matches the NEST 1.0 catalog (RSPT01), where the interval uses the correction and the test does not.
wzfrank
left a comment
There was a problem hiding this comment.
We need to add an argument to customize Wald, with continuity correction.
The 'cc' methods (waldcc, wilsoncc, strat_wilsoncc) apply a continuity correction, so the default CI row label now reads 'with continuity correction' instead of the abbreviated 'with correction'. The label remains overridable via ci_label. Addresses PR review feedback.
|
Addressed in |
wzfrank
left a comment
There was a problem hiding this comment.
Thanks I think this looks good now!
Adds a reusable stats layer for binary/response summary tables (RSPT01), so templates hold only cosmetics.
Three verbs, statistics and tabulation separated from wording:
Added
tbl_proportion()to summarize a binary or multinomial variable as proportions with confidence intervals (estimate and CI on separate rows), with a selectable CImethodandconf.level. (Add tbl_proportion() and proportion comparison verbs #303)Added
add_proportion_difference()to append the difference in rates, its confidence interval, and a p-value ("chisq","fisher", or"cmh"), with stratified (Cochran-Mantel-Haenszel) support viastrata. (Add tbl_proportion() and proportion comparison verbs #303)Added
add_proportion_odds_ratio()to append an odds ratio, with stratified (Cochran-Mantel-Haenszel) support viastrata. (Add tbl_proportion() and proportion comparison verbs #303)CI method and level match
cardx::ard_categorical_ci(); the difference CI and p-value are verified againstprop.test(), and the odds ratio against a manual 2x2.Fixes #303