correlation

Function correlation 

Source
pub fn correlation<T>(x: &ArrayView1<'_, T>, y: &ArrayView1<'_, T>) -> T
where T: Float,
Expand description

Computes the Pearson correlation coefficient between two vectors x and y.

The Pearson correlation coefficient is defined as:

..math:: r = 1 - \frac{\sum (x_i - \mu_x) \cdot (y_i - \mu_y)}{\sqrt{\sum (x_i - \mu_x)^2} \cdot \sqrt{\sum (y_i - \mu_y)^2}}

§Arguments

  • x - A 1D array representing the first vector.
  • y - A 1D array representing the second vector.

§Returns

The Pearson correlation coefficient between the vectors x and y. A value of 1.0 means the vectors are perfectly correlated, and a value of 0.0 means no correlation.