Sha256: b45fbd6b60a435c7b7bea5de2a6588715da404ec06dd86ef8298d74fe4b72720

Contents?: true

Size: 426 Bytes

Versions: 4

Compression:

Stored size: 426 Bytes

Contents

module Distribution
  module Logistic
    module Ruby_
      class << self
        def rng(u,s)
          lambda {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 p_value(pr,u,s )
          u+s*Math.log(pr/(1-pr))
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
distribution-0.7.3 lib/distribution/logistic/ruby.rb
distribution-0.7.2 lib/distribution/logistic/ruby.rb
distribution-0.7.1 lib/distribution/logistic/ruby.rb
distribution-0.7.0 lib/distribution/logistic/ruby.rb