Module: Distribution::LogNormal::Ruby_

Defined in:
lib/distribution/lognormal/ruby.rb

Class Method Summary collapse

Class Method Details

.cdf(x, u, s) ⇒ Object


10
11
12
# File 'lib/distribution/lognormal/ruby.rb', line 10

def cdf(x, u, s)
  Distribution::Normal.cdf((Math.log(x) - u) / s)
end

.pdf(x, u, s) ⇒ Object


5
6
7
8
# File 'lib/distribution/lognormal/ruby.rb', line 5

def pdf(x, u, s)
  fail 'x should be > 0 ' if x < 0
  (1.0 / (x * s * Math.sqrt(2 * Math::PI))) * Math.exp(-((Math.log(x) - u)**2 / (2 * s**2)))
end