class Statistics::ChiSquare
- Statistics::ChiSquare
- Statistics::ContinuousDistribution
- Reference
- Object
Overview
The chi-squared distribution arises in statistics. If Y_i are n independent Gaussian random variates with unit variance then the sum-of-squares,
X_i = \sum_i Y_i^2
has a chi-squared distribution with n degrees of freedom.
Defined in:
gsl/base/statistics.crConstructors
-
.new(nu : Float64)
Create a new Chi square distribution object with nu degrees of freedom
Class Method Summary
-
.pdf(x : Float64, nu : Float64) : Float64
Returns the probability of x for a Chi square with nu degrees of freedom
-
.sample(n : Int, nu : Float64) : Array(Float64)
Returns n samples from the Chi square with the provided degrees of freedom nu
-
.sample(nu : Float64) : Float64
Returns a sample from the Chi square with the provided degrees of freedom nu
Instance Method Summary
-
#sample : Float64
Returns a sample from the Chi square
Instance methods inherited from class Statistics::ContinuousDistribution
sample : Float64
sample
Constructor Detail
Create a new Chi square distribution object with nu degrees of freedom
chi = ChiSquare.new 5.0
Class Method Detail
Returns the probability of x for a Chi square with nu degrees of freedom
p = ChiSquare.pdf 0.4, 5
Returns n samples from the Chi square with the provided degrees of freedom nu
chi = ChiSquare.sample 10, 5.0
Returns a sample from the Chi square with the provided degrees of freedom nu
chi = ChiSquare.sample 5.0