pub struct TrendMetrics {
pub slope: Decimal,
pub intercept: Decimal,
pub r_squared: Decimal,
pub moving_average: Vec<Point2D>,
}Expand description
Represents key metrics for analyzing trends within a dataset or curve.
§Overview
This structure stores comprehensive metrics that describe the linear relationship and trend behavior in a dataset. It provides statistical values derived from linear regression analysis along with smoothed data points for visualization and further analysis.
§Fields
- slope: The rate of change in the dependent variable (y-axis) with respect to the independent variable (x-axis), calculated from linear regression.
- intercept: The y-coordinate where the regression line intersects the y-axis, representing the value when x = 0.
- r_squared: The coefficient of determination that measures how well the data fits the regression model, with values closer to 1 indicating a better fit.
- moving_average: A series of smoothed data points derived from the original dataset to reduce noise and highlight the underlying trend pattern.
§Purpose
TrendMetrics is particularly useful for:
- Analyzing time-series data in financial markets
- Evaluating performance trends over time
- Quantifying the strength and direction of relationships between variables
- Providing a basis for predictive modeling and forecasting
This structure is a key component of the curve analysis module and works alongside other metric types to provide comprehensive statistical analysis.
Fields§
§slope: DecimalThe slope coefficient of the linear regression line, indicating the rate and direction of change in the dataset.
intercept: DecimalThe y-intercept of the regression line, showing the baseline value when the independent variable equals zero.
r_squared: DecimalThe coefficient of determination (R²), measuring how well the regression line fits the actual data points. Values range from 0 to 1, where 1 represents a perfect fit.
moving_average: Vec<Point2D>A collection of points representing the smoothed version of the original data, calculated using moving average techniques to reduce noise and highlight the underlying trend.
Trait Implementations§
Source§impl Clone for TrendMetrics
impl Clone for TrendMetrics
Source§impl ComposeSchema for TrendMetrics
impl ComposeSchema for TrendMetrics
Source§impl Debug for TrendMetrics
impl Debug for TrendMetrics
Source§impl Display for TrendMetrics
impl Display for TrendMetrics
Source§impl Serialize for TrendMetrics
impl Serialize for TrendMetrics
Auto Trait Implementations§
impl Freeze for TrendMetrics
impl RefUnwindSafe for TrendMetrics
impl Send for TrendMetrics
impl Sync for TrendMetrics
impl Unpin for TrendMetrics
impl UnsafeUnpin for TrendMetrics
impl UnwindSafe for TrendMetrics
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> 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 moreSource§impl<T> PartialSchema for Twhere
T: ComposeSchema + ?Sized,
impl<T> PartialSchema for Twhere
T: ComposeSchema + ?Sized,
Source§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.