2 stable releases

Uses old Rust 2015

1.0.1 Nov 5, 2018
0.1.1 Sep 16, 2017
0.1.0 Sep 14, 2017

#1222 in Math

Download history 111/week @ 2023-11-23 150/week @ 2023-11-30 191/week @ 2023-12-07 188/week @ 2023-12-14 61/week @ 2023-12-21 75/week @ 2023-12-28 124/week @ 2024-01-04 170/week @ 2024-01-11 107/week @ 2024-01-18 136/week @ 2024-01-25 147/week @ 2024-02-01 174/week @ 2024-02-08 180/week @ 2024-02-15 234/week @ 2024-02-22 246/week @ 2024-02-29 103/week @ 2024-03-07

784 downloads per month
Used in 3 crates

MIT/Apache

16KB
341 lines

Fisher's exact test

Build Status

Implements a 2×2 Fishers exact test. Use this to test the independence of two categorical variables when the sample sizes are small.

For an approachable explanation of Fisher's exact test, see Fisher's exact test of independence by John H. McDonald in the Handbook of Biological Statistics.

The test is computed using code ported from Øyvind Langsrud's JavaScript implementation at http://www.langsrud.com/fisher.htm, used with permission.

use fishers_exact::fishers_exact;

let p = fishers_exact(&[1,9,11,3]).unwrap();

assert!((p.less_pvalue - 0.001346).abs() < 0.0001);
assert!((p.greater_pvalue - 0.9999663).abs() < 0.0001);
assert!((p.two_tail_pvalue - 0.0027594).abs() < 0.0001);

lib.rs:

Fisher's exact test.

Implements a 2×2 Fishers exact test. Use this to test the independence of two categorical variables when the sample sizes are small.

For an approachable explanation of Fisher's exact test, see Fisher's exact test of independence by John H. McDonald in the Handbook of Biological Statistics.

The test is computed using code ported from Øyvind Langsrud's JavaScript implementation at http://www.langsrud.com/fisher.htm, used with permission.

No runtime deps