Each simulated trial contains all arms and endpoints. Endpoint counts are generated with their requested marginal Poisson or negative-binomial distributions and a Gaussian-copula dependence structure. Every comparison must pass at least k endpoints for the trial to count as a success.

.power_count_joint_serial(
  n_per_arm,
  rates,
  comparisons,
  exposure = 1,
  margin_lower = 0.8,
  margin_upper = 1.25,
  model = c("poisson", "negative-binomial"),
  dispersion = 0.1,
  alpha = 0.05,
  endpoint_corr = NULL,
  k = NULL,
  type_y = NULL,
  adjust = c("none", "bonferroni", "sidak", "t", "pc", "partial-conjunction",
    "partial_conjunction", "sequential"),
  nsim = 5000,
  seed = NULL,
  design = c("parallel"),
  list_margin_lower = NULL,
  list_margin_upper = NULL,
  type_y_active = FALSE
)

Arguments

n_per_arm

Subjects in each arm. This joint implementation supports parallel-group designs.

rates

Named list of equal-length endpoint-rate vectors, one per arm.

comparisons

Named list of length-two character vectors. The first arm is the test arm and the second is the reference arm.

exposure

Exposure per subject, scalar or one value per endpoint, or a named list with one scalar/vector per arm.

margin_lower

Lower rate-ratio equivalence margin.

margin_upper

Upper rate-ratio equivalence margin.

model

Count model: "poisson" or "negative-binomial".

dispersion

Positive negative-binomial dispersion parameter, scalar or a named list with one scalar/vector per arm.

alpha

One-sided significance level, scalar or one value per endpoint.

endpoint_corr

Positive-definite latent Gaussian correlation matrix across endpoints. The default is independence.

k

Number of endpoints that must pass within every comparison.

type_y

Numeric endpoint hierarchy used with adjust = "seq": 1 for primary/co-primary endpoints and 2 for secondary endpoints.

adjust

Multiplicity adjustment within each comparison's selected endpoint family: "none", "bonferroni", "sidak", "t", or "seq"/"sequential". The "t" option uses Mielke's strong k-out-of-m calibration alpha / (m - k + 1); legacy partial-conjunction labels are accepted. Sequential testing uses the primary gate and secondary-family rule used by the continuous kernels. When all supplied endpoints are required (k equals the endpoint count), endpoint-wise adjustment is not necessary for the intersection-union decision; a requested adjustment remains available with a warning.

nsim

Number of simulated trials.

seed

Optional random seed.

design

Joint multi-arm design; currently only "parallel" is supported because multiple reference arms do not define a single standard 2x2 crossover design.

list_margin_lower

Optional named list of lower margins, one vector per comparison. Each vector is scalar or has one value per endpoint.

list_margin_upper

Optional named list of upper margins, one vector per comparison. Each vector is scalar or has one value per endpoint.

type_y_active

Internal flag indicating whether type_y is active.

Value

An object of class countpower containing joint power and a binomial confidence interval.

Examples

rates <- list(TEST = c(.20, .20), REF = c(.20, .20), ALT = c(.20, .20))
SimTOST:::power_count_joint(100, rates, list(REF = c("TEST", "REF"),
                     ALT = c("TEST", "ALT")), nsim = 100, seed = 1)
#> Count-rate equivalence power
#> Model: poisson 
#> Design: parallel 
#> Subjects per arm: 100 
#> Endpoints: 2 (required: 2 )
#> Alpha adjustment: none 
#> Power: 0.0000 [0.0000, 0.0461]