computePowerSaviZ: Helper function: Computes the power based on meanDiffTrue and...

View source: R/zTest.R

computeBetaSafeZR Documentation

Helper function: Computes the power based on meanDiffTrue and nPlan

Description

Helper function: Computes the power based on meanDiffTrue and nPlan

Usage

computePowerSaviZ(
  meanDiffTrue,
  nPlan,
  alpha = 0.05,
  alternative = c("twoSided", "greater", "less"),
  sigma = 1,
  kappa = sigma,
  meanDiffMin = meanDiffTrue,
  testType = c("oneSample", "paired", "twoSample"),
  parameter = NULL,
  eType = c("mom", "eGauss", "imom", "eCauchy", "grow"),
  wantSamplePaths = TRUE,
  wantSimData = TRUE,
  relevanceTest = FALSE,
  relevanceSize = NULL,
  alphaRelevance = NULL,
  pb = TRUE,
  seed = NULL,
  nSim = 1000L,
  nBoot = nSim,
  ...
)

Arguments

meanDiffTrue

numeric, data governing mean difference used for simulations. Default meanDiffTrue=meanDiffMin.

nPlan

optional numeric vector of length at most 2, see scenario 2 and 3 above.

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".

sigma

numeric > 0 representing the assumed population standard deviation used to scale the data.

kappa

the true population standard deviation. Default kappa=sigma.

testType

either one of "oneSample", "paired", "twoSample".

parameter

numeric, an optional savi test defining parameter. Default set to NULL. and adapts to meanDiffMin and eType, see matchEParameterWith for details.

eType

character one of "mom", "grow", "eGauss", and "eCauchy". "mom" is default and uses a non-local moment prior with bump(s) at meanDiffMin, "grow" uses point prior(s) at meanDiffMin, "eGauss" a zero-centred normal prior, "eCauchy" a zero centred Cauchy prior.

wantSamplePaths

logical, if TRUE then also outputs the sample paths.

pb

logical, if TRUE, then show progress bar.

seed

integer, seed number.

nSim

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

nBoot

integer > 0 representing the number of bootstrap samples to assess the accuracy of the approximations of the power, the number of samples for the savi z test under continuous monitoring,or for the computation of the logarithm of the implied target.

...

further arguments to be passed to or from methods.

meanDiffMin

numeric that defines the minimal relevant mean difference, the smallest population mean difference that we would like to detect (with sufficient power).

wantSimData

logical, if TRUE then also output the simulated data

relevanceTest

logical, if TRUE then impose a rule to stop for minimal efficiency if e <= alphaRelevance. Default FALSE.

relevanceSize

numeric, the minimal clinical relevant mean difference that we do not want to miss under the alternative. Default relevanceSize=NULL implies relevanceSize=abs(meanDiffMin)

alphaRelevance

numeric, the threshold for relevance test. Taken to be minimum of alpha and 1-power.

Value

a list which contains at least power and an adapted bootObject of class boot.

Functions

  • computeBetaSafeZ(): Deprecated version of computeBetaSaviZ

References

Grünwald, P. D., de Heide, R., & Koolen, W. (2024). Safe testing. Journal of the Royal Statistical Society. Series B (Methodological), 86(5), 1091-1128. (With discussions), https://doi.org/10.1093/jrsssb/qkae011. Ly, A, Boehm, Grünwald, P. D., Ramdas, A., & van Ravenzwaaij, D. (2024). Safe Anytime-Valid Inference: Practical maximally flexible sampling designs for experiments based on e-values. PsyArXiv Preprint, https://doi.org/10.31234/osf.io/h5vae.

Examples

computePowerSaviZ(meanDiffTrue=0.7, 20, nSim=10)

safestats documentation built on Sept. 6, 2026, 1:06 a.m.