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

オープン
#379 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

@jdblischak がすでに取り組んでいます。

2026年9月28日 から。

評価

この issue はまだ評価されていません。

説明

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

主要言語
R
スター
41
フォーク
14
平均マージ
3時間 4分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Merck/simtrial のほかの issue

Merck/simtrial の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。