rgsl/randist/chi_squared.rs
1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5/*!
6The chi-squared distribution arises in statistics. If Y_i are n independent Gaussian random variates with unit variance then the sum-of-squares,
7
8X_i = \sum_i Y_i^2
9
10has a chi-squared distribution with n degrees of freedom.
11!*/
12
13/// This function computes the probability density p(x) at x for a chi-squared distribution with nu degrees of freedom, using the formula given above.
14#[doc(alias = "gsl_ran_chisq_pdf")]
15pub fn chisq_pdf(x: f64, nu: f64) -> f64 {
16 unsafe { sys::gsl_ran_chisq_pdf(x, nu) }
17}
18
19/// This function computes the cumulative distribution functions P(x), Q(x) and their inverses for the chi-squared distribution with nu degrees of freedom.
20#[doc(alias = "gsl_cdf_chisq_P")]
21pub fn chisq_P(x: f64, nu: f64) -> f64 {
22 unsafe { sys::gsl_cdf_chisq_P(x, nu) }
23}
24
25/// This function computes the cumulative distribution functions P(x), Q(x) and their inverses for the chi-squared distribution with nu degrees of freedom.
26#[doc(alias = "gsl_cdf_chisq_Q")]
27pub fn chisq_Q(x: f64, nu: f64) -> f64 {
28 unsafe { sys::gsl_cdf_chisq_Q(x, nu) }
29}
30
31/// This function computes the cumulative distribution functions P(x), Q(x) and their inverses for the chi-squared distribution with nu degrees of freedom.
32#[doc(alias = "gsl_cdf_chisq_Pinv")]
33pub fn chisq_Pinv(P: f64, nu: f64) -> f64 {
34 unsafe { sys::gsl_cdf_chisq_Pinv(P, nu) }
35}
36
37/// This function computes the cumulative distribution functions P(x), Q(x) and their inverses for the chi-squared distribution with nu degrees of freedom.
38#[doc(alias = "gsl_cdf_chisq_Qinv")]
39pub fn chisq_Qinv(Q: f64, nu: f64) -> f64 {
40 unsafe { sys::gsl_cdf_chisq_Qinv(Q, nu) }
41}