The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

safestats: Safe Anytime-Valid Inference

Functions to design and apply tests that are anytime valid. The functions can be used to design hypothesis tests in the prospective/randomised control trial setting or in the observational/retrospective setting. The resulting tests remain valid under both optional stopping and optional continuation. The current version includes safe t-tests and safe tests of two proportions. For details on the theory of safe tests, see Ly, A, Boehm, Grunwald, Ramdas and van Ravenzwaaij (2024). "Safe Anytime-Valid Inference: Practical maximally flexible sampling designs for experiments based on e-values" (<doi:10.31234/osf.io/h5vae>) and Grunwald, de Heide and Koolen (2024) "Safe Testing" (<doi:10.1093/jrsssb/qkae011>), for details on safe logrank tests see ter Schure, Perez-Ortiz, Ly and Grunwald (2024) "The Anytime-Valid Logrank Test: Error Control under Continuous Monitoring with Unlimited Horizon" (<doi:10.51387/24-NEJSDS65>), and Turner, Ly and Grunwald (2024) "Generic E-variables for exact sequential k-sample tests that allow for optional stopping" (<doi:10.1016/j.jspi.2023.106116>) for details on safe contingency table tests.

Version: 0.8.8
Depends: R (≥ 4.5)
Imports: stats (≥ 3.6), lamW (≥ 2.2.1), hypergeo (≥ 1.2-13), survival (≥ 3.2-13), BiasedUrn (≥ 1.07), boot (≥ 1.3-28), dplyr (≥ 1.0.6), purrr (≥ 0.3.5), rlang (≥ 1.0.6), Matrix (≥ 1.7-3), graphics (≥ 4.2.2)
Suggests: testthat (≥ 3.0.0), knitr (≥ 1.49), rmarkdown
Published: 2026-09-05
DOI: 10.32614/CRAN.package.safestats
Author: Alexander Ly [cre, aut], Rosanne Turner [aut], Yongqi Wang [aut], Muriel Felipe Perez-Ortiz [ctb], Udo Boehm [ctb], Judith ter Schure [ctb], Peter Grunwald [ctb]
Maintainer: Alexander Ly <alexander.ly.nl at gmail.com>
License: LGPL (≥ 3)
NeedsCompilation: no
Language: en-GB
Materials: README, NEWS
CRAN checks: safestats results [issues need fixing before 2026-10-05]

Documentation:

Reference manual: safestats.html , safestats.pdf
Vignettes: 0. Installing the safestats package (source, R code)
I. Testing: P-values, subjective Bayes factor, and e-variables (source, R code)
II. Design of experiments: Behaviour of e-variables under alternatives (source, R code)
Savi Tests and Confidence Intervals for Tests of Two Proportions: Practical Scenarios (source, R code)
III. Interval estimation: Classical confidence intervals, (Bayesian) credible interval, and anytime-valid confidence sequences (source, R code)
I. Testing: P-values and e-variables (source, R code)
II. Interval estimation: Classical confidence intervals and anytime-valid confidence sequences (source, R code)
III. Design of experiments: Behaviour of e-variables under alternatives (source, R code)
Flexible Safe Anytime-Valid Tests for Practical Scenarios (source, R code)

Downloads:

Package source: safestats_0.8.8.tar.gz
Windows binaries: r-devel: safestats_0.8.8.zip, r-release: safestats_0.8.8.zip, r-oldrel: safestats_0.8.8.zip
macOS binaries: r-release (arm64): safestats_0.8.7.tgz, r-oldrel (arm64): safestats_0.8.8.tgz, r-release (x86_64): safestats_0.8.8.tgz, r-oldrel (x86_64): safestats_0.8.8.tgz
Old sources: safestats archive

Linking:

Please use the canonical form https://CRAN.R-project.org/package=safestats to link to this page.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.