class Statistics::Distribution::InverseStandardNormal

Inverse Standard Normal distribution: References: en.wikipedia.org/wiki/Inverse_distribution www.source-code.biz/snippets/vbasic/9.htm

Constants

A1
A2
A3
A4
A5
A6
B1
B2
B3
B4
B5
C1
C2
C3
C4
C5
C6
D1
D2
D3
D4
P_HIGH
P_LOW

Public Instance Methods

cumulative_function(value) click to toggle source
# File lib/statistics/distribution/normal.rb, line 120
def cumulative_function(value)
  return if value < 0.0 || value > 1.0
  return -1.0 * Float::INFINITY if value.zero?
  return Float::INFINITY if value == 1.0

  if value < P_LOW
    q = Math.sqrt((Math.log(value) * -2.0))
    (((((C1 * q + C2) * q + C3) * q + C4) * q + C5) * q + C6) / ((((D1 * q + D2) * q + D3) * q + D4) * q + 1.0)
  elsif value <= P_HIGH
    q = value - 0.5
    r = q ** 2
    (((((A1 * r + A2) * r + A3) * r + A4) * r + A5) * r + A6) * q / (((((B1 * r + B2) * r + B3) * r + B4) * r + B5) * r + 1.0)
  else
    q = Math.sqrt((Math.log(1 - value) * -2.0))
    - (((((C1 * q + C2) * q + C3) * q + C4) * q + C5) * q + C6) / ((((D1 * q + D2) * q + D3) * q + D4) * q + 1)
  end
end
density_function(_) click to toggle source
# File lib/statistics/distribution/normal.rb, line 112
def density_function(_)
  raise NotImplementedError
end
random(elements: 1, seed: Random.new_seed) click to toggle source
# File lib/statistics/distribution/normal.rb, line 116
def random(elements: 1, seed: Random.new_seed)
  raise NotImplementedError
end