Sha256: 0a20dd4939a80505c2101236601ec7c57075c0259c044b421579445d62633e2c

Contents?: true

Size: 414 Bytes

Versions: 4

Compression:

Stored size: 414 Bytes

Contents

module Distribution
  module LogNormal
    module Ruby_
      class << self
        
        def pdf(x,u,s)
          raise "x should be > 0 " if x < 0
          (1.0/(x*s*Math.sqrt(2*Math::PI)))*Math.exp(-((Math.log(x)-u)**2 / (2*s**2)))
        end

        #def p_value(pr,u,s)
        #end

        def cdf(x,u,s)
          Distribution::Normal.cdf((Math.log(x)-u) / s)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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