Skip to content

Conversation

@jdblischak
Copy link
Collaborator

@jdblischak jdblischak commented Oct 29, 2025

When a fixed design is selected in the app, the following error appears below the summary table:

Error: $ operator is invalid for atomic vectors

This is because text_summary() is expecting a function when determining the upper bound.

sfu <- get_sf(x$input$upar$sf)

A fixed design has no upper bound, so I fixed this by conditioning on n_analysis > 1.

Now the text summary for a fixed design works as below:

One-sided group sequential design with 1 analyses, time-to-event outcome with sample size 1124 and 865 events, percent (1-sided) Type I error. Enrollment and total study durations are assumed to be 24 and 30 months, respectively. With hazard ratio of 1 during the first 3 months and 0.7 thereafter, the power is 90 percent.

library(gsDesign)
library(gsDesign2)

# Enrollment
enroll_rate <- define_enroll_rate(duration = c(2, 2, 2, 18), rate = c(1, 2, 3, 4), stratum = "All")

# Failure rates
duration <- diff(c(0, 3, 103))
control_rate <- log(2)/c(6, 6)
fail_rate <- define_fail_rate(duration, fail_rate = control_rate, dropout_rate = c(0.001, 0.001), hr = c(1, 0.7), stratum = "All")

x <- gs_design_ahr(
  enroll_rate = enroll_rate,
  fail_rate = fail_rate,
  alpha = 0.025,
  beta = 0.1,
  analysis_time = 30,
  ratio = 1,
  binding = FALSE,
  upper = "gs_b",
  upar = qnorm(1 - 0.025),
  lower = "gs_b",
  lpar = -Inf,
  h1_spending = TRUE,
  test_lower = FALSE,
  info_scale = "h0_info"
) |>
  to_integer()

text_summary(x)
## [1] "One-sided group sequential design with 1 analyses, time-to-event outcome with sample size 1124 and 865 events,  percent (1-sided) Type I error. Enrollment and total study durations are assumed to be 24 and 30 months, respectively. With hazard ratio of 1 during the first 3 months and 0.7 thereafter, the power is 90 percent."

@jdblischak jdblischak self-assigned this Oct 29, 2025
Copy link
Collaborator

@yihui yihui left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@LittleBeannie LittleBeannie merged commit 0b37864 into Merck:main Nov 7, 2025
7 checks passed
@jdblischak jdblischak deleted the text-summary-fixed-design branch November 10, 2025 16:55
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.

3 participants