pub struct LagCorrelation;Expand description
Lag correlation: Pearson at various time offsets.
Implementations§
Source§impl LagCorrelation
impl LagCorrelation
Sourcepub fn compute(
x: &[f64],
y: &[f64],
lags: &[i32],
) -> Result<Vec<(i32, f64)>, MultivariateError>
pub fn compute( x: &[f64], y: &[f64], lags: &[i32], ) -> Result<Vec<(i32, f64)>, MultivariateError>
Compute Pearson correlation at each lag in lags.
A lag whose correlation is undefined — the shift consumes the whole
series, or either window has zero variance — yields NaN, not 0.0.
0.0 is the worse answer of the two because it conflates “uncorrelated”
with “there is not enough information to say”, and it is actionable
where a NaN is visibly absent (the same convention
RollingCorrelation follows).
Cost is O(n) per lag, so O(n·|lags|) overall — ask for the lags wanted rather than a range and then one of them.
§Errors
MultivariateError::DimensionMismatch if x and y differ in
length.
Auto Trait Implementations§
impl Freeze for LagCorrelation
impl RefUnwindSafe for LagCorrelation
impl Send for LagCorrelation
impl Sync for LagCorrelation
impl Unpin for LagCorrelation
impl UnsafeUnpin for LagCorrelation
impl UnwindSafe for LagCorrelation
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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