Module: Distribution::Logistic::Ruby_

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

Class Method Summary collapse

Class Method Details

.cdf(x, u, s) ⇒ Object



13
14
15
# File 'lib/distribution/logistic/ruby.rb', line 13

def cdf(x, u, s)
  1 / (1 + Math.exp(-(x - u) / s))
end

.pdf(x, u, s) ⇒ Object



9
10
11
# File 'lib/distribution/logistic/ruby.rb', line 9

def pdf(x, u, s)
  (Math.exp(-(x - u) / s)) / (s * (1 + Math.exp(-(x - u) / s)**2))
end

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



17
18
19
# File 'lib/distribution/logistic/ruby.rb', line 17

def quantile(pr, u, s)
  u + s * Math.log(pr / (1 - pr))
end

.rng(u, s) ⇒ Object



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

def rng(u, s)
  -> { p_value(rand, u, s) }
end