Struct statrs::distribution::Chi [−][src]
Implements the Chi distribution
Examples
use statrs::distribution::{Chi, Continuous}; use statrs::statistics::Mean; use statrs::prec; let n = Chi::new(2.0).unwrap(); assert!(prec::almost_eq(n.mean(), 1.25331413731550025121, 1e-14)); assert!(prec::almost_eq(n.pdf(1.0), 0.60653065971263342360, 1e-15));
Implementations
impl Chi
[src]
pub fn new(freedom: f64) -> Result<Chi>
[src]
Constructs a new chi distribution
with freedom
degrees of freedom
Errors
Returns an error if freedom
is NaN
or
less than or equal to 0.0
Examples
use statrs::distribution::Chi; let mut result = Chi::new(2.0); assert!(result.is_ok()); result = Chi::new(0.0); assert!(result.is_err());
pub fn freedom(&self) -> f64
[src]
Returns the degrees of freedom of the chi distribution.
Examples
use statrs::distribution::Chi; let n = Chi::new(2.0).unwrap(); assert_eq!(n.freedom(), 2.0);
Trait Implementations
impl CheckedMode<f64> for Chi
[src]
fn checked_mode(&self) -> Result<f64>
[src]
impl Clone for Chi
[src]
impl Continuous<f64, f64> for Chi
[src]
fn pdf(&self, x: f64) -> f64
[src]
Calculates the probability density function for the chi
distribution at x
Formula
(2^(1 - (k / 2)) * x^(k - 1) * e^(-x^2 / 2)) / Γ(k / 2)
where k
is the degrees of freedom and Γ
is the gamma function
fn ln_pdf(&self, x: f64) -> f64
[src]
Calculates the log probability density function for the chi distribution
at x
Formula
ln((2^(1 - (k / 2)) * x^(k - 1) * e^(-x^2 / 2)) / Γ(k / 2))
impl Copy for Chi
[src]
impl Debug for Chi
[src]
impl Distribution<f64> for Chi
[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 Chi
[src]
impl Max<f64> for Chi
[src]
fn max(&self) -> f64
[src]
Returns the maximum value in the domain of the chi distribution representable by a double precision float
Formula
INF
impl Mean<f64> for Chi
[src]
impl Min<f64> for Chi
[src]
fn min(&self) -> f64
[src]
Returns the minimum value in the domain of the chi distribution representable by a double precision float
Formula
0
impl Mode<f64> for Chi
[src]
impl PartialEq<Chi> for Chi
[src]
impl Skewness<f64> for Chi
[src]
impl StructuralPartialEq for Chi
[src]
impl Univariate<f64, f64> for Chi
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the chi
distribution at x
.
Formula
P(k / 2, x^2 / 2)
where k
is the degrees of freedom and P
is
the regularized Gamma function
impl Variance<f64> for Chi
[src]
Auto Trait Implementations
impl RefUnwindSafe for Chi
impl Send for Chi
impl Sync for Chi
impl Unpin for Chi
impl UnwindSafe for Chi
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>,