Skip to main content

Crate use_correlation

Crate use_correlation 

Source
Expand description

Correlation helpers for f64 slices.

The crate provides a population covariance helper and a Pearson correlation helper for paired slices of equal length.

§Examples

use use_correlation::{covariance, pearson_correlation};

let x = [1.0, 2.0, 3.0, 4.0, 5.0];
let y = [2.0, 4.0, 6.0, 8.0, 10.0];

assert_eq!(covariance(&x, &y).unwrap(), 4.0);
assert!((pearson_correlation(&x, &y).unwrap() - 1.0).abs() < 1.0e-12);

Enums§

CorrelationError

Functions§

covariance
pearson_correlation