pub struct BasicMetrics {
pub mean: Decimal,
pub median: Decimal,
pub mode: Decimal,
pub std_dev: Decimal,
}Expand description
Represents a collection of fundamental statistical metrics.
§Overview
The BasicMetrics structure encapsulates the core descriptive statistics
for a dataset, providing a quick summary of its central tendency, spread,
and distribution properties. These metrics are widely used in statistical analysis,
curve analysis, and various financial or scientific computations.
§Fields
-
mean- The arithmetic average of the dataset. Represents the central value where the sum of all data points is divided by the total number of points. Useful for understanding the overall trend or expected value of the dataset. -
median- The middle value in the dataset when sorted. If the dataset has an even number of elements, the median is the average of the two middle elements. A robust measure of central tendency, particularly in datasets with outliers. -
mode- The most frequently occurring value in the dataset. If no value repeats, the mode might not be well-defined (or may represent multi-modal distributions). Useful for identifying common or dominant values in a dataset. -
std_dev- The standard deviation of the dataset, which quantifies the amount of variation or dispersion from the mean. A key measure of data spread, often used for assessing volatility or risk in financial contexts.
§Applications
The BasicMetrics structure is utilized in various domains requiring descriptive statistics:
-
Financial Analysis:
- Evaluate price variations, returns, and risks.
-
Scientific Research:
- Summarize observations and patterns in experimental data.
-
Data Science:
- Understand distributions, clean data, and preprocess datasets for machine learning models.
§Integration
The BasicMetrics structure is often used as part of larger metric aggregations, such as:
Metrics: CombinesBasicMetricswith other metrics for a detailed analysis of curve behavior.AnalysisResult: Provides a high-level result of statistical and shape analysis for curves.
§Remarks
- The values are expressed as
Decimalto maintain precision, important in financial computations or datasets requiring high accuracy. - The
BasicMetricsstructure is immutable and can be cloned/copied, making it efficient for use in concurrent or parallel computations.
§Example Workflow
Typically, BasicMetrics is computed from a dataset using statistical functions
and then integrated into a more comprehensive analysis pipeline.
§Related Concepts
ShapeMetrics: Captures shape-related properties like skewness and kurtosis.RiskMetrics: Measures risk characteristics of financial instruments.TrendMetrics: Represents time-based trends in data series.
Fields§
§mean: DecimalThe arithmetic mean (average) of the dataset. Calculated by summing all values and dividing by the count of values. Provides a measure of central tendency that is affected by all values, including outliers.
median: DecimalThe median value of the dataset. Represents the middle value when all data points are arranged in ascending order. For datasets with even count, it’s the average of the two middle values. Less sensitive to outliers than the mean.
mode: DecimalThe most frequently occurring value in the dataset. If multiple values occur with equal frequency, this typically represents the first encountered mode or a calculated central mode. For multi-modal distributions, this is a simplification.
std_dev: DecimalThe standard deviation of the dataset. Measures the amount of variation or dispersion from the mean. A low standard deviation indicates values tend to be close to the mean, while a high standard deviation indicates values are spread over a wider range.
Trait Implementations§
Source§impl Clone for BasicMetrics
impl Clone for BasicMetrics
Source§impl ComposeSchema for BasicMetrics
impl ComposeSchema for BasicMetrics
impl Copy for BasicMetrics
Source§impl Debug for BasicMetrics
impl Debug for BasicMetrics
Source§impl Display for BasicMetrics
impl Display for BasicMetrics
Source§impl Serialize for BasicMetrics
impl Serialize for BasicMetrics
Auto Trait Implementations§
impl Freeze for BasicMetrics
impl RefUnwindSafe for BasicMetrics
impl Send for BasicMetrics
impl Sync for BasicMetrics
impl Unpin for BasicMetrics
impl UnsafeUnpin for BasicMetrics
impl UnwindSafe for BasicMetrics
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.