Struct rand_distr::SkewNormal
source · [−]pub struct SkewNormal<F> where
F: Float,
StandardNormal: Distribution<F>, { /* private fields */ }
Expand description
The skew normal distribution SN(location, scale, shape)
.
The skew normal distribution is a generalization of the
Normal
distribution to allow for non-zero skewness.
It has the density function, for scale > 0
,
f(x) = 2 / scale * phi((x - location) / scale) * Phi(alpha * (x - location) / scale)
where phi
and Phi
are the density and distribution of a standard normal variable.
Example
use rand_distr::{SkewNormal, Distribution};
// location 2, scale 3, shape 1
let skew_normal = SkewNormal::new(2.0, 3.0, 1.0).unwrap();
let v = skew_normal.sample(&mut rand::thread_rng());
println!("{} is from a SN(2, 3, 1) distribution", v)
Implementation details
We are using the algorithm from A Method to Simulate the Skew Normal Distribution.
Implementations
Construct, from location, scale and shape.
Parameters:
- location (unrestricted)
- scale (must be finite and larger than zero)
- shape (must be finite)
Trait Implementations
Generate a random value of T
, using rng
as the source of randomness.
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>ⓘ where
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>ⓘ where
R: Rng,
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
Auto Trait Implementations
impl<F> RefUnwindSafe for SkewNormal<F> where
F: RefUnwindSafe,
impl<F> Send for SkewNormal<F> where
F: Send,
impl<F> Sync for SkewNormal<F> where
F: Sync,
impl<F> Unpin for SkewNormal<F> where
F: Unpin,
impl<F> UnwindSafe for SkewNormal<F> where
F: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more