gs_design_ahr: Calculate sample size and bounds given targeted power and...

View source: R/gs_design_ahr.R

gs_design_ahrR Documentation

Calculate sample size and bounds given targeted power and Type I error in group sequential design using average hazard ratio under non-proportional hazards

Description

Calculate sample size and bounds given targeted power and Type I error in group sequential design using average hazard ratio under non-proportional hazards

Usage

gs_design_ahr(
  enroll_rate = define_enroll_rate(duration = c(2, 2, 10), rate = c(3, 6, 9)),
  fail_rate = define_fail_rate(duration = c(3, 100), fail_rate = log(2)/c(9, 18), hr =
    c(0.9, 0.6), dropout_rate = 0.001),
  alpha = 0.025,
  beta = 0.1,
  info_frac = NULL,
  analysis_time = 36,
  ratio = 1,
  binding = FALSE,
  upper = gs_spending_bound,
  upar = list(sf = gsDesign::sfLDOF, total_spend = alpha),
  lower = gs_spending_bound,
  lpar = list(sf = gsDesign::sfLDOF, total_spend = beta),
  h1_spending = TRUE,
  test_upper = TRUE,
  test_lower = TRUE,
  info_scale = c("h0_h1_info", "h0_info", "h1_info"),
  r = 18,
  tol = 1e-06,
  interval = c(0.01, 1000)
)

Arguments

enroll_rate

Enrollment rates defined by define_enroll_rate().

fail_rate

Failure and dropout rates defined by define_fail_rate().

alpha

One-sided Type I error.

beta

Type II error.

info_frac

Targeted information fraction for analyses. See details.

analysis_time

Targeted calendar timing of analyses. See details.

ratio

Experimental:Control randomization ratio.

binding

Indicator of whether futility bound is binding; default of FALSE is recommended.

upper

Function to compute upper bound.

  • gs_spending_bound(): alpha-spending efficacy bounds.

  • gs_b(): fixed efficacy bounds.

upar

Parameters passed to upper.

  • If upper = gs_b, then upar is a numerical vector specifying the fixed efficacy bounds per analysis.

  • If upper = gs_spending_bound, then upar is a list including

    • sf for the spending function family.

    • total_spend for total alpha spend.

    • param for the parameter of the spending function.

    • timing specifies spending time if different from information-based spending; see details.

lower

Function to compute lower bound, which can be set up similarly as upper. See this vignette.

lpar

Parameters passed to lower, which can be set up similarly as upar.

h1_spending

Indicator that lower bound to be set by spending under alternate hypothesis (input fail_rate) if spending is used for lower bound. If this is FALSE, then the lower bound spending is under the null hypothesis. This is for two-sided symmetric or asymmetric testing under the null hypothesis; See this vignette.

test_upper

Indicator of which analyses should include an upper (efficacy) bound; single value of TRUE (default) indicates all analyses; otherwise, a logical vector of the same length as info should indicate which analyses will have an efficacy bound.

test_lower

Indicator of which analyses should include an lower bound; single value of TRUE (default) indicates all analyses; single value FALSE indicated no lower bound; otherwise, a logical vector of the same length as info should indicate which analyses will have a lower bound.

info_scale

Information scale for calculation. Options are:

  • "h0_h1_info" (default): variance under both null and alternative hypotheses is used.

  • "h0_info": variance under null hypothesis is used.

  • "h1_info": variance under alternative hypothesis is used.

r

Integer value controlling grid for numerical integration as in Jennison and Turnbull (2000); default is 18, range is 1 to 80. Larger values provide larger number of grid points and greater accuracy. Normally, r will not be changed by the user.

tol

Tolerance parameter for boundary convergence (on Z-scale); normally not changed by the user.

interval

An interval presumed to include the times at which expected event count is equal to targeted event. Normally, this can be ignored by the user as it is set to c(.01, 1000).

Details

The parameters info_frac and analysis_time are used to determine the timing for interim and final analyses.

  • If the interim analysis is determined by targeted information fraction and the study duration is known, then info_frac is a numerical vector where each element (greater than 0 and less than or equal to 1) represents the information fraction for each analysis. The analysis_time, which defaults to 36, indicates the time for the final analysis.

  • If interim analyses are determined solely by the targeted calendar analysis timing from start of study, then analysis_time will be a vector specifying the time for each analysis.

  • If both the targeted analysis time and the targeted information fraction are utilized for a given analysis, then timing will be the maximum of the two with both info_frac and analysis_time provided as vectors.

Value

A list with input parameters, enrollment rate, analysis, and bound.

  • The ⁠$input⁠ is a list including alpha, beta, ratio, etc.

  • The ⁠$enroll_rate⁠ is a table showing the enrollment for arriving the targeted power (1 - beta).

  • The ⁠$fail_rate⁠ is a table showing the failure and dropout rates, which is the same as input.

  • The ⁠$bound⁠ is a table summarizing the efficacy and futility bound per analysis.

  • The analysis is a table summarizing the analysis time, sample size, events, average HR, treatment effect and statistical information per analysis.

Specification

The contents of this section are shown in PDF user manual only.

Examples

library(gsDesign)
library(gsDesign2)
library(dplyr)

# Example 1 ----
# call with defaults
gs_design_ahr()

# Example 2 ----
# Single analysis
gs_design_ahr(analysis_time = 40)

# Example 3 ----
# Multiple analysis_time
gs_design_ahr(analysis_time = c(12, 24, 36))

# Example 4 ----
# Specified information fraction

gs_design_ahr(info_frac = c(.25, .75, 1), analysis_time = 36)


# Example 5 ----
# multiple analysis times & info_frac
# driven by times
gs_design_ahr(info_frac = c(.25, .75, 1), analysis_time = c(12, 25, 36))
# driven by info_frac

gs_design_ahr(info_frac = c(1 / 3, .8, 1), analysis_time = c(12, 25, 36))


# Example 6 ----
# 2-sided symmetric design with O'Brien-Fleming spending

gs_design_ahr(
  analysis_time = c(12, 24, 36),
  binding = TRUE,
  upper = gs_spending_bound,
  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
  lower = gs_spending_bound,
  lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
  h1_spending = FALSE
)

# 2-sided asymmetric design with O'Brien-Fleming upper spending
# Pocock lower spending under H1 (NPH)

gs_design_ahr(
  analysis_time = c(12, 24, 36),
  binding = TRUE,
  upper = gs_spending_bound,
  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025, param = NULL, timing = NULL),
  lower = gs_spending_bound,
  lpar = list(sf = gsDesign::sfLDPocock, total_spend = 0.1, param = NULL, timing = NULL),
  h1_spending = TRUE
)


# Example 7 ----

gs_design_ahr(
  alpha = 0.0125,
  analysis_time = c(12, 24, 36),
  upper = gs_spending_bound,
  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.0125, param = NULL, timing = NULL),
  lower = gs_b,
  lpar = rep(-Inf, 3)
)

gs_design_ahr(
  alpha = 0.0125,
  analysis_time = c(12, 24, 36),
  upper = gs_b,
  upar = gsDesign::gsDesign(
    k = 3, test.type = 1, n.I = c(.25, .75, 1),
    sfu = sfLDOF, sfupar = NULL, alpha = 0.0125
  )$upper$bound,
  lower = gs_b,
  lpar = rep(-Inf, 3)
)


gsDesign2 documentation built on June 8, 2025, 12:26 p.m.