computePowerSavi2x2: Helper function: Computes the power of the savi 2x2 test...

View source: R/newsafe2x2Test.R

computePowerSavi2x2R Documentation

Helper function: Computes the power of the savi 2x2 test based on propDiffMin and nBlocks

Description

Runs sampleStoppingTimesSavi2x2() with nMax = nBlocks and reports, per curve, the fraction of paths that cross 1 / alpha within nBlocks; the worst case is the smallest, since the test must meet its target whatever the baseline is.

Usage

computePowerSavi2x2(
  propDiffMin,
  na,
  nb,
  nBlocks,
  alpha = 0.05,
  alternative = c("twoSided", "less", "greater"),
  nSim = 1000L,
  nBoot = nSim,
  seed = NULL,
  wantSamplePaths = FALSE,
  pb = TRUE
)

Arguments

propDiffMin

numeric in (-1, 1) that defines the minimal relevant difference in proportions thetaA - thetaB, the smallest difference that we would like to detect (with sufficient power).

na

number of observations in group A per data block, one value or one per block.

nb

number of observations in group B per data block, one value or one per block.

nBlocks

integer > 0, the planned number of data blocks.

alpha

numeric in (0, 1) that specifies the tolerable type I error and the null rejection rule e >= 1/alpha.

alternative

a character string specifying the alternative hypothesis. Must be one of "twoSided" (default), "greater" or "less", where "greater" means that group A has the larger proportion.

nSim

integer > 0, the number of simulations needed to compute power or the number of samples paths for the savi 2x2 test under continuous monitoring.

nBoot

integer > 0 representing the number of bootstrap samples to assess the accuracy of the approximations of the power, or the number of blocks for the savi 2x2 test under continuous monitoring.

seed

integer, seed number. Default seed=NULL yields seed=2026.

wantSamplePaths

logical, if TRUE then also outputs the sample paths.

pb

logical, if TRUE, then show progress bar.

Value

a list which contains at least power (the worst case over the curves) and an adapted bootObject bootObjPower of class boot::boot() on that baseline; further powerVec (one per curve), worstCaseThetaA, worstCaseThetaB, nBlocks, and the sampler's thetaA, thetaB, stoppingTimes, breakVector, eValuesStopped, samplePaths, n1Vector.


safestats documentation built on Oct. 5, 2026, 9:07 a.m.