Module: Distribution::Beta::GSL_

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

Class Method Summary collapse

Class Method Details

.cdf(x, a, b) ⇒ Object

Beta cumulative distribution function (cdf).

Returns the integral of Beta distribution with parameters +a+ and +b+ over [0, x]



15
16
17
# File 'lib/distribution/beta/gsl.rb', line 15

def cdf(x, a, b)
  GSL::Cdf.beta_P(x.to_f, a.to_f, b.to_f)
end

.pdf(x, a, b) ⇒ Object

PDF.



6
7
8
# File 'lib/distribution/beta/gsl.rb', line 6

def pdf(x, a, b)
  GSL::Ran.beta_pdf(x.to_f, a.to_f, b.to_f)
end

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

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



21
22
23
# File 'lib/distribution/beta/gsl.rb', line 21

def quantile(pr, a, b)
  GSL::Cdf.beta_Pinv(pr.to_f, a.to_f, b.to_f)
end