Learn R Programming

Package BootstrapTests

This package BootstrapTests implements several methods to perform bootstrap-based hypothesis testing procedures on three statistical problems: independence testing, testing the slope in a linear regression setting, and goodness-of-fit testing.

Installation

You can install the development version of BootstrapTests from GitHub using the devtools package with:

# install.packages("devtools")
devtools::install_github("AlexisDerumigny/BootstrapTests")

Examples

The following three subsections will showcase the use of the ‘BootstrapTests’ package for the independence hypothesis testing, testing whether or not the slope is zero in a linear regression setting, and goodness-of-fit testing. In particular, we will show the use of the functions that implement these:

  • perform_independence_test.R
  • perform_regression_test.R
  • perform_GoF_test.R

Independence testing

We perform a hypothesis test of statistical independence by means of bootstrapping. The null hypothesis is that of independence between the two random variables, versus the alternative of dependence between them. This procedure gives a total of 8 combinations of bootstrap resampling schemes (nonparametric and independent), test statistics (centered and equivalent), and Kolmogorov-Smirnov or L2-type of true test statistic. This function gives the corresponding p-values, the true test statistic and the bootstrap-version test statistics. The default (and valid) method implemented in this function is the null bootstrap, together with the equivalent test statistic and Kolmogorov-Smirnov test statistic. Via the bootstrapOptions argument, the user can specify other bootstrap resampling schemes and test statistics.

library(BootstrapTests)
n <- 100

# Under H1
X1 <- rnorm(n)
X2 <- X1 + rnorm(n)
result <- perform_independence_test(
  X1, X2, nBootstrap = 100,
  bootstrapOptions = list(type_boot = "indep",
                          type_stat = "eq",
                          type_norm = "KS") )
print(result)
#>          

Copy Link

Version

Install

install.packages('BootstrapTests')

Version

0.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Wieger Schipper

Last Published

December 22nd, 2025

Functions in BootstrapTests (0.1.0)

perform_regression_test

Perform a test on the slope coefficient of a univariate linear regression
perform_independence_test

Perform a hypothesis test of independence
BootstrapTests-package

BootstrapTests: Bootstrap-Based Hypothesis Testing using Different Resampling Schemes
plot.bootstrapTest

Plot and print the bootstrap test statistics distribution
perform_GoF_test

Perform a univariate goodness-of-fit (GoF) hypothesis test via bootstrap resampling