pub struct ChiSquared {
pub k: f64,
}Expand description
Chi-squared distribution with k degrees of freedom.
The chi-squared distribution is a special case of the Gamma distribution with shape = k/2 and rate = 1/2.
§Mathematical Definition
- PDF: f(x) = x^(k/2−1) exp(−x/2) / (2^(k/2) Γ(k/2))
- CDF: F(x) = P(k/2, x/2) (regularized lower incomplete gamma)
- Mean: k
- Variance: 2k
§Examples
use u_numflow::distributions::ChiSquared;
let chi2 = ChiSquared::new(3.0).unwrap();
assert!((chi2.mean() - 3.0).abs() < 1e-10);
assert!((chi2.variance() - 6.0).abs() < 1e-10);
assert!((chi2.cdf(0.0)).abs() < 1e-10);§References
Johnson, N. L., Kotz, S., & Balakrishnan, N. (1994). Continuous Univariate Distributions, Vol. 1, Chapter 18.
Fields§
§k: f64Degrees of freedom k > 0.
Implementations§
Source§impl ChiSquared
impl ChiSquared
Trait Implementations§
Source§impl Clone for ChiSquared
impl Clone for ChiSquared
Source§fn clone(&self) -> ChiSquared
fn clone(&self) -> ChiSquared
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for ChiSquared
impl RefUnwindSafe for ChiSquared
impl Send for ChiSquared
impl Sync for ChiSquared
impl Unpin for ChiSquared
impl UnwindSafe for ChiSquared
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