Retain harm bound in to_integer() for AHR designs - #673
Merged
Merged
Conversation
to_integer.gs_design() rebuilds the design with gs_power_ahr() using the stored inputs, but did not pass the harm bound arguments, so the harm boundary was silently dropped when converting an AHR group sequential design to integer events. Forward harm/hpar/test_harm from x$input to the gs_power_ahr() call. These default to gs_b/-Inf/FALSE for designs without a harm bound, so non-harm designs are unaffected. gs_power_wlr() does not support harm bounds, so the change applies to the AHR branch only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yihui
force-pushed
the
to-integer-harm
branch
from
September 11, 2026 19:29
70447bd to
06facff
Compare
jdblischak
reviewed
Sep 11, 2026
jdblischak
left a comment
Collaborator
There was a problem hiding this comment.
xref: follow-up to #640
yihui
force-pushed
the
to-integer-harm
branch
from
September 11, 2026 19:55
a8d57d1 to
daa68b5
Compare
Per review, relocate the harm-bound retention test from test-independent-to_integer.R to test-developer-to_integer.R, matching where the rest of the harm bound tests (#640) live: it exercises implementation behavior of to_integer() rather than validating output against an independent source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yihui
force-pushed
the
to-integer-harm
branch
from
September 11, 2026 19:58
daa68b5 to
3d9eeaa
Compare
jdblischak
approved these changes
Sep 14, 2026
LittleBeannie
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
to_integer.gs_design()rebuilds an AHR group sequential design withgs_power_ahr()at the rounded integer event counts, but the reconstruction did not forward the harm bound arguments (harm,hpar,test_harm). As a result, the harm boundary was silently dropped whenever an AHR design with harm bounds was converted to integer events:This surfaced while wiring harm bounds through the gsDesign2 Shiny app (keaven/gsDesign2Shiny#76), where integer sample sizes are on by default.
Fix
Forward
harm/hpar/test_harmfromx$inputinto thegs_power_ahr()call in the AHR/WLR branch. These fields are always present on the input and default togs_b/-Inf/FALSEfor designs without a harm bound, so non-harm designs are unaffected.gs_power_wlr()does not accept harm arguments, so the change is guarded to the AHR case (is_ahr).After the fix,
to_integer()retains the harm bound and the cumulative harm crossing probability under H0 at the final analysis matches the input (0.05 in the example above).Tests
Added an independent test asserting the harm bound survives
to_integer()and that the final cumulative H0 harm crossing probability equals the requested total spend. Existingto_integertests still pass.🤖 Generated with Claude Code