computeEsMinSavi2x2: Computes the smallest detectable propDiffMin with power...

View source: R/newsafe2x2Test.R

computeEsMinSavi2x2R Documentation

Computes the smallest detectable propDiffMin with power probability, for the provided number of blocks

Description

The smallest propDiffMin at which the worst-case power of computePowerSavi2x2() at nBlocks = nBlocksPlan reaches power, found by stats::uniroot() on propDiffBounds. Every candidate is simulated with the same seed, so the target is a deterministic step function of the candidate. There is no planning on logOdds.

Usage

computeEsMinSavi2x2(
  na,
  nb,
  nBlocksPlan,
  power = 0.8,
  alpha = 0.05,
  alternative = c("twoSided", "less", "greater"),
  nSim = 1000L,
  seed = NULL,
  pb = TRUE,
  propDiffBounds = c(0.01, 0.9),
  tol = 1e-05
)

Arguments

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.

nBlocksPlan

planned number of data blocks collected, see scenario 2 and 3 above.

power

numeric in (0, 1) that specifies the desired power, that is, the targetted chance to stop in favour of the alternative over the null hypothesis, when the alternative holds true.

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.

seed

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

pb

logical, if TRUE, then show progress bar.

propDiffBounds

search interval for the magnitude of propDiffMin, strictly inside ⁠(0, 1)⁠.

tol

tolerance of the root on the propDiff scale.

Value

numeric that represents the minimal detectable difference in proportions, negative for "less", or NA when not found.


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