Module: Distribution::Normal::Java_

Defined in:
lib/distribution/normal/java.rb

Overview

TODO

Class Method Summary collapse

Class Method Details

.cdf(x) ⇒ Object

== Return the cumulative density function at x


22
23
24
25
# File 'lib/distribution/normal/java.rb', line 22

def cdf(x)
  dist = NormalDistributionImpl.new
  dist.cumulativeProbability(x)
end

.pdf(x) ⇒ Object

== Return the probability density function at x


15
16
17
18
# File 'lib/distribution/normal/java.rb', line 15

def pdf(x)
  dist = NormalDistributionImpl.new
  dist.density(x)
end

.quantile(qn) ⇒ Object Also known as: p_value

== Get the inverse cumulative density function (p-value) for qn


29
30
31
32
# File 'lib/distribution/normal/java.rb', line 29

def quantile(qn)
  dist = NormalDistributionImpl.new
  dist.inverseCumulativeProbability(qn)
end

.rng(mean = 0, sigma = 1, _seed = nil) ⇒ Object

== Generate random variables from the provided distribution


8
9
10
11
# File 'lib/distribution/normal/java.rb', line 8

def rng(mean = 0, sigma = 1, _seed = nil)
  dist = NormalDistributionImpl.new(mean, sigma)
  -> { dist.sample }
end