pub struct ChiSquared<F>{ /* private fields */ }Expand description
The chi-squared distribution χ²(k).
The chi-squared distribution is a continuous probability
distribution with parameter k > 0 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).
§Plot
The plot shows the chi-squared distribution with various degrees of freedom.
§Example
use rand_distr::{ChiSquared, Distribution};
let chi = ChiSquared::new(11.0).unwrap();
let v = chi.sample(&mut rand::rng());
println!("{} is from a χ²(11) distribution", v)Implementations§
Source§impl<F> ChiSquared<F>
impl<F> ChiSquared<F>
Sourcepub fn new(k: F) -> Result<ChiSquared<F>, Error>
pub fn new(k: F) -> Result<ChiSquared<F>, Error>
Create a new chi-squared distribution with degrees-of-freedom
k.
Trait Implementations§
Source§impl<F> Clone for ChiSquared<F>where
F: Clone + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F> Clone for ChiSquared<F>where
F: Clone + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
Source§fn clone(&self) -> ChiSquared<F>
fn clone(&self) -> ChiSquared<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F> Debug for ChiSquared<F>where
F: Debug + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F> Debug for ChiSquared<F>where
F: Debug + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
Source§impl<'de, F> Deserialize<'de> for ChiSquared<F>where
F: Float + Deserialize<'de>,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<'de, F> Deserialize<'de> for ChiSquared<F>where
F: Float + Deserialize<'de>,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChiSquared<F>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChiSquared<F>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<F> Distribution<F> for ChiSquared<F>
impl<F> Distribution<F> for ChiSquared<F>
Source§impl<F> PartialEq for ChiSquared<F>where
F: PartialEq + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F> PartialEq for ChiSquared<F>where
F: PartialEq + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
Source§impl<F> Serialize for ChiSquared<F>where
F: Float + Serialize,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F> Serialize for ChiSquared<F>where
F: Float + Serialize,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<F> Copy for ChiSquared<F>where
F: Copy + Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F> StructuralPartialEq for ChiSquared<F>
Auto Trait Implementations§
impl<F> Freeze for ChiSquared<F>where
F: Freeze,
impl<F> RefUnwindSafe for ChiSquared<F>where
F: RefUnwindSafe,
impl<F> Send for ChiSquared<F>where
F: Send,
impl<F> Sync for ChiSquared<F>where
F: Sync,
impl<F> Unpin for ChiSquared<F>where
F: Unpin,
impl<F> UnwindSafe for ChiSquared<F>where
F: 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