fPCStagewise: Compute stage-wise local p-values

View source: R/adaptive_two_stage.R

fPCStagewiseR Documentation

Compute stage-wise local p-values

Description

Compute local p-values for the intersection hypotheses in a two-stage adaptive multiple testing procedure using a p-value combination method.

Usage

fPCStagewise(
  stg2_p,
  wgtmat = NULL,
  family = NULL,
  corr = NULL,
  stg1_inthyp_nr,
  stg2_elemhyp,
  stg2_wgtmat = NULL,
  test = "dunnett",
  nthreads = 0
)

Arguments

stg2_p

Stage 2 p-values for the elementary hypotheses.

wgtmat

Weight matrix for the stage 1 intersection hypotheses. If NULL, equal weights are assigned within each intersection hypothesis.

family

Family matrix indicating which hypotheses belong to which families. The correlation is known only for hypotheses belonging to the same family. Defaults to one family containing all elementary hypotheses.

corr

Correlation matrix for the test statistics. If NULL, within-family correlations are 0.5 and between-family correlations are missing.

stg1_inthyp_nr

Indices of the stage 1 intersection hypotheses that were not rejected.

stg2_elemhyp

Indices of the elementary hypotheses tested at stage 2.

stg2_wgtmat

Weight matrix for the stage 2 intersection hypotheses. If NULL, equal weights are assigned within each intersection hypothesis.

test

P-value combination method. It can start with "bon", "sim", or "dun"; the default is "dunnett".

nthreads

The number of threads to use in simulations (0 means the default RcppParallel behavior).

Details

Despite the stage-oriented parameter names, this function can also be used to generate stage 1 local p-values. In that case, provide the complete set of intersection hypotheses in stg1_inthyp_nr, all elementary hypotheses in stg2_elemhyp, and the corresponding stage 1 p-values and weight matrix. The example illustrates this use.

Value

A list containing:

  • inthyp_idx: The 1-based indices of the stage 1 intersection hypotheses represented in the output.

  • inthyp: Their intersection-hypothesis indicator matrix.

  • pinter: Their local p-values.

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

References

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

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)
fPCStagewise(stg2_p = c(0.00045, 0.0952, 0.0225, 0.1104),
             wgtmat = wgtmat, family = family, corr = corr,
             stg1_inthyp_nr = 1:15, stg2_elemhyp = 1:4,
             stg2_wgtmat = wgtmat, test = "dunnett",
             nthreads = 1)


lrstat documentation built on Aug. 25, 2026, 5:07 p.m.