Compute new stage 2 bounds after an adaptation of the hypotheses tested or their weights.
fCERNewBound(
stg1_p,
wgtmat,
family = NULL,
corr = NULL,
stg1_inthyp_nr_idx,
CER,
stg2_elemhyp_idx,
stg2_wgtmat,
info_frac_new,
nthreads = 0
)P-values for the elementary hypotheses in stage 1.
Weight matrix for the original intersection hypotheses.
Family matrix indicating which hypotheses belong to which families. If NULL, all hypotheses are assumed to belong to the same family.
Correlation matrix for the test statistics.
Indices of the intersection hypotheses not rejected in stage 1.
Conditional error rates for the intersection hypotheses.
Indices of the elementary hypotheses in stage 2.
Weight matrix for the intersection hypotheses in stage 2.
New information fraction for stage 1 after adaptation.
The number of threads to use in simulations (0 means the default RcppParallel behavior).
A list containing:
inthyp: The indicator matrix of the adapted intersection
hypotheses.
stg2_coef_new: The new stage 2 coefficient for each adapted
intersection hypothesis.
stg2_bnd_new: The new stage 2 bounds for the elementary hypotheses
in each adapted intersection hypothesis.
Cyrus Mehta, Ajoy Mukhopadhyay, and Martin Posch. Graph Based, Adaptive, Multiarm, Multiple Endpoint, Two-Stage Designs. Statistics in Medicine. 2025.
initial_weights <- c(0.5, 0.5, 0, 0)
transition_matrix <- matrix(c(0, 0.5, 0.5, 0,
0.5, 0, 0, 0.5,
0, 1, 0, 0,
1, 0, 0, 0),
nrow = 4, byrow = TRUE)
wgtmat <- fwgtmat(initial_weights, transition_matrix)
family <- matrix(c(1, 1, 0, 0,
0, 0, 1, 1),
nrow = 2, byrow = TRUE)
corr <- matrix(c(1, 0.5, NA, NA,
0.5, 1, NA, NA,
NA, NA, 1, 0.5,
NA, NA, 0.5, 1),
nrow = 4, byrow = TRUE)
stage1_pvalues <- c(0.00045, 0.0952, 0.0225, 0.1104)
bounds <- fCERStageBound(
wgtmat, family, corr, alpha = 0.025,
alpha1 = errorSpent(0.5, 0.025, "sfOF"),
info_frac = 0.5, nthreads = 1)
conditional_error_rates <- fCERCer(
stage1_pvalues, wgtmat, family, corr, info_frac = 0.5,
bounds$stg1_bnd, bounds$stg2_bnd, nthreads = 1)
stage2_weight_matrix <- fwgtmat(
w = c(0.5, 0.5),
G = matrix(c(0, 1, 1, 0), 2, 2, byrow = TRUE))
fCERNewBound(stage1_pvalues, wgtmat, family, corr,
conditional_error_rates$stg1_inthyp_nr_idx,
conditional_error_rates$CER,
stg2_elemhyp_idx = c(2, 4),
stage2_weight_matrix, info_frac_new = 0.4,
nthreads = 1)
#> $inthyp
#> [,1] [,2] [,3] [,4]
#> [1,] 0 1 1 1
#> [2,] 0 1 1 0
#> [3,] 0 1 0 1
#> [4,] 0 1 0 0
#> [5,] 0 0 1 1
#> [6,] 0 0 1 0
#> [7,] 0 0 0 1
#>
#> $stg2_coef_new
#> [1] 0.04193173 0.03825061 0.02746724 0.02439920 0.05420421 0.00000000 0.02371440
#>
#> $stg2_bnd_new
#> [,1] [,2] [,3] [,4]
#> [1,] 0 0.02096586 0 0.02096586
#> [2,] 0 0.03825061 0 0.00000000
#> [3,] 0 0.01373362 0 0.01373362
#> [4,] 0 0.02439920 0 0.00000000
#> [5,] 0 0.00000000 0 0.05420421
#> [6,] 0 0.00000000 0 0.00000000
#> [7,] 0 0.00000000 0 0.02371440
#>