pub fn fishers_exact(
    table: &[u32; 4]
) -> Result<FishersExactPvalues, TooLargeValueError>
Expand description

Computes the Fisher’s exact pvales to determine if there are nonrandom associations between two categorical variables, in a two by two contingency table.

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

Use this when sample sizes are small. For large samples, other statistical tests of independence are more appropriate.

Examples

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);

Errors

Returns TooLargeValueError if any member in the table array is too large. Currently “too large” is defined as greater than std::i32::MAX.