pub struct DFAnalysis {
pub alpha: f64,
pub intercept: f64,
pub r_squared: f64,
pub log_n: Vec<f64>,
pub log_f: Vec<f64>,
}Expand description
A struct representing Detrended Fluctuation Analysis (DFA) results.
DFA is a method used to find long-term statistical dependencies in time series data.
§Fields
alpha- The scaling exponent, which indicates the presence of long-range correlations.intercept- The intercept of the linear fit in the log-log plot.r_squared- The coefficient of determination, which indicates the goodness of fit.log_n- A vector containing the logarithm of the box sizes used in the analysis.log_f- A vector containing the logarithm of the fluctuation function values corresponding to the box sizes.
Fields§
§alpha: f64§intercept: f64§r_squared: f64§log_n: Vec<f64>§log_f: Vec<f64>Implementations§
Source§impl DFAnalysis
impl DFAnalysis
Sourcepub fn dfa(
data: &[f64],
windows: &[usize],
detrender: DetrendStrategy,
) -> Result<Self>
pub fn dfa( data: &[f64], windows: &[usize], detrender: DetrendStrategy, ) -> Result<Self>
Performs Detrended Fluctuation Analysis (DFA) on the provided data.
This method computes the scaling exponent (Hurst exponent) and other statistical properties of a time series using the DFA algorithm. DFA is used to detect long-range correlations in time series data.
§Arguments
data: A slice off64representing the input time series data.windows: A slice ofusizespecifying the window sizes to use for the fluctuation analysis.detrender: ADetrendStrategyimplementation used to remove trends from each segment.
§Returns
If successful, this method returns a DFAnalysis instance containing:
alpha: The estimated scaling exponent.intercept: The intercept of the log-log regression.r_squared: The coefficient of determination for the log-log fit.log_n: A vector of log-transformed window sizes.log_f: A vector of log-transformed fluctuation amplitudes.
§Errors
This method returns an error if:
windowsis empty.- The length of the input data is less than four times the largest window size.
- The smallest window size is less than 4.
- The
detrenderfails to detrend a segment.
§Algorithm Overview
-
Integration:
- The input data is transformed into a cumulative deviation profile (mean-centered).
-
Segment Detrending:
- The profile is divided into overlapping segments, and each segment is detrended using
the provided
DetrendStrategy.
- The profile is divided into overlapping segments, and each segment is detrended using
the provided
-
Variance Calculation:
- Variances of the detrended segments are computed.
-
Log-Log Regression:
- The log-transformed window sizes (
log_n) and fluctuations (log_f) are used to perform a linear regression, yielding the scaling exponentalpha.
- The log-transformed window sizes (
Sourcepub fn udfa(
data: &[f64],
windows: &[usize],
detrender: DetrendStrategy,
) -> Result<Self>
pub fn udfa( data: &[f64], windows: &[usize], detrender: DetrendStrategy, ) -> Result<Self>
Performs an unbiased Detrended Fluctuation Analysis (DFA) on the provided data. this algorithm uses overlapping windows.
This method computes the scaling exponent (Hurst exponent) and other statistical properties of a time series using the DFA algorithm. DFA is used to detect long-range correlations in time series data.
§Arguments
data: A slice off64representing the input time series data.windows: A slice ofusizespecifying the window sizes to use for the fluctuation analysis.detrender: ADetrendStrategyimplementation used to remove trends from each segment.
§Returns
If successful, this method returns a DFAnalysis instance containing:
alpha: The estimated scaling exponent.intercept: The intercept of the log-log regression.r_squared: The coefficient of determination for the log-log fit.log_n: A vector of log-transformed window sizes.log_f: A vector of log-transformed fluctuation amplitudes.
§Errors
This method returns an error if:
windowsis empty.- The length of the input data is less than four times the largest window size.
- The smallest window size is less than 4.
- The
detrenderfails to detrend a segment.
§Algorithm Overview
-
Integration:
- The input data is transformed into a cumulative deviation profile (mean-centered).
-
Segment Detrending:
- The profile is divided into overlapping segments, and each segment is detrended using
the provided
DetrendStrategy.
- The profile is divided into overlapping segments, and each segment is detrended using
the provided
-
Variance Calculation:
- Variances of the detrended segments are computed.
-
Log-Log Regression:
- The log-transformed window sizes (
log_n) and fluctuations (log_f) are used to perform a linear regression, yielding the scaling exponentalpha.
- The log-transformed window sizes (
Trait Implementations§
Source§impl Clone for DFAnalysis
impl Clone for DFAnalysis
Source§fn clone(&self) -> DFAnalysis
fn clone(&self) -> DFAnalysis
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DFAnalysis
impl RefUnwindSafe for DFAnalysis
impl Send for DFAnalysis
impl Sync for DFAnalysis
impl Unpin for DFAnalysis
impl UnwindSafe for DFAnalysis
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.