[−][src]Struct statrs::distribution::Normal
Implements the Normal distribution
Examples
use statrs::distribution::{Normal, Continuous}; use statrs::statistics::Mean; let n = Normal::new(0.0, 1.0).unwrap(); assert_eq!(n.mean(), 0.0); assert_eq!(n.pdf(1.0), 0.2419707245191433497978);
Implementations
impl Normal
[src]
pub fn new(mean: f64, std_dev: f64) -> Result<Normal>
[src]
Constructs a new normal distribution with a mean of mean
and a standard deviation of std_dev
Errors
Returns an error if mean
or std_dev
are NaN
or if
std_dev <= 0.0
Examples
use statrs::distribution::Normal; let mut result = Normal::new(0.0, 1.0); assert!(result.is_ok()); result = Normal::new(0.0, 0.0); assert!(result.is_err());
Trait Implementations
impl CheckedInverseCDF<f64> for Normal
[src]
fn checked_inverse_cdf(&self, x: f64) -> Result<f64>
[src]
impl Clone for Normal
[src]
impl Continuous<f64, f64> for Normal
[src]
fn pdf(&self, x: f64) -> f64
[src]
Calculates the probability density function for the normal distribution
at x
Formula
(1 / sqrt(2σ^2 * π)) * e^(-(x - μ)^2 / 2σ^2)
where μ
is the mean and σ
is the standard deviation
fn ln_pdf(&self, x: f64) -> f64
[src]
Calculates the log probability density function for the normal
distribution
at x
Formula
ln((1 / sqrt(2σ^2 * π)) * e^(-(x - μ)^2 / 2σ^2))
where μ
is the mean and σ
is the standard deviation
impl Copy for Normal
[src]
impl Debug for Normal
[src]
impl Distribution<f64> for Normal
[src]
fn sample<R: Rng + ?Sized>(&self, r: &mut R) -> f64
[src]
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Entropy<f64> for Normal
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the normal distribution
Formula
(1 / 2) * ln(2σ^2 * π * e)
where σ
is the standard deviation
impl InverseCDF<f64> for Normal
[src]
fn inverse_cdf(&self, x: f64) -> f64
[src]
impl Max<f64> for Normal
[src]
fn max(&self) -> f64
[src]
Returns the maximum value in the domain of the normal distribution representable by a double precision float
Formula
INF
impl Mean<f64> for Normal
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the normal distribution
Remarks
This is the same mean used to construct the distribution
impl Median<f64> for Normal
[src]
fn median(&self) -> f64
[src]
Returns the median of the normal distribution
Formula
μ
where μ
is the mean
impl Min<f64> for Normal
[src]
fn min(&self) -> f64
[src]
Returns the minimum value in the domain of the normal distribution representable by a double precision float
Formula
-INF
impl Mode<f64> for Normal
[src]
fn mode(&self) -> f64
[src]
Returns the mode of the normal distribution
Formula
μ
where μ
is the mean
impl PartialEq<Normal> for Normal
[src]
impl Skewness<f64> for Normal
[src]
impl StructuralPartialEq for Normal
[src]
impl Univariate<f64, f64> for Normal
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the
normal distribution at x
Formula
(1 / 2) * (1 + erf((x - μ) / (σ * sqrt(2))))
where μ
is the mean, σ
is the standard deviation, and
erf
is the error function
impl Variance<f64> for Normal
[src]
fn variance(&self) -> f64
[src]
Returns the variance of the normal distribution
Formula
σ^2
where σ
is the standard deviation
fn std_dev(&self) -> f64
[src]
Returns the standard deviation of the normal distribution
Remarks
This is the same standard deviation used to construct the distribution
Auto Trait Implementations
impl RefUnwindSafe for Normal
impl Send for Normal
impl Sync for Normal
impl Unpin for Normal
impl UnwindSafe for Normal
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> Scalar for T where
T: PartialEq<T> + Copy + Any + Debug,
[src]
T: PartialEq<T> + Copy + Any + Debug,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,