class Statistics::ChiSquare

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.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Statistics::ContinuousDistribution

sample : Float64 sample

Constructor Detail

def self.new(nu : Float64) #

Create a new Chi square distribution object with nu degrees of freedom

chi = ChiSquare.new 5.0

[View source]

Class Method Detail

def self.pdf(x : Float64, nu : Float64) : Float64 #

Returns the probability of x for a Chi square with nu degrees of freedom

p = ChiSquare.pdf 0.4, 5

[View source]
def self.sample(n : Int, nu : Float64) : Array(Float64) #

Returns n samples from the Chi square with the provided degrees of freedom nu

chi = ChiSquare.sample 10, 5.0

[View source]
def self.sample(nu : Float64) : Float64 #

Returns a sample from the Chi square with the provided degrees of freedom nu

chi = ChiSquare.sample 5.0

[View source]

Instance Method Detail

def sample : Float64 #

Returns a sample from the Chi square

chi = ChiSquare.new 5.0
chi.sample

[View source]