sampleStoppingTimesSaviT: Simulate stopping times for the savi T-test

View source: R/tTest.R

sampleStoppingTimesSafeTR Documentation

Simulate stopping times for the savi T-test

Description

Simulate stopping times for the savi T-test

Usage

sampleStoppingTimesSaviT(
  deltaTrue,
  alpha = 0.05,
  alternative = c("twoSided", "less", "greater"),
  testType = c("oneSample", "paired", "twoSample"),
  ratio = 1,
  deltaMin = NULL,
  parameter = NULL,
  lowN = 3L,
  nMax = 100000000L,
  eType = c("mom", "eGauss", "imom", "eCauchy", "grow", "lai"),
  wantEValuesAtNMax = FALSE,
  nuMin = 2,
  power = NULL,
  wantSamplePaths = TRUE,
  wantSimData = TRUE,
  sigma = 1,
  sigma2 = 1,
  pb = TRUE,
  seed = NULL,
  nSim = 1000L,
  relevanceTest = FALSE,
  relevanceSize = NULL,
  beta = NULL,
  alphaRelevance = NULL,
  ...
)

Arguments

deltaTrue

numeric, data governing effect size used for simulations. Default deltaTrue=deltaMin.

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

testType

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

ratio

numeric > 0 representing the randomisation ratio of condition 2 over condition 1. If testType is not equal to "twoSample", or if nPlan is of length(1) then ratio=1.

parameter

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

lowN

integer, smallest sample size (of the first group).

nMax

integer > 0, maximum sample size of the (first) sample in each sample path.

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.

wantEValuesAtNMax

logical. If TRUE then compute eValues at nMax. Default FALSE.

wantSamplePaths

logical. If TRUE then output the (stopped) sample paths. Default TRUE.

wantSimData

logical. If TRUE, then output the simulated data.

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 t test under continuous monitoring.

...

further arguments to be passed to or from methods, but mainly to perform do.calls.

deltaMin

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

nuMin

numeric > 0, the minimum degrees of freedom under which the results are trivial, thus, 1.

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. Note that prior to version 0.8.8 power <- 1-beta. The "beta" argument does not need to be specified anymore.

sigma

numeric > 0 representing the population standard deviation used for the test.

sigma2

numeric > 0 representing the population standard deviation used for the test, for the second group in a two-sample t-test

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)

beta

numerical in (0,1). Old parameter now replaced by the power parameter

alphaRelevance

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

Value

a list with stoppingTimes and breakVector. Entries of breakVector are 0, 1. A 1 represents stopping due to exceeding nMax, and 0 due to 1/alpha threshold crossing, which implies that in corresponding stopping time is Inf.

Functions

  • sampleStoppingTimesSafeT(): Deprecated version of sampleStoppingTimesSaviT

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

sampleStoppingTimesSaviT(0.7, nSim=10, nMax=20)

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