Module: Distribution::ChiSquare::GSL_

Defined in:
lib/distribution/chisquare/gsl.rb

Class Method Summary collapse

Class Method Details

.cdf(x, k) ⇒ Object

Chi-square cumulative distribution function (cdf).

Returns the integral of Chi-squared distribution with k degrees of freedom over [0, x]



18
19
20
# File 'lib/distribution/chisquare/gsl.rb', line 18

def cdf(x, k)
  GSL::Cdf.chisq_P(x.to_f, k.to_i)
end

.pdf(x, k) ⇒ Object



9
10
11
# File 'lib/distribution/chisquare/gsl.rb', line 9

def pdf(x, k)
  GSL::Ran.chisq_pdf(x.to_f, k.to_i)
end

.quantile(pr, k) ⇒ Object Also known as: p_value

Return the P-value of the corresponding integral with k degrees of freedom



24
25
26
# File 'lib/distribution/chisquare/gsl.rb', line 24

def quantile(pr, k)
  GSL::Cdf.chisq_Pinv(pr.to_f, k.to_i)
end

.rng(_k, _seed = nil) ⇒ Object



5
6
7
# File 'lib/distribution/chisquare/gsl.rb', line 5

def rng(_k, _seed = nil)
  nil
end