pub struct PearsonCorrelation;Expand description
Pearson correlation coefficient.
Implementations§
Source§impl PearsonCorrelation
impl PearsonCorrelation
Sourcepub fn compute(x: &[f64], y: &[f64]) -> Result<f64, MultivariateError>
pub fn compute(x: &[f64], y: &[f64]) -> Result<f64, MultivariateError>
Compute Pearson correlation between two equal-length slices.
NaN pairs are deleted pairwise — rolling_corr does the same within
each window. When either series has zero variance the correlation
is undefined and the result is NaN, not 0.0: 0.0 asserts “these
series are uncorrelated” where the truth is “there is nothing to
correlate”, and a caller acts on the first.
That sentence used to claim rolling_corr shared this convention
while rolling_corr folded a NaN into a sliding accumulator and
nulled the rest of its partition. A doc comment asserting that two
implementations agree is worth a test that they do; see
chronix/tests/analytics_null_semantics.rs.
§Errors
MultivariateError::DimensionMismatch on unequal lengths, and
MultivariateError::InsufficientData with fewer than two usable
pairs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PearsonCorrelation
impl RefUnwindSafe for PearsonCorrelation
impl Send for PearsonCorrelation
impl Sync for PearsonCorrelation
impl Unpin for PearsonCorrelation
impl UnsafeUnpin for PearsonCorrelation
impl UnwindSafe for PearsonCorrelation
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more