Skip to content

Print full spending function parameters in print.gsSurv (#307) - #342

Merged
keaven merged 1 commit into
masterfrom
fix-307-print-gssurv-tdist
Sep 20, 2026
Merged

keaven merged 1 commit into
masterfrom
fix-307-print-gssurv-tdist

Conversation

@yihui

@yihui yihui commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #307. print.gsSurv() truncated spending-function parameters that contain decimal values. For the t-distribution spending function (sfTDist, "3 Parameters" in the Shiny app), the output showed only a = -1. instead of the full a = -1.63774, b = 2.96683, df = 3.

Root cause

print.gsSurv() builds the "Spending functions:" block by extracting sentences from summary(x) via strsplit(summ_text, "\\.") — a split on bare periods. Decimal parameter values (-1.63774) contain periods, so the split shredded the number and the surviving fragment was the truncated ...a = -1. print.gsDesign() (the binomial path) uses different code and was unaffected, which is why the bug only appeared for time-to-event designs.

Fix

Split on sentence boundaries (a period followed by whitespace, (?<=\\.)\\s+) rather than bare periods, so decimals inside parameter values are preserved. A trailing period is stripped and re-added for consistent formatting.

Verification

Before:

Spending functions:
  Efficacy bounds derived using a t-distribution spending function with a = -1.

After:

Spending functions:
  Efficacy bounds derived using a t-distribution spending function with a = -1.63774, b = 2.96683, df = 3.
  • Added regression test test-developer-test-print-gsSurv-tdist-307.R.
  • Updated the independent-test-print.gsSurv snapshot: the old snapshot itself encoded the bug (rho = 0. for a sfPower design with sflpar = .5); it now correctly reads rho = 0.5.
  • Existing print.gsSurv tests pass; non-decimal spending functions (HSD gamma = -4, LDOF) unchanged.

🤖 Generated with Claude Code

print.gsSurv() extracted the spending-function description from
summary() by splitting on bare periods. Spending functions with
decimal parameters (e.g. the t-distribution's a = -1.63774) were
truncated at the first period, printing "a = -1." instead of all
parameters. Split on sentence boundaries (period followed by
whitespace) instead, so decimals are preserved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@yihui
yihui requested review from jdblischak and keaven September 11, 2026 20:30

@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.

Thanks @yihui!

@keaven
keaven merged commit e0253af into master Sep 20, 2026
8 checks passed
@keaven
keaven deleted the fix-307-print-gssurv-tdist branch September 20, 2026 11:43
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.

It looks like when t-distribution spending function is used, print does not work correctly

3 participants