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
)

Arguments

stg1_loc_p

A list returned by fPCStagewise for stage 1.

stg2_loc_p

A list returned by fPCStagewise for stage 2.

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.

Value

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.

References

Cyrus Mehta, Ajoy Mukhopadhyay, and Martin Posch. Graph Based, Adaptive, Multiarm, Multiple Endpoint, Two-Stage Designs. Statistics in Medicine. 2025.

Author

Kaifeng Lu, kaifenglu@gmail.com

Examples

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_idx = 1:15, stg2_elemhyp_idx = 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_idx = stage1_rejections$stg1_inthyp_nr_idx,
  stg2_elemhyp_idx = 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)
#> $stg1_inthyp_nr_idx
#> [1]  9 10 11 12 13 14 15
#> 
#> $stg2_elemhyp_idx
#> [1] 2 3 4
#> 
#> $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
#> 
#> $stg1_pinter
#> [1] 0.090000 0.090000 0.095200 0.095200 0.041009 0.022500 0.110400
#> 
#> $stg2_pinter
#> [1] 0.04480000 0.04480000 0.11210000 0.11210000 0.02088606 0.01120000 0.11530000
#> 
#> $comb_pinter
#> [1] 0.015841835 0.015841835 0.037104223 0.037104223 0.003801130 0.001213914
#> [7] 0.043312675
#> 
#> $rej_elem
#> [1] 1 0 1 0
#> 

# 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_idx = stage1_rejections$stg1_inthyp_nr_idx,
  stg2_elemhyp_idx = 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)
#> $stg1_inthyp_nr_idx
#> [1]  9 10 11 12 13 14 15
#> 
#> $stg2_elemhyp_idx
#> [1] 2 3 4
#> 
#> $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
#> 
#> $stg1_pinter
#> [1] 0.090000 0.090000 0.095200 0.095200 0.041009 0.022500 0.110400
#> 
#> $stg2_pinter
#> [1] 0.04177212 0.02986667 0.14946667 0.11210000 0.02497506 0.01120000 0.11530000
#> 
#> $comb_pinter
#> [1] 0.014939436 0.011322627 0.048419844 0.037104223 0.004449217 0.001213914
#> [7] 0.043312675
#> 
#> $rej_elem
#> [1] 1 0 1 0
#>