| gs_cp | R Documentation |
Conditional power computation with non-constant effect size for non-/crossing an upper boundary at analysis j given observed Z value at analysis i
gs_cp(x = NULL, theta = NULL, i = 1, zi = NULL)
x |
An object of type gsDesign2. |
theta |
Optional numeric vector with length |
i |
Index of current analysis, with default of 1. |
zi |
Numeric scalar z-value observed at analysis |
We assume Z_i, i = 1, ..., K are the z-statistics at an interim analysis i, respectively.
We assume further Z_i, i = 1, ..., K follows multivariate normal distribution
E(Z_i) = \theta_i\sqrt{I_i}
Cov(Z_i, Z_j) = I_i/I_j
. See https://merck.github.io/gsDesign2/articles/story-npe-background.html for assumption details.
The returned value is list of
P(\{Z_j \geq b_j\} \& \{\cap_{m=i+1}^{j-1} a_m \leq Z_m < b_m\} \mid Z_i = z_i).
P(\{Z_j \geq b_j\} \& \{\cap_{m=i+1}^{j-1} Z_m < b_m\} \mid Z_i = z_i).
P(\{Z_j \leq b_j\} \& \{\cap_{m=i+1}^{j-1} a_m \leq Z_m < b_m\} \mid Z_i = z_i).
A list with the following elements:
prob_alphaA numeric vector of
(\alpha_{i,i+1}, \ldots, \alpha_{i,j-1}, \alpha_{i,j}), where
\alpha_{i,j} = P(\{Z_j \geq b_j\} \& \{\cap_{m=i+1}^{j-1} a_m \leq Z_m < b_m\} \mid Z_i = z_i).
prob_alpha_plusA numeric vector of
(\alpha^+_{i,i+1}, \ldots, \alpha^+_{i,j-1}, \alpha^+_{i,j}), where
\alpha^+_{i,j} = P(\{Z_j \geq b_j\} \& \{\cap_{m=i+1}^{j-1} Z_m < b_m\} \mid Z_i = z_i).
prob_betaA numeric vector of
(\beta_{i,i+1}, \ldots, \beta_{i,j-1}, \beta_{i,j}), where
\beta_{i,j} = P(\{Z_j \leq b_j\} \& \{\cap_{m=i+1}^{j-1} a_m \leq Z_m < b_m\} \mid Z_i = z_i).
library(gsDesign2)
library(gsDesign)
library(dplyr)
library(mvtnorm)
# Example 1
# original design ----
enroll_rate <- define_enroll_rate(duration = c(2, 2, 2, 18),
rate = c(1, 2, 3, 4))
fail_rate <- define_fail_rate(duration = c(3, Inf),
fail_rate = log(2) / 10,
dropout_rate = 0.001,
hr = c(1, 0.7))
x <- gs_design_ahr(enroll_rate = enroll_rate, fail_rate = fail_rate,
alpha = 0.025, beta = 0.1, ratio = 1,
info_frac = c(0.4, 0.6, 0.8, 1), analysis_time = 30,
binding = FALSE,
upper = gs_spending_bound,
upar = list(sf = sfLDOF, total_spend = 0.025, param = NULL),
lower = gs_spending_bound,
lpar = list(sf = sfLDOF, total_spend = 0.1),
h1_spending = TRUE,
test_lower = TRUE,
info_scale = "h0_h1_info") |> to_integer()
# calculate conditional power
# case 1: currently at IA1, compute conditional power at IA2, IA3 and FA,
# with default theta = NULL
gs_cp(x = x, i = 1,
zi = -gsDesign::hrn2z(hr = 0.8, n = 150+180, ratio = 1))
# case 2: currently at IA1, compute conditional power at IA2, IA3 and FA,
# with user-input theta
gs_cp(x = x,
theta = c(0.15, 0.2, 0.25, 0.3),
i = 1,
zi = -gsDesign::hrn2z(hr = 0.8, n = 150+180, ratio = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.