saviZTestStat: Computes E-Values Based on the Z-Statistic

View source: R/zTest.R

safeZTestStatR Documentation

Computes E-Values Based on the Z-Statistic

Description

Computes e-values using the z-statistic and the sample sizes based on the test defining parameter phiS.

Evidence for practical equivalence requires the e-value to be small, i.e. smaller than alphaRelevance. If the alternative holds true, i.e. meanDiffTrue >= relevanceSize, then there is no more than alphaRelevance probability of ever seeing eRelevance <= alphaRelevance.

Usage

saviZTestStat(
  z,
  n1,
  n2 = NULL,
  parameter,
  alternative = c("twoSided", "less", "greater"),
  paired = FALSE,
  sigma = 1,
  eType = c("mom", "eGauss", "imom", "eCauchy", "grow"),
  ...
)

saviRelevanceZStat(
  z,
  n1,
  n2 = NULL,
  parameter = NULL,
  alternative = c("twoSided", "less", "greater"),
  paired = FALSE,
  sigma = 1,
  eType = "grow",
  relevanceSize = NULL,
  ...
)

Arguments

z

numeric that represents the observed z-statistic.

n1

integer that represents the size in a one-sample Z-test, (n2=NULL). When n2 is not NULL, this specifies the size of the first sample for a two-sample test.

n2

an optional integer that specifies the size of the second sample. If it's left unspecified, thus, NULL then the z-statistic is assumed to be one-sample.

parameter

numeric > 0, the savi test defining parameter, see matchEParameterWith for details.

alternative

a character string specifying the alternative hypothesis. Must be one of "twoSided" (default), "greater" or "less".

paired

a logical indicating whether you want the paired Z-test.

sigma

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

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.

...

further arguments to be passed to or from methods.

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)

Value

Returns an e-value.

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

saviZTestStat(z=3, n1=100, parameter=0.4, eType="grow")
saviZTestStat(z=3, n1=100, parameter=0.4^2, eType="eGauss")
saviZTestStat(z=3, n1=100, parameter=0.4, eType="eCauchy")
# evidence for the alternative over minimal efficacy
saviRelevanceZStat(z=3, n1=100, parameter=0.4)
# evidence for minimal efficacy over the alternative
saviRelevanceZStat(z=0.35, n1=100, parameter=0.4)

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