Function fishers_exact::fishers_exact
[−]
[src]
pub fn fishers_exact(table: &[i32; 4], test_tails: TestTails) -> f64
Computes the Fisher's exact test to determine if there are nonrandom associations between two categorical variables, in a two by two contingency table.
The test is computed using the Fisher's exact test code copied from the R statistical computing package.
Given a one dimensional representation of a two by two contingency, table [a,b,c,d], the test computes:
p = ((a + b)!(c + d)!(a + c)!(b + d)!) / (a! b! c! d! (a+b+c+d)!)
Either a one tailed or two tailed test can be computed.
use fishers_exact::{fishers_exact,TestTails}; let p = fishers_exact(&[1,9,11,3], TestTails::Two); assert_eq!(0.001346 * 1e6, (p * 1e6).round())