Module: Distribution::Exponential::GSL_

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

Class Method Summary collapse

Class Method Details

.cdf(x, l) ⇒ Object


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

def cdf(x, l)
  return 0 if x < 0
  GSL::Cdf.exponential_P(x, 1 / l.to_f)
end

.pdf(x, l) ⇒ Object


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

def pdf(x, l)
  return 0 if x < 0
  GSL::Ran.exponential_pdf(x, 1 / l.to_f)
end

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


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

def quantile(pr, l)
  GSL::Cdf.exponential_Pinv(pr, 1 / l.to_f)
end