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" () and Grunwald, de Heide and Koolen (2024) "Safe Testing" (), 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" (), and Turner, Ly and Grunwald (2024) "Generic E-variables for exact sequential k-sample tests that allow for optional stopping" () for details on safe contingency table tests.


Safestats: an R package for safe, anytime-valid inference.

Safestats is for designing and applying safe hypothesis tests. It can be used for designing hypothesis tests in the prospective or randomised controlled trial (RCT) setting, where the tests can be used under optional stopping allowing experiments to be stopped early without the loss of statistical validity. The 'pilot' functions in the package also enable using the safe tests in the observational/ retrospective setting. For examples and explanation about which test to choose for which study setup, our vignette can be used (see below). The current version includes safe t-tests and tests of two proportions. The initial paper on the theory of safe testing and a worked-out example for the t-test can be found in this paper. More on the theory behind the development of the safe tests for proportions can be found here.

Installation

The development version can be found on GitHub, which can be installed with the devtools package from CRAN by entering in R:

devtools::install_github("AlexanderLyNL/safestats", build_vignettes = TRUE)

Once a stable version is finished, you can install it from CRAN in R through:

install.packages("safestats")

Usage

Load the safestats package:

library("safestats")

For an extensive overview of all functions and their usage, we recommend following the safestats vignette tutorial:

browseVignettes("safestats")

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("safestats")

0.8.8 by Alexander Ly, a month ago


Browse source code at https://github.com/cran/safestats


Authors: 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]


Documentation:   PDF Manual  


LGPL (>= 3) license


Imports stats, lamW, hypergeo, survival, BiasedUrn, boot, dplyr, purrr, rlang, Matrix, graphics

Suggests testthat, knitr, rmarkdown


See at CRAN