From a4c24cbbd162290ea4ddecc7d5383106fffa55ef Mon Sep 17 00:00:00 2001 From: LittleBeannie Date: Wed, 4 Feb 2026 17:14:56 -0500 Subject: [PATCH 1/5] Add an example showing how to update a stratified design at the time of analysis --- R/gs_update_ahr.R | 72 ++++++++++++++++++++++++++++++++++++++++++++ man/gs_update_ahr.Rd | 72 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) diff --git a/R/gs_update_ahr.R b/R/gs_update_ahr.R index 023bc07f..5d913afb 100644 --- a/R/gs_update_ahr.R +++ b/R/gs_update_ahr.R @@ -118,6 +118,78 @@ #' #' # Alpha is updated to 0.05 #' gs_update_ahr(x = x, alpha = 0.05) +#' +#' # ------------------------------------------------- # +#' # Two-sided asymmetric stratified design, +#' # beta-spending with non-binding lower bound +#' # ------------------------------------------------- # +#' enroll_rate <- define_enroll_rate(stratum = c("A", "B"), duration = c(12, 12), rate = c(1, 1)) +#' +#' # We assumme there are 2 strata, "A" and "B". +#' # For each stratum, there are delayed effect for the first 3 months. +#' # After the delayed effect, the HR is 0.8 for stratum A and 0.5 for stratum B. +#' fail_rate <- define_fail_rate(stratum = c("A", "A", "B", "B"), +#' duration = c(3, Inf, 3, Inf), +#' fail_rate = log(2) / c(9, 9, 9, 15), +#' hr = c(1, 0.8, 1, 0.5), +#' dropout_rate = rep(0.001, 4)) +#' +#' # The original design assumes there are 2 IAs and 1 FA cutting by calendar time. +#' # The efficacy testing is conducted at IA2 and FA. +#' # The futility testing is conducted at IA1. +#' x <- gs_design_ahr(enroll_rate = enroll_rate, +#' fail_rate = fail_rate, +#' alpha = 0.0125, +#' beta = 0.1, +#' analysis = c(20, 28, 36), +#' upper = "gs_spending_bound", +#' upar = list(sf = "sfLDOF", total_spend = 0.0125), +#' lower = "gs_spending_bound", +#' lpar = list(sf = "sfHSD", total_spend = 0.1, param = -8), +#' test_upper = c(FALSE, TRUE, TRUE), +#' test_lower = c(TRUE, FALSE, FALSE)) |> to_integer() +#' +#' # At time of analysis +#' # For IA1, +#' # - There are 70 events observed during the delayed effect period for stratum A. +#' # - There are 150 events observed after the delayed effect period for stratum A. +#' # - There are 75 events observed during the delayed effect period for stratum B. +#' # - There are 90 events observed after the delayed effect period for stratum B. +#' # For IA2, +#' # - There are 75 events observed during the delayed effect period for stratum A. +#' # - There are 210 events observed after the delayed effect period for stratum A. +#' # - There are 76 events observed during the delayed effect period for stratum B. +#' # - There are 136 events observed after the delayed effect period for stratum B. +#' # For FA, +#' # - There are 77 events observed during the delayed effect period for stratum A. +#' # - There are 245 events observed after the delayed effect period for stratum A. +#' # - There are 77 events observed during the delayed effect period for stratum B. +#' # - There are 170 events observed after the delayed effect period for stratum B. +#' event_tbl <- data.frame(analysis = c(1, 1, 1, 1, +#' 2, 2, 2, 2, +#' 3, 3, 3, 3), +#' stratum = c("A", "A", "B", "B", # IA1 +#' "A", "A", "B", "B", # IA2 +#' "A", "A", "B", "B"),# FA +#' # event per interval per stratum at IA1 +#' event = c(70, 150, 75, 90, +#' # event per interval per stratum at IA2 +#' 75, 210, 76, 136, +#' # event per interval per stratum at FA +#' 77, 245, 77, 170)) +#' observed_event <- event_tbl |> group_by(analysis) |> summarize(x = sum(event)) |> pull(x) +#' +#' ustime <- pmin(x$analysis$event, +#' observed_event) / x$analysis$event[3] +#' ustime[3] <- 1 +#' lstime <- ustime +#' +#' xu <- gs_update_ahr(x = x, +#' alpha = 0.015, +#' ustime = ustime, +#' lstime = lstime, +#' event_tbl = event_tbl +#' ) gs_update_ahr <- function( x = NULL, alpha = NULL, diff --git a/man/gs_update_ahr.Rd b/man/gs_update_ahr.Rd index 8a78bc15..3ac022c5 100644 --- a/man/gs_update_ahr.Rd +++ b/man/gs_update_ahr.Rd @@ -119,4 +119,76 @@ gs_update_ahr( # Alpha is updated to 0.05 gs_update_ahr(x = x, alpha = 0.05) + +# ------------------------------------------------- # +# Two-sided asymmetric stratified design, +# beta-spending with non-binding lower bound +# ------------------------------------------------- # +enroll_rate <- define_enroll_rate(stratum = c("A", "B"), duration = c(12, 12), rate = c(1, 1)) + +# We assumme there are 2 strata, "A" and "B". +# For each stratum, there are delayed effect for the first 3 months. +# After the delayed effect, the HR is 0.8 for stratum A and 0.5 for stratum B. +fail_rate <- define_fail_rate(stratum = c("A", "A", "B", "B"), + duration = c(3, Inf, 3, Inf), + fail_rate = log(2) / c(9, 9, 9, 15), + hr = c(1, 0.8, 1, 0.5), + dropout_rate = rep(0.001, 4)) + +# The original design assumes there are 2 IAs and 1 FA cutting by calendar time. +# The efficacy testing is conducted at IA2 and FA. +# The futility testing is conducted at IA1. +x <- gs_design_ahr(enroll_rate = enroll_rate, + fail_rate = fail_rate, + alpha = 0.0125, + beta = 0.1, + analysis = c(20, 28, 36), + upper = "gs_spending_bound", + upar = list(sf = "sfLDOF", total_spend = 0.0125), + lower = "gs_spending_bound", + lpar = list(sf = "sfHSD", total_spend = 0.1, param = -8), + test_upper = c(FALSE, TRUE, TRUE), + test_lower = c(TRUE, FALSE, FALSE)) |> to_integer() + +# At time of analysis +# For IA1, +# - There are 70 events observed during the delayed effect period for stratum A. +# - There are 150 events observed after the delayed effect period for stratum A. +# - There are 75 events observed during the delayed effect period for stratum B. +# - There are 90 events observed after the delayed effect period for stratum B. +# For IA2, +# - There are 75 events observed during the delayed effect period for stratum A. +# - There are 210 events observed after the delayed effect period for stratum A. +# - There are 76 events observed during the delayed effect period for stratum B. +# - There are 136 events observed after the delayed effect period for stratum B. +# For FA, +# - There are 77 events observed during the delayed effect period for stratum A. +# - There are 245 events observed after the delayed effect period for stratum A. +# - There are 77 events observed during the delayed effect period for stratum B. +# - There are 170 events observed after the delayed effect period for stratum B. +event_tbl <- data.frame(analysis = c(1, 1, 1, 1, + 2, 2, 2, 2, + 3, 3, 3, 3), + stratum = c("A", "A", "B", "B", # IA1 + "A", "A", "B", "B", # IA2 + "A", "A", "B", "B"),# FA + # event per interval per stratum at IA1 + event = c(70, 150, 75, 90, + # event per interval per stratum at IA2 + 75, 210, 76, 136, + # event per interval per stratum at FA + 77, 245, 77, 170)) +observed_event <- event_tbl |> group_by(analysis) |> summarize(x = sum(event)) |> pull(x) + +ustime <- pmin(x$analysis$event, + observed_event) / x$analysis$event[3] +ustime[3] <- 1 +lstime <- ustime + +xu <- gs_update_ahr(x = x, + alpha = 0.015, + ustime = ustime, + lstime = lstime, + event_tbl = event_tbl + ) } From e6e481f92c2e14f7cf8a70d8b76058461177970c Mon Sep 17 00:00:00 2001 From: LittleBeannie Date: Wed, 4 Feb 2026 17:24:38 -0500 Subject: [PATCH 2/5] fix the gt testing --- tests/testthat/_snaps/independent_as_gt.md | 94 +++++++++++----------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/tests/testthat/_snaps/independent_as_gt.md b/tests/testthat/_snaps/independent_as_gt.md index 830eda20..fc230e8c 100644 --- a/tests/testthat/_snaps/independent_as_gt.md +++ b/tests/testthat/_snaps/independent_as_gt.md @@ -14,7 +14,7 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} Power computed with average hazard ratio method.\\ + \textsuperscript{\textit{1}}Power computed with average hazard ratio method.\\ \end{minipage} \end{table} @@ -34,7 +34,7 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} Custom footnote.\\ + \textsuperscript{\textit{1}}Custom footnote.\\ \end{minipage} \end{table} @@ -54,7 +54,7 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} Power for Fleming-Harrington test FH(0, 0) (logrank) using method of Yung and Liu.\\ + \textsuperscript{\textit{1}}Power for Fleming-Harrington test FH(0, 0) (logrank) using method of Yung and Liu.\\ \end{minipage} \end{table} @@ -68,7 +68,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}HR at bound\textsuperscript{\textit{2}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -79,8 +79,8 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Approximate hazard ratio to cross bound.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\ \end{minipage} \end{table} @@ -94,7 +94,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}HR at bound\textsuperscript{\textit{2}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -116,8 +116,8 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Approximate hazard ratio to cross bound.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\ \end{minipage} \end{table} @@ -131,7 +131,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}wHR at bound\textsuperscript{\textit{2}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -142,9 +142,9 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Approximate hazard ratio to cross bound.\\ - \textsuperscript{\textit{3}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\ + \textsuperscript{\textit{3}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} @@ -158,7 +158,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability\textsuperscript{\textit{2}}} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}}\textsuperscript{\textit{2}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p & \textasciitilde{}wHR at bound\textsuperscript{\textit{3}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -180,10 +180,10 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} this table is generated by gs\_power\_wlr.\\ - \textsuperscript{\textit{2}} the crossing probability.\\ - \textsuperscript{\textit{3}} approximate weighted hazard ratio to cross bound.\\ - \textsuperscript{\textit{4}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}this table is generated by gs\_power\_wlr.\\ + \textsuperscript{\textit{2}}the crossing probability.\\ + \textsuperscript{\textit{3}}approximate weighted hazard ratio to cross bound.\\ + \textsuperscript{\textit{4}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} @@ -197,7 +197,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrr} \toprule - & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){4-5} Bound & Z & Nominal p\textsuperscript{\textit{1}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -219,8 +219,8 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} EF is event fraction. AHR is under regular weighted log rank test.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}EF is event fraction. AHR is under regular weighted log rank test.\\ \end{minipage} \end{table} @@ -234,7 +234,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}Risk difference at bound & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -245,7 +245,7 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ \end{minipage} \end{table} @@ -259,7 +259,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}Risk difference at bound & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -274,13 +274,13 @@ \midrule\addlinespace[2.5pt] \multicolumn{6}{l}{Analysis: 3 N: 60 Risk difference: 0.05 Information fraction: 1} \\[2.5pt] \midrule\addlinespace[2.5pt] - Efficacy & 1.99 & 0.0231 & 0.1951 & 0.0705 & 0.0238\textsuperscript{\textit{2}} \\ + Efficacy & 1.99 & 0.0231 & 0.1951 & 0.0705 & \textsuperscript{\textit{2}}0.0238 \\ \bottomrule \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Cumulative alpha for final analysis (0.0238) is less than the full alpha (0.025) when the futility bound is non-binding. The smaller value subtracts the probability of crossing a futility bound before crossing an efficacy bound at a later analysis (0.025 - 0.0012 = 0.0238) under the null hypothesis.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Cumulative alpha for final analysis (0.0238) is less than the full alpha (0.025) when the futility bound is non-binding. The smaller value subtracts the probability of crossing a futility bound before crossing an efficacy bound at a later analysis (0.025 - 0.0012 = 0.0238) under the null hypothesis.\\ \end{minipage} \end{table} @@ -294,7 +294,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}wHR at bound\textsuperscript{\textit{2}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -316,9 +316,9 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Approximate hazard ratio to cross bound.\\ - \textsuperscript{\textit{3}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\ + \textsuperscript{\textit{3}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} @@ -332,7 +332,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative probability to cross boundaries} \\ + & & & & \multicolumn{2}{c}{{Cumulative probability to cross boundaries}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}wHR at bound\textsuperscript{\textit{2}} & under H1 & under H0 \\ \midrule\addlinespace[2.5pt] @@ -354,9 +354,9 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Approximate hazard ratio to cross bound.\\ - \textsuperscript{\textit{3}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\ + \textsuperscript{\textit{3}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} @@ -370,7 +370,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability\textsuperscript{\textit{2}}} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}}\textsuperscript{\textit{2}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p & \textasciitilde{}wHR at bound\textsuperscript{\textit{3}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -392,10 +392,10 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} this table is generated by gs\_power\_wlr.\\ - \textsuperscript{\textit{2}} the crossing probability.\\ - \textsuperscript{\textit{3}} approximate weighted hazard ratio to cross bound.\\ - \textsuperscript{\textit{4}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}this table is generated by gs\_power\_wlr.\\ + \textsuperscript{\textit{2}}the crossing probability.\\ + \textsuperscript{\textit{3}}approximate weighted hazard ratio to cross bound.\\ + \textsuperscript{\textit{4}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} @@ -409,7 +409,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrrr} \toprule - & & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){5-6} Bound & Z & Nominal p\textsuperscript{\textit{1}} & \textasciitilde{}wHR at bound\textsuperscript{\textit{2}} & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -428,9 +428,9 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} Approximate hazard ratio to cross bound.\\ - \textsuperscript{\textit{3}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}Approximate hazard ratio to cross bound.\\ + \textsuperscript{\textit{3}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} @@ -444,7 +444,7 @@ \fontsize{12.0pt}{14.0pt}\selectfont \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}lrrrr} \toprule - & & & \multicolumn{2}{c}{Cumulative boundary crossing probability} \\ + & & & \multicolumn{2}{c}{{Cumulative boundary crossing probability}} \\ \cmidrule(lr){4-5} Bound & Nominal p\textsuperscript{\textit{1}} & Z & Alternate hypothesis & Null hypothesis \\ \midrule\addlinespace[2.5pt] @@ -466,8 +466,8 @@ \end{tabular*} \begin{minipage}{\linewidth} \vspace{.05em} - \textsuperscript{\textit{1}} One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ - \textsuperscript{\textit{2}} wAHR is the weighted AHR.\\ + \textsuperscript{\textit{1}}One-sided p-value for experimental vs control treatment. Value < 0.5 favors experimental, > 0.5 favors control.\\ + \textsuperscript{\textit{2}}wAHR is the weighted AHR.\\ \end{minipage} \end{table} From 60b5173042e55711fa34d9676203836e4660e247 Mon Sep 17 00:00:00 2001 From: LittleBeannie Date: Wed, 4 Feb 2026 20:08:31 -0500 Subject: [PATCH 3/5] remove `pull()` from the example --- R/gs_update_ahr.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/gs_update_ahr.R b/R/gs_update_ahr.R index 5d913afb..1e8d3d28 100644 --- a/R/gs_update_ahr.R +++ b/R/gs_update_ahr.R @@ -177,7 +177,7 @@ #' 75, 210, 76, 136, #' # event per interval per stratum at FA #' 77, 245, 77, 170)) -#' observed_event <- event_tbl |> group_by(analysis) |> summarize(x = sum(event)) |> pull(x) +#' observed_event <- (event_tbl |> group_by(analysis) |> summarize(x = sum(event)))$x #' #' ustime <- pmin(x$analysis$event, #' observed_event) / x$analysis$event[3] From e139f144a7d2e46a4be28424d9a71c8787d110c8 Mon Sep 17 00:00:00 2001 From: LittleBeannie Date: Wed, 4 Feb 2026 20:58:54 -0500 Subject: [PATCH 4/5] update the Rd file after removing `pull()` --- man/gs_update_ahr.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/gs_update_ahr.Rd b/man/gs_update_ahr.Rd index 3ac022c5..f48e92c5 100644 --- a/man/gs_update_ahr.Rd +++ b/man/gs_update_ahr.Rd @@ -178,7 +178,7 @@ event_tbl <- data.frame(analysis = c(1, 1, 1, 1, 75, 210, 76, 136, # event per interval per stratum at FA 77, 245, 77, 170)) -observed_event <- event_tbl |> group_by(analysis) |> summarize(x = sum(event)) |> pull(x) +observed_event <- (event_tbl |> group_by(analysis) |> summarize(x = sum(event)))$x ustime <- pmin(x$analysis$event, observed_event) / x$analysis$event[3] From 82509dd551ffd7fb3466a414e6a47fa9e56c8707 Mon Sep 17 00:00:00 2001 From: LittleBeannie Date: Thu, 5 Feb 2026 10:57:30 -0500 Subject: [PATCH 5/5] add namespace to `group_by` and `summarize` --- R/gs_update_ahr.R | 2 +- man/gs_update_ahr.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/gs_update_ahr.R b/R/gs_update_ahr.R index 1e8d3d28..79f9eaa1 100644 --- a/R/gs_update_ahr.R +++ b/R/gs_update_ahr.R @@ -177,7 +177,7 @@ #' 75, 210, 76, 136, #' # event per interval per stratum at FA #' 77, 245, 77, 170)) -#' observed_event <- (event_tbl |> group_by(analysis) |> summarize(x = sum(event)))$x +#' observed_event <- (event_tbl |> dplyr::group_by(analysis) |> dplyr::summarize(x = sum(event)))$x #' #' ustime <- pmin(x$analysis$event, #' observed_event) / x$analysis$event[3] diff --git a/man/gs_update_ahr.Rd b/man/gs_update_ahr.Rd index f48e92c5..3f3d5d42 100644 --- a/man/gs_update_ahr.Rd +++ b/man/gs_update_ahr.Rd @@ -178,7 +178,7 @@ event_tbl <- data.frame(analysis = c(1, 1, 1, 1, 75, 210, 76, 136, # event per interval per stratum at FA 77, 245, 77, 170)) -observed_event <- (event_tbl |> group_by(analysis) |> summarize(x = sum(event)))$x +observed_event <- (event_tbl |> dplyr::group_by(analysis) |> dplyr::summarize(x = sum(event)))$x ustime <- pmin(x$analysis$event, observed_event) / x$analysis$event[3]