Function poisson_rate_test::one_tailed_ratio [−][src]
pub fn one_tailed_ratio(
num_events_one: f64,
t_one: f64,
num_events_two: f64,
t_two: f64,
h0_rate_ratio: f64
) -> f64
Expand description
Conducts a likelihood ratio test (LHR) to determine if the two rates, r1 and r2, satisfy R>=r1/r2 for a ratio R.
The returned value is the probability of observing these two data sets given that r1/r2=R
See: >Gu, Ng, Tuang, Schucany 2008 “Testing the Ratio of Two Poisson Rates”`
Example: Testing two unequal rate events
use poisson_rate_test::one_tailed_ratio; let occurances_observed = vec![0,0,1,0]; let occurances_other = vec![1,1,5,3,3,9]; let n1 = occurances_observed.len() as f64; let n2 = occurances_other.len() as f64; let sum1 = occurances_observed.iter().sum::<usize>() as f64; let sum2 = occurances_other.iter().sum::<usize>() as f64; //are these rates the same (e.g. 1.0 is the ratio of rates)? let p = one_tailed_ratio(sum1, n1, sum2, n2, 1.0); assert!(p<0.01); //<--confidently no