1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
module Distribution
module Normal
# TODO
module Java_
class << self
#==
# Generate random variables from the provided distribution
def rng(mean=0,sigma=1,seed=nil)
dist = NormalDistributionImpl.new(mean, sigma)
lambda { dist.sample }
end
#==
# Get the inverse cumulative density function (p-value) for qn
def p_value(qn)
dist = NormalDistributionImpl.new
dist.inverseCumulativeProbability(qn)
end
#==
# Return the cumulative density function at x
def cdf(x)
dist = NormalDistributionImpl.new
dist.cumulativeProbability(x)
end
#==
# Return the probability density function at x
def pdf(x)
dist = NormalDistributionImpl.new
dist.density(x)
end
end
end
end
end
|