Struct statrs::distribution::LogNormal [−][src]
Implements the Log-normal distribution
Examples
use statrs::distribution::{LogNormal, Continuous}; use statrs::statistics::Mean; use statrs::prec; let n = LogNormal::new(0.0, 1.0).unwrap(); assert_eq!(n.mean(), (0.5f64).exp()); assert!(prec::almost_eq(n.pdf(1.0), 0.3989422804014326779399, 1e-16));
Implementations
impl LogNormal
[src]
pub fn new(location: f64, scale: f64) -> Result<LogNormal>
[src]
Constructs a new log-normal distribution with a location of location
and a scale of scale
Errors
Returns an error if location
or scale
are NaN
.
Returns an error if scale <= 0.0
Examples
use statrs::distribution::LogNormal; let mut result = LogNormal::new(0.0, 1.0); assert!(result.is_ok()); result = LogNormal::new(0.0, 0.0); assert!(result.is_err());
Trait Implementations
impl Clone for LogNormal
[src]
impl Continuous<f64, f64> for LogNormal
[src]
fn pdf(&self, x: f64) -> f64
[src]
Calculates the probability density function for the log-normal
distribution at x
Formula
(1 / xσ * sqrt(2π)) * e^(-((ln(x) - μ)^2) / 2σ^2)
where μ
is the location and σ
is the scale
fn ln_pdf(&self, x: f64) -> f64
[src]
Calculates the log probability density function for the log-normal
distribution at x
Formula
ln((1 / xσ * sqrt(2π)) * e^(-((ln(x) - μ)^2) / 2σ^2))
where μ
is the location and σ
is the scale
impl Copy for LogNormal
[src]
impl Debug for LogNormal
[src]
impl Distribution<f64> for LogNormal
[src]
fn sample<R: Rng + ?Sized>(&self, r: &mut R) -> f64
[src]
pub fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Entropy<f64> for LogNormal
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the log-normal distribution
Formula
ln(σe^(μ + 1 / 2) * sqrt(2π))
where μ
is the location and σ
is the scale
impl Max<f64> for LogNormal
[src]
fn max(&self) -> f64
[src]
Returns the maximum value in the domain of the log-normal distribution representable by a double precision float
Formula
INF
impl Mean<f64> for LogNormal
[src]
fn mean(&self) -> f64
[src]
Returns the mean of the log-normal distribution
Formula
e^(μ + σ^2 / 2)
where μ
is the location and σ
is the scale
impl Median<f64> for LogNormal
[src]
impl Min<f64> for LogNormal
[src]
fn min(&self) -> f64
[src]
Returns the minimum value in the domain of the log-normal distribution representable by a double precision float
Formula
0
impl Mode<f64> for LogNormal
[src]
fn mode(&self) -> f64
[src]
Returns the mode of the log-normal distribution
Formula
e^(μ - σ^2)
where μ
is the location and σ
is the scale
impl PartialEq<LogNormal> for LogNormal
[src]
impl Skewness<f64> for LogNormal
[src]
fn skewness(&self) -> f64
[src]
Returns the skewness of the log-normal distribution
Formula
(e^(σ^2) + 2) * sqrt(e^(σ^2) - 1)
where μ
is the location and σ
is the scale
impl StructuralPartialEq for LogNormal
[src]
impl Univariate<f64, f64> for LogNormal
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the log-normal
distribution
at x
Formula
(1 / 2) + (1 / 2) * erf((ln(x) - μ) / sqrt(2) * σ)
where μ
is the location, σ
is the scale, and erf
is the
error function
impl Variance<f64> for LogNormal
[src]
fn variance(&self) -> f64
[src]
Returns the variance of the log-normal distribution
Formula
(e^(σ^2) - 1) * e^(2μ + σ^2)
where μ
is the location and σ
is the scale
fn std_dev(&self) -> f64
[src]
Returns the standard deviation of the log-normal distribution
Formula
sqrt((e^(σ^2) - 1) * e^(2μ + σ^2))
where μ
is the location and σ
is the scale
Auto Trait Implementations
impl RefUnwindSafe for LogNormal
impl Send for LogNormal
impl Sync for LogNormal
impl Unpin for LogNormal
impl UnwindSafe for LogNormal
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,