Enum stats_ci::Confidence

source ·
pub enum Confidence {
    TwoSided(f64),
    UpperOneSided(f64),
    LowerOneSided(f64),
}
Expand description

Confidence level of a confidence interval.

Examples

To create a two-sided confidence interval with 95% confidence:

let confidence = Confidence::new_two_sided(0.95);

To create an upper one-sided confidence interval with 90% confidence:

let confidence = Confidence::new_upper(0.9);

To create a lower one-sided confidence interval with 99% confidence:

let confidence = Confidence::new_lower(0.99);

Variants§

§

TwoSided(f64)

Confidence for a two-sided interval.

§

UpperOneSided(f64)

Confidence for an upper one-sided interval.

§

LowerOneSided(f64)

Confidence for a lower one-sided interval.

Implementations§

source§

impl Confidence

source

pub fn new_two_sided(confidence: f64) -> Self

Create a new two-sided confidence interval with the given confidence level.

Arguments
  • confidence - the confidence level, e.g. 0.95 for 95% confidence
Panics
  • if confidence is not in the range (0, 1)
source

pub fn new_upper(confidence: f64) -> Self

Create a new one-sided upper confidence interval with the given confidence level.

Arguments
  • confidence - the confidence level, e.g. 0.95 for 95% confidence
Panics
  • if confidence is not in the range (0, 1)
source

pub fn new_lower(confidence: f64) -> Self

Create a new one-sided lower confidence interval with the given confidence level.

Arguments
  • confidence - the confidence level, e.g. 0.95 for 95% confidence
Panics
  • if confidence is not in the range (0, 1)
source

pub fn level(&self) -> f64

Return the confidence level of the interval as a number in the range (0, 1).

source

pub fn percent(&self) -> f64

Return the confidence level of the interval as a percentage.

source

pub fn kind(&self) -> &'static str

Return the kind of the confidence interval as a string (in English).

source

pub fn is_two_sided(&self) -> bool

Test if the confidence interval is two-sided.

source

pub fn is_one_sided(&self) -> bool

Test if the confidence interval is one-sided.

source

pub fn is_upper(&self) -> bool

Test if the confidence interval is upper (one-sided).

source

pub fn is_lower(&self) -> bool

Test if the confidence interval is lower (one-sided).

source

pub fn flipped(&self) -> Self

Return the confidence interval with the same confidence level but flipped. For a two-sided interval, this is the same interval. For a one-sided interval, this is the interval with the opposite direction. For example, a lower one-sided interval with confidence 0.95 flipped is an upper one-sided interval with confidence 0.95.

Trait Implementations§

source§

impl Clone for Confidence

source§

fn clone(&self) -> Confidence

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Confidence

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Confidence

source§

fn default() -> Self

Create a new two-sided confidence interval with the default confidence level of 95%.

source§

impl PartialEq<Confidence> for Confidence

source§

fn eq(&self, other: &Confidence) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Confidence> for Confidence

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<f32> for Confidence

§

type Error = CIError

The type returned in the event of a conversion error.
source§

fn try_from(confidence: f32) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<f64> for Confidence

§

type Error = CIError

The type returned in the event of a conversion error.
source§

fn try_from(confidence: f64) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for Confidence

source§

impl StructuralPartialEq for Confidence

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,