Skip to content

Fix conditional beta calculations and clarify gs_cp_npe2() behavior - #664

Open
LittleBeannie wants to merge 6 commits into
mainfrom
661-update-gs_cp_npe2-beta-calculations
Open

Fix conditional beta calculations and clarify gs_cp_npe2() behavior#664
LittleBeannie wants to merge 6 commits into
mainfrom
661-update-gs_cp_npe2-beta-calculations

Conversation

@LittleBeannie

Copy link
Copy Markdown
Collaborator

Summary

This PR corrects the conditional beta probability calculation in gs_cp_npe2() and clarifies the function's behavior when the next analysis is the target analysis (j = i + 1).

Related

Closes #660
Closes #661

Changes

  • Correct the upper integration limits used to calculate prob_beta when j > i + 1.
  • Use the efficacy bounds b instead of the futility bounds a as the upper limits for intermediate analyses.
  • Expand the return-value documentation for prob_alpha, prob_alpha_plus, and prob_beta.
  • Explicitly distinguish the formulas for j = i + 1 and j > i + 1.
  • Add a regression test comparing gs_cp_npe2() with gs_cp_npe1() when j = i + 1.
  • Add a regression test based on issue Update gs_cp_npe2 beta calculations #661, verifying that the probability of crossing an efficacy boundary plus the probability of not crossing through the final analysis sums to 1.

Results

For the example reported in #661, prob_beta[2] is corrected from 0 to approximately 0.4437:

sum(result$prob_alpha) + result$prob_beta[2]
# 1

@LittleBeannie LittleBeannie self-assigned this Aug 21, 2026
@LittleBeannie LittleBeannie linked an issue Aug 21, 2026 that may be closed by this pull request
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.

Update gs_cp_npe2 beta calculations Update gs_cp_npe2 for clarity of use

2 participants