Computes chi squared statistics
(counters: &[u64], expected_count_per_element: u64)
| 361 | |
| 362 | // Computes chi squared statistics |
| 363 | pub fn chi_statistics(counters: &[u64], expected_count_per_element: u64) -> f64 { |
| 364 | let mut chi_statistics = 0_f64; |
| 365 | for c in counters { |
| 366 | chi_statistics += (*c as f64 - expected_count_per_element as f64).powi(2); |
| 367 | } |
| 368 | chi_statistics / expected_count_per_element as f64 |
| 369 | } |
| 370 | |
| 371 | #[cfg(test)] |
| 372 | mod tests { |
no outgoing calls