Missing updated bounds from `sim_gs_n()` changed from `Inf` to `NA` with latest {gsDesign2}

Aperta
#379 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@jdblischak ci sta già lavorando.

Dal 28/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Two {simtrial} tests failed the weekly integration test:

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-unvalidated-sim_gs_n.R:755:3'): sim_gs_n() can update bounds even when some are missing ──
Expected `observed$updated_upper_bound` to equal `c(Inf, 2.46416041021134, 1.99094670148633)`.
Differences:
  `actual`:  NA 2.464160410 1.990946701
`expected`: Inf 2.464160410 1.990946701

── Failure ('test-unvalidated-sim_gs_n.R:759:3'): sim_gs_n() can update bounds even when some are missing ──
Expected `observed$updated_lower_bound` to equal `c(-2.72847356838699, -Inf, -Inf)`.
Differences:
  `actual`: -2.728473568   NA   NA
`expected`: -2.728473568 -Inf -Inf


[ FAIL 2 | WARN 1 | SKIP 3 | PASS 270 ]

I was able to narrow it down to the recent update to gsDesign2::gs_update_ahr() (https://github.com/Merck/gsDesign2/pull/676)

With the latest development version of {gsDesign2} (https://github.com/Merck/gsDesign2/commit/e4f7ae6aec1af252771c1351aee53f01e29bca70), the missing updated bounds are reported as NA.

library("gsDesign")
library("gsDesign2")
library("simtrial")

# futility - IA1; efficacy - IA2 & FA
x <- gs_design_ahr(
  alpha = 0.025,
  beta = 0.1,
  analysis_time = 1:3*12,
  upper = gsDesign2::gs_spending_bound,
  upar = list(sf = sfLDOF, total_spend = 0.025),
  test_upper = c(FALSE, TRUE, TRUE),
  lower = gs_spending_bound,
  lpar = list(sf = sfHSD, param = -4, total_spend = 0.01),
  test_lower = c(TRUE, FALSE, FALSE)
) |> to_integer()

set.seed(1)
observed <- sim_gs_n(
  n_sim = 1,
  sample_size = max(x$analysis$n),
  enroll_rate = x$enroll_rate,
  fail_rate = x$fail_rate,
  test = wlr,
  weight = fh(rho = 0, gamma = 0),
  cut = list(ia1 = create_cut(planned_calendar_time = x$analysis$time[1]),
             ia2 = create_cut(planned_calendar_time = x$analysis$time[2]),
             fa = create_cut(planned_calendar_time = x$analysis$time[3])),
  original_design = x
)

observed
observed[, 13:16]
##   planned_lower_bound planned_upper_bound updated_lower_bound updated_upper_bound
## 1           -2.319759                  NA           -2.728474                  NA
## 2                  NA            2.358356                  NA            2.464160
## 3                  NA            2.009328                  NA            1.990947

Building {gsDesign2} from the previous commit (https://github.com/Merck/gsDesign2/commit/aac76407433f156e44cea798d26b0015088678d9), the missing updated bounds are reported as -Inf or Inf.

library("gsDesign")
library("gsDesign2")
library("simtrial")

# futility - IA1; efficacy - IA2 & FA
x <- gs_design_ahr(
  alpha = 0.025,
  beta = 0.1,
  analysis_time = 1:3*12,
  upper = gsDesign2::gs_spending_bound,
  upar = list(sf = sfLDOF, total_spend = 0.025),
  test_upper = c(FALSE, TRUE, TRUE),
  lower = gs_spending_bound,
  lpar = list(sf = sfHSD, param = -4, total_spend = 0.01),
  test_lower = c(TRUE, FALSE, FALSE)
) |> to_integer()

set.seed(1)
observed <- sim_gs_n(
  n_sim = 1,
  sample_size = max(x$analysis$n),
  enroll_rate = x$enroll_rate,
  fail_rate = x$fail_rate,
  test = wlr,
  weight = fh(rho = 0, gamma = 0),
  cut = list(ia1 = create_cut(planned_calendar_time = x$analysis$time[1]),
             ia2 = create_cut(planned_calendar_time = x$analysis$time[2]),
             fa = create_cut(planned_calendar_time = x$analysis$time[3])),
  original_design = x
)

observed
observed[, 13:16]
##   planned_lower_bound planned_upper_bound updated_lower_bound updated_upper_bound
## 1           -2.319759                  NA           -2.728474                 Inf
## 2                  NA            2.358356                -Inf            2.464160
## 3                  NA            2.009328                -Inf            1.990947

Which is the desired behavior going forward?

xref: #335

Lingua principale
R
Stelle
41
Fork
14
Merge medio
3h 4m
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Merck/simtrial

Tutte le issue di Merck/simtrial

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.