lib/more_math/distributions.rb
# Returns the inverse cumulative probability value of the
# NormalDistribution for the probability +p+.
Returns the inverse cumulative probability value of the
NormalDistribution for the probability +p+.
Returns the inverse cumulative probability value of the NormalDistribution for the probability + p + .
def inverse_probability(p)
      case
      when p <= 0
        -1 / 0.0
      when p >= 1
        1 / 0.0
      when (p - 0.5).abs <= Float::EPSILON
        @mu
      else
        begin
          NewtonBisection.new { |x| probability(x) - p }.solve(nil, 1_000_000)
        rescue
          0 / 0.0
        end
      end
    end
def inverse_probability ( p ) case when p <= 0 - 1 / 0.0 when p >= 1 1 / 0.0 when ( p - 0.5 ) . abs <= Float :: EPSILON @mu else begin NewtonBisection . new { | x | probability ( x ) - p } . solve ( nil , 1_000_000 ) rescue 0 / 0.0 end end end
Returns the inverse cumulative probability value of the
NormalDistribution for the probability +p+.
Returns the inverse cumulative probability value of the NormalDistribution for the probability + p + .
p
<not_specific>