Sha256: 8d95d12410be49c132f404fb83e2fda1bc80055a22e37c7860a5fedd28201d22

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

module Distribution
  module Logistic
    module Ruby_
      class << self
        def rng(u, s)
          -> { p_value(rand, u, s) }
        end

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

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

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

        alias_method :p_value, :quantile
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
distribution-0.8.0 lib/distribution/logistic/ruby.rb