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]



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

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

.p_value(pr, a, b) ⇒ Object

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



10
11
12
# File 'lib/distribution/beta/gsl.rb', line 10

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

.pdf(x, a, b) ⇒ Object



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

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