View source: R/adaptive_two_stage.R
| fCERRej | R Documentation |
Determine the elementary hypotheses rejected after stage 2 using adapted stage 2 bounds and cumulative p-values.
fCERRej(cum_p, stg1_elemhyp_r_idx, stg2_elemhyp_idx, stg2_inthyp, stg2_bnd_new)
cum_p |
Cumulative p-values for the elementary hypotheses in stage 2. |
stg1_elemhyp_r_idx |
Indices of the elementary hypotheses rejected in stage 1. |
stg2_elemhyp_idx |
Indices of the elementary hypotheses in stage 2. |
stg2_inthyp |
Indicator matrix of the intersection hypotheses in stage 2. |
stg2_bnd_new |
New stage 2 bounds for the elementary hypotheses in each intersection hypothesis. |
A logical vector containing:
One value for each elementary hypothesis, indicating whether it is rejected after stage 2.
Values are ordered by the elementary-hypothesis indices of the original procedure.
Kaifeng Lu, kaifenglu@gmail.com
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))
adapted_bounds <- 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)
stage2_cumulative_pvalues <-
1 - pnorm(sqrt(0.4) * qnorm(1 - c(0.0952, 0.1104)) +
sqrt(1 - 0.4) * qnorm(1 - c(0.0299, 0.0586)))
fCERRej(stage2_cumulative_pvalues,
conditional_error_rates$stg1_elemhyp_r_idx,
stg2_elemhyp_idx = c(2, 4),
adapted_bounds$inthyp, adapted_bounds$stg2_bnd_new)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.