Function poisson_rate_test::two_tailed_rates_equal[][src]

pub fn two_tailed_rates_equal(
    num_events_one: f64,
    t_one: f64,
    num_events_two: f64,
    t_two: f64
) -> f64
Expand description

Returns the p-value of the two-tailed hypothesis test r1/r2 != 1.0 Or, tests the equality of the rates of two poisson processes, by their observed parameters (sum of events and # trials)

Example: Testing the rate of one set of data

use poisson_rate_test::two_tailed_rates_equal;
let data = vec![0,1,1,0];
let n1 = data.len() as f64;
let sum1 = data.iter().sum::<usize>() as f64;
//are these rates equal to my hypothesized rate of 0.5?
let expected_n = n1;
let expected_sum = 0.5 * n1;
let p = two_tailed_rates_equal(sum1, n1, expected_sum, expected_n);
assert!(p>0.99); //<--confidently yes