https://github.com/ssoudan/bootstrap-ht

Bootstrap Hypothesis Testing in Rust

https://github.com/ssoudan/bootstrap-ht

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.3%) to scientific vocabulary

Keywords

bootstraping hypothesis-testing rust statistics
Last synced: 6 months ago · JSON representation

Repository

Bootstrap Hypothesis Testing in Rust

Basic Info
  • Host: GitHub
  • Owner: ssoudan
  • Language: Rust
  • Default Branch: main
  • Homepage:
  • Size: 27.3 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Topics
bootstraping hypothesis-testing rust statistics
Created over 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme

README.md

Bootstrap Hypothesis Testing in Rust

Build crates.io

Description

Sometime, we have no idea what the distribution of the test statistic is, we really want to be able to perform hypothesis tests, and we are willing to make the hypothesis that the samples we have are representative of the population.

This is where the bootstrap hypothesis testing comes in. The idea is to generate a large number of samples from the null distribution (distribution the samples would have if H0 is true - i.e. if both samples are from the same population) and then compute the test statistic for each of these samples. This gives a test statistics sampling distribution under H0.

We can then compute the p-value by counting the number of times the sampled test statistic is more 'extreme' than the test statistic for our initial samples.

# References - Introduction to the Bootstrap, Efron and Tibshirani - Bootstrap Hypothesis Testing - P-value - Stats 102A Lesson 9-2 Bootstrap Hypothesis Tests, Miles Chen

Usage

```rust use bootstrapht::prelude::*; use itertools::Itertools; use rand::prelude::Distribution; use rand::SeedableRng; use randchacha::ChaCha8Rng; use rand_distr::StandardNormal;

fn main() { let mut rng = ChaCha8Rng::seedfromu64(42);

let a = StandardNormal .sampleiter(&mut rng) .take(100) .collect::>(); let b = StandardNormal .sampleiter(&mut rng) .take(40) .map(|x: f64| x + 2.0) .collect::>();

let teststatisticfn = |a: &[f64], b: &[f64]| { let amax = a.iter().copied().fold(f64::NAN, f64::max); let bmax = b.iter().copied().fold(f64::NAN, f64::max); (amax - bmax).abs() };

let pvalue = bootstrap::twosamplesnonparametricht( &mut rng, &a, &b, teststatisticfn, bootstrap::PValueType::OneSidedRightTail, 10000, ) .unwrap(); asserteq!(pvalue, 0.0021); } ```

Owner

  • Name: Sebastien Soudan
  • Login: ssoudan
  • Kind: user
  • Location: San Jose, CA

GitHub Events

Total
  • Pull request event: 1
  • Create event: 1
Last Year
  • Pull request event: 1
  • Create event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 6
  • Total Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 6
  • Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Sebastien Soudan s****n@g****m 6

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
Pull Request Authors
  • dependabot[bot] (2)
Top Labels
Issue Labels
Pull Request Labels
dependencies (2)

Dependencies

Cargo.toml cargo
  • approx 0 development
  • criterion 0 development
  • itertools 0 development
  • rand_chacha 0 development
  • rand_distr 0 development
  • num-traits 0
  • rand 0
  • rand_distr 0
  • thiserror 1
.github/workflows/pull_request.yml actions
  • actions/checkout master composite
  • boa-dev/criterion-compare-action v3.0.0 composite
.github/workflows/rust.yml actions
  • EmbarkStudios/cargo-deny-action v1 composite
  • actions-rs/cargo v1 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v2 composite