poisson-rate-test
Rust repo that provides a robust poisson-rate hypothesis test, returning p -values for the probability that two observed poisson data sets are different. The intended use of this single-function library is to test whether two events are occuring at the same rate.
I use it in kda-tools for hypothesis testing loadouts in video games.
Here's a few examples, see more in the docs
use ;
use ;
//create data where rate1 == 1/2 * rate2
let occurances_one = vec!;
let occurances_two = vec!;
let n1 = occurances_one.len as f64;
let n2 = occurances_two.len as f64;
let sum1 = occurances_one.iter. as f64;
let sum2 = occurances_two.iter. as f64;
//test hypothesis that r1/r2 > 1/2
let p = one_tailed_ratio;
assert_eq!; //<-- nope
//let's test the neighbordhood around that
let p = one_tailed_ratio;
assert_gt!; //<-- still nope
//Two sided test. What is the likelihood of seeing the data we got
//given that r1/r2 == 1/2?
let p_half = one_tailed_ratio;
//other side
let p_double = one_tailed_ratio;
//just about 1.0!
assert_gt!;
//we *know* they are not equal, but can we prove it in general?
let mut p_double = two_tailed_rates_equal;
//note: p_double is in [.15,.25]
assert_lt!;//<--looking unlikely... maybe more data is required
assert_gt!;//<--looking unlikely... maybe more data is required
//get more of the same data
let trial2_one = vec!;
let trial2_two = vec!;
let t2n1 = trial2_one.len as f64;
let t2n2 = trial2_two.len as f64;
let t2sum1 = trial2_one.iter. as f64;
let t2sum2 = trial2_two.iter. as f64;
p_double = two_tailed_rates_equal;
assert_lt!;//<--That did the truck