pub struct Estimate<T: PartialOrd + Copy> {
pub point: T,
pub lower: T,
pub upper: T,
}Expand description
A physical measurement: point estimate ± 95 % confidence interval.
Invariant: lower ≤ point ≤ upper
Eq and Hash are intentionally NOT derived for Estimate<f64>.
Floating-point equality is physically meaningless for measurements.
Use Estimate::is_consistent_with for physically meaningful comparison.
Fields§
§point: TBest single-value estimate (e.g. mean or median of samples).
lower: TLower bound of the 95 % confidence interval.
upper: TUpper bound of the 95 % confidence interval.
Implementations§
Source§impl<T: PartialOrd + Copy + Display> Estimate<T>
impl<T: PartialOrd + Copy + Display> Estimate<T>
Sourcepub fn new(point: T, lower: T, upper: T) -> Result<Self, EstimateError>
pub fn new(point: T, lower: T, upper: T) -> Result<Self, EstimateError>
Constructs a new estimate, enforcing lower ≤ point ≤ upper.
§Errors
Returns EstimateError::InvalidBounds if the invariant is violated.
Source§impl Estimate<f64>
impl Estimate<f64>
Sourcepub fn is_consistent_with(&self, other: &Self) -> bool
pub fn is_consistent_with(&self, other: &Self) -> bool
Two estimates are physically consistent if their confidence intervals overlap.
This is the correct notion of “agreement” between two uncertain measurements.
Sourcepub fn relative_uncertainty(&self) -> f64
pub fn relative_uncertainty(&self) -> f64
Relative uncertainty: (upper − lower) / |point|.
Returns f64::INFINITY when |point| is below machine epsilon
(cannot compute a meaningful relative uncertainty for a near-zero quantity).
Sourcepub fn with_extra_uncertainty(&self, factor: f64) -> Self
pub fn with_extra_uncertainty(&self, factor: f64) -> Self
Returns a widened copy with interval expanded by factor (≥ 1.0).
Useful when composing multiple uncertain quantities conservatively.