Skip to content

Add harm bound to AHR designs#640

Open
LittleBeannie wants to merge 23 commits into
mainfrom
618-add-harm-bound
Open

Add harm bound to AHR designs#640
LittleBeannie wants to merge 23 commits into
mainfrom
618-add-harm-bound

Conversation

@LittleBeannie

@LittleBeannie LittleBeannie commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

To solve issue #618.

@jdblischak: In addition to "Efficacy" and "Futility" bound, I added "Harm" bound, which sequentially leads to some changes in gs_bound_summary(). The changes in gs_bound_summary() is suggested by GPT5.5. Could you please review if these AI-suggested changes looks good to you?

@LittleBeannie LittleBeannie self-assigned this Jun 10, 2026
@LittleBeannie LittleBeannie linked an issue Jun 10, 2026 that may be closed by this pull request
LittleBeannie and others added 9 commits June 11, 2026 10:31
The helper-support-as_rtf.R is auto-sourced by testit, so the explicit
source() call failed during R CMD check. Also update as_gt and as_rtf
snapshots to reflect the new bound ordering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Run roxygenize to sync Rd files with code (fixes WARNING)
- Remove test-independent-as_rtf.R (the .md snapshot is sufficient)
- Replace all() with bare logical vector in test assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…alone

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@yihui

yihui commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Note on snapshot test changes

The .md snapshot diffs look large but are caused by a single behavioral change: as_gt() now sorts bounds by factor level order (Efficacy, Futility, Harm) via arrange(x2, Analysis, Bound), whereas previously it used arrange(x2, Analysis) which preserved the summary() order (Futility before Efficacy, from desc(bound) alphabetical sorting).

This means every analysis section in both test-independent-as_gt.md and test-independent-as_rtf.md has its Efficacy and Futility rows swapped. The actual numeric values are unchanged.

The other visible change in as_gt.md is lrrrrrcrrrrr (first column alignment changed from left to center).

@yihui

yihui commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Correction on the alignment change: the lrrrrrcrrrrr (first column left → center) is not from this PR's code. It's from gt 1.3.0 changing its default LaTeX alignment for the first data column in row-grouped tables. The old snapshot was generated with an older gt version. Since CI also installs gt 1.3.0, the updated snapshot is correct.

@LittleBeannie

Copy link
Copy Markdown
Collaborator Author

Thank you @yihui for helping with the testit snapshot issues!

Comment thread R/gs_design_ahr.R
Comment thread tests/testit/test-independent-as_gt.md
Comment thread R/gs_bound_summary.R
Comment thread tests/testit/test-developer-gs_power_npe.R
Comment thread R/gs_bound_summary.R
Comment thread R/gs_power_npe.R
Comment thread man/gs_design_ahr.Rd Outdated

@yihui yihui left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I only looked at the test part as I don't have expertise on the design part.


```{r}
candidate_harm_bounds <- lapply(astar_candidates, function(astar_candidate) {
gs_harm <- gsDesign::gsSurv(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The pkgdown workflow failed with the error ! unused arguments (sfharm = gsDesign::sfHSD, sfharmparam = -2) because this new article requires the dev version of {gsDesign}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the plan for this vignette? Are we going to wait for the next release of {gsDesign}, or should we extract this vignette and save it for a follow-up PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Keaven will release a new version of gsDesign next week, and he agrees that we merge this PR after his release.

Comment thread R/gs_design_ahr.R Outdated
Comment thread tests/testit/test-developer-gs_design_ahr.R
Comment thread tests/testit/test-developer-gs_design_ahr.R Outdated
Comment thread tests/testit/test-developer-gs_design_ahr.R Outdated
Comment thread tests/testit/test-developer-gs_design_ahr.R Outdated
Comment thread tests/testit/test-developer-gs_design_ahr.R Outdated
Comment thread tests/testit/test-developer-gs_design_ahr.R Outdated
Comment thread tests/testit/test-developer-gs_design_ahr.R
Comment thread tests/testit/test-developer-gs_power_npe.R
@LittleBeannie LittleBeannie requested a review from jdblischak June 22, 2026 14:40

@jdblischak jdblischak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The tests of gs_{design/power}_{ahr/npe} look good now. I would still like to see some tests for the other functions updated by this PR (as_gt(), gs_bound_summary(), and summary.gs_design()).

Also, we need to decide on the plan for the vignette.

Comment thread DESCRIPTION
Rcpp
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Config/roxygen2/version: 8.0.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could temporarily require the dev version of gsDesign:

Suggested change
Config/roxygen2/version: 8.0.0
Config/roxygen2/version: 8.0.0
Remotes: keaven/gsDesign

and remove this Remotes field after the new version of gsDesign is on CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add harm bound

4 participants