View source: R/adaptive_two_stage.R
| fPCRej | R Documentation |
Combine stage 1 and stage 2 local p-values and determine the elementary hypotheses rejected after stage 2.
fPCRej(
stg1_loc_p,
stg2_loc_p,
stg1_elemhyp_r_idx,
stg2_elemhyp_idx,
alpha,
info_frac
)
stg1_loc_p |
A list returned by |
stg2_loc_p |
A list returned by |
stg1_elemhyp_r_idx |
Indices of the elementary hypotheses rejected at stage 1. |
stg2_elemhyp_idx |
Indices of the elementary hypotheses tested at stage 2. |
alpha |
Overall significance level. |
info_frac |
Information fraction for stage 1. |
A list containing:
stg1_inthyp_nr_idx: The 1-based indices of intersection
hypotheses retained from stage 1.
stg2_elemhyp_idx: The 1-based indices of elementary hypotheses
tested in stage 2.
inthyp: The indicator matrix of the stage 2 intersection
hypotheses.
stg1_pinter: The stage 1 local p-values.
stg2_pinter: The stage 2 local p-values.
comb_pinter: The combined local p-values.
rej_elem: A logical vector indicating the elementary hypotheses
rejected after stage 2.
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)
alpha <- 0.025
alpha1 <- errorSpent(0.5, alpha, "sfOF")
stage1_pvalues <- c(0.00045, 0.0952, 0.0225, 0.1104)
stage1_loc_p <- fPCStagewise(
stg2_p = stage1_pvalues, wgtmat = wgtmat,
family = family, corr = corr,
stg1_inthyp_nr = 1:15, stg2_elemhyp = 1:4,
stg2_wgtmat = wgtmat, test = "dunnett",
nthreads = 1)
stage1_rejections <- fPCStage1(stage1_loc_p, alpha1)
adapted_graph <- updateGraph(initial_weights,
transition_matrix,
I = 1:4, j = 1)
stage2_weight_matrix <- fwgtmat(
w = adapted_graph$w[adapted_graph$I],
G = adapted_graph$G[adapted_graph$I, adapted_graph$I])
stage2_pvalues <- c(0.1121, 0.0112, 0.1153)
stage2_loc_p <- fPCStagewise(
stg2_p = stage2_pvalues, wgtmat = wgtmat,
family = family, corr = corr,
stg1_inthyp_nr = stage1_rejections$stg1_inthyp_nr_idx,
stg2_elemhyp = adapted_graph$I,
stg2_wgtmat = stage2_weight_matrix,
test = "dunnett", nthreads = 1)
fPCRej(stg1_loc_p = stage1_loc_p, stg2_loc_p = stage2_loc_p,
stg1_elemhyp_r_idx = stage1_rejections$stg1_elemhyp_r_idx,
stg2_elemhyp_idx = adapted_graph$I, alpha = alpha,
info_frac = 0.5)
# Change weights for the elementary hypotheses.
stage2_weight_matrix_reweighted <- fwgtmat(
w = c(0.5, 0.25, 0.25),
G = adapted_graph$G[adapted_graph$I, adapted_graph$I])
stage2_loc_p_reweighted <- fPCStagewise(
stg2_p = stage2_pvalues, wgtmat = wgtmat,
family = family, corr = corr,
stg1_inthyp_nr = stage1_rejections$stg1_inthyp_nr_idx,
stg2_elemhyp = adapted_graph$I,
stg2_wgtmat = stage2_weight_matrix_reweighted,
test = "dunnett", nthreads = 1)
fPCRej(stg1_loc_p = stage1_loc_p,
stg2_loc_p = stage2_loc_p_reweighted,
stg1_elemhyp_r_idx = stage1_rejections$stg1_elemhyp_r_idx,
stg2_elemhyp_idx = adapted_graph$I,
alpha = alpha, info_frac = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.