pub struct ChiSquared<N> { /* private fields */ }
Expand description
The chi-squared distribution χ²(k)
, where k
is the degrees of
freedom.
For k > 0
integral, this distribution is the sum of the squares
of k
independent standard normal random variables. For other
k
, this uses the equivalent characterisation
χ²(k) = Gamma(k/2, 2)
.
§Example
use rand_distr::{ChiSquared, Distribution};
let chi = ChiSquared::new(11.0).unwrap();
let v = chi.sample(&mut rand::thread_rng());
println!("{} is from a χ²(11) distribution", v)
Implementations§
Source§impl<N: Float> ChiSquared<N>
impl<N: Float> ChiSquared<N>
Sourcepub fn new(k: N) -> Result<ChiSquared<N>, ChiSquaredError>
pub fn new(k: N) -> Result<ChiSquared<N>, ChiSquaredError>
Create a new chi-squared distribution with degrees-of-freedom
k
.
Trait Implementations§
Source§impl<N: Clone> Clone for ChiSquared<N>
impl<N: Clone> Clone for ChiSquared<N>
Source§fn clone(&self) -> ChiSquared<N>
fn clone(&self) -> ChiSquared<N>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<N: Debug> Debug for ChiSquared<N>
impl<N: Debug> Debug for ChiSquared<N>
Source§impl<N: Float> Distribution<N> for ChiSquared<N>
impl<N: Float> Distribution<N> for ChiSquared<N>
impl<N: Copy> Copy for ChiSquared<N>
Auto Trait Implementations§
impl<N> Freeze for ChiSquared<N>where
N: Freeze,
impl<N> RefUnwindSafe for ChiSquared<N>where
N: RefUnwindSafe,
impl<N> Send for ChiSquared<N>where
N: Send,
impl<N> Sync for ChiSquared<N>where
N: Sync,
impl<N> Unpin for ChiSquared<N>where
N: Unpin,
impl<N> UnwindSafe for ChiSquared<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more