fCERCer: Compute conditional error rates

View source: R/adaptive_two_stage.R

fCERCerR Documentation

Compute conditional error rates

Description

Compute conditional error rates for the intersection hypotheses after the first stage of a two-stage multiple testing procedure.

Usage

fCERCer(
  stg1_p,
  wgtmat,
  family = NULL,
  corr = NULL,
  info_frac,
  stg1_bnd,
  stg2_bnd,
  nthreads = 0
)

Arguments

stg1_p

P-values for the elementary hypotheses in stage 1.

wgtmat

Weight matrix for the intersection hypotheses.

family

Family matrix indicating which hypotheses belong to which families. If NULL, all hypotheses are assumed to belong to the same family.

corr

Correlation matrix for the test statistics.

info_frac

Information fraction for the first stage.

stg1_bnd

Stage 1 bounds for the elementary hypotheses in each intersection hypothesis.

stg2_bnd

Stage 2 bounds for the elementary hypotheses in each intersection hypothesis.

nthreads

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

Value

A list containing:

  • stg1_elemhyp_r_idx: The 1-based indices of elementary hypotheses rejected in stage 1.

  • stg1_inthyp_nr_idx: The 1-based indices of intersection hypotheses not rejected in stage 1.

  • inthyp: The indicator matrix of those non-rejected intersection hypotheses.

  • CER: The conditional error rate for each non-rejected intersection hypothesis.

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)
bounds <- fCERStageBound(
  wgtmat, family, corr, alpha = 0.025,
  alpha1 = errorSpent(0.5, 0.025, "sfOF"),
  info_frac = 0.5, nthreads = 1)
fCERCer(stg1_p = c(0.00045, 0.0952, 0.0225, 0.1104),
        wgtmat, family, corr, info_frac = 0.5,
        bounds$stg1_bnd, bounds$stg2_bnd, nthreads = 1)


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