Skip to content

Add diff_est_ci statistic to s_proportion_diff() - #1522

Merged
Melkiades merged 13 commits into
pharmaverse:mainfrom
vikram-rawat:feat/add-diff-ci-3d-to-proportion-diff
Sep 18, 2026
Merged

Melkiades merged 13 commits into
pharmaverse:mainfrom
vikram-rawat:feat/add-diff-ci-3d-to-proportion-diff

Conversation

@vikram-rawat

@vikram-rawat vikram-rawat commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Feature description
s_proportion_diff() currently returns diff and diff_ci as
separate elements. This means the risk difference and its CI always
render as two table rows.

A combined 3-element vector diff_est_ci = c(diff, lower_ci, upper_ci)
would allow rendering them on a single row (e.g., -7.3 (-26.7, 12.2)).

This pattern already exists in tern — s_surv_timepoint() returns
rate_diff_ci_3d for the same purpose.

Fixes - #1523

@vikram-rawat vikram-rawat changed the title Add diff_ci_3d statistic to estimate_proportion_diff() Add diff_ci_3d statistic to s_proportion_diff() Sep 10, 2026
@vikram-rawat vikram-rawat changed the title Add diff_ci_3d statistic to s_proportion_diff() Add diff_est_ci statistic to s_proportion_diff() Sep 11, 2026
@munoztd0
munoztd0 self-requested a review September 14, 2026 09:37

@munoztd0 munoztd0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor change but overall lgtm

Comment thread R/prop_diff.R Outdated
@munoztd0
munoztd0 requested a lite review from Copilot September 14, 2026 10:37
@munoztd0
munoztd0 requested review from Melkiades and removed request for Copilot September 14, 2026 10:39
@munoztd0 munoztd0 closed this Sep 14, 2026
@munoztd0 munoztd0 reopened this Sep 14, 2026
@munoztd0
munoztd0 self-requested a review September 15, 2026 09:38

@munoztd0 munoztd0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all good now

@wwojciech

Copy link
Copy Markdown
Contributor

@Melkiades , @shajoezhu - can you pl. have a look at this PR and possible merge it if you have no any objections? Thank you!

@shajoezhu

Copy link
Copy Markdown
Contributor

@munoztd0 , can you share the scda.test test results? PR link here?

@wwojciech can you resolve the conflict?

@wwojciech

Copy link
Copy Markdown
Contributor

@vikram-rawat - can you resolve conflicts please? I unfortunately have no permissions to do that. Thanks!

@shajoezhu

Copy link
Copy Markdown
Contributor

@wwojciech @gmbecker , could you give me a list of members that i will add you to the team for access. thanks

@wwojciech

wwojciech commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

@wwojciech @gmbecker , could you give me a list of members that i will add you to the team for access. thanks

Thank you @shajoezhu - I will check this with the team and will get back to you. In the meanwhile, for sure you can grant me an access. Thanks!

@vikram-rawat
vikram-rawat force-pushed the feat/add-diff-ci-3d-to-proportion-diff branch from 48a82cd to f13fdb1 Compare September 17, 2026 08:28
@munoztd0

Copy link
Copy Markdown
Contributor

@munoztd0 , can you share the scda.test test results? PR link here?

@wwojciech can you resolve the conflict?

OFC, -> here it is -> insightsengineering/scda.test#251

@munoztd0

munoztd0 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

@wwojciech @gmbecker , could you give me a list of members that i will add you to the team for access. thanks

@gmbecker @wwojciech @vikram-rawat @iaugusty @eanokian @rmao6 @y-runthla and @danielinteractive @gm-gi-ext

Signed-off-by: Wojtek <11532997+wwojciech@users.noreply.github.com>
More nicer implementation of the label.

Signed-off-by: Wojtek <11532997+wwojciech@users.noreply.github.com>
Update return description in man.

Signed-off-by: Wojtek <11532997+wwojciech@users.noreply.github.com>
@wwojciech
wwojciech marked this pull request as draft September 17, 2026 14:29
@wwojciech
wwojciech marked this pull request as ready for review September 17, 2026 14:29
@wwojciech wwojciech linked an issue Sep 17, 2026 that may be closed by this pull request
3 tasks done
@wwojciech
wwojciech self-requested a review September 17, 2026 14:40

@wwojciech wwojciech left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok.

…to NEWS

Co-authored-by: Codex <noreply@openai.com>

@Melkiades Melkiades left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Two small things I pushed straight to the branch rather than send you round again:

  • tern_default_labels[["diff_est_ci"]] hardcoded "... and 95% CI". get_labels_from_stats() is exported and returns that value, so it was wrong for any other conf_level. Now conf-level agnostic; the label attribute from s_proportion_diff() still carries the actual level, so rendered output is unchanged.
  • NEWS entry now carries (#1523), matching its neighbours.

Checked after the change: default table output identical, diff_est_ci renders correctly at both 95% and 90%, test-prop_diff.R 89 passed and 0 failed.

One thing I deliberately left alone: .indent_mods lists diff_est_ci but .formats does not. "xx.x (xx.x, xx.x)" is not a built-in formatters spec, the built-in 3d ones use " - " rather than ", ", so it needs format_xx(), and putting a function into that vector would turn .formats into a list. The default lookup in tern_default_formats already resolves it, so the asymmetry is harmless.

Nice addition, the single-row rendering is genuinely useful.

@Melkiades
Melkiades enabled auto-merge (squash) September 18, 2026 09:32
@Melkiades
Melkiades merged commit 11c9a9f into pharmaverse:main Sep 18, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add diff_est_ci statistic to s_proportion_diff()

5 participants