Module: Statistical::Distribution

Defined in:
lib/statistical/distribution.rb,
lib/statistical/distribution/gumbel.rb,
lib/statistical/distribution/frechet.rb,
lib/statistical/distribution/laplace.rb,
lib/statistical/distribution/uniform.rb,
lib/statistical/distribution/weibull.rb,
lib/statistical/distribution/bernoulli.rb,
lib/statistical/distribution/two_point.rb,
lib/statistical/distribution/exponential.rb,
lib/statistical/distribution/uniform_discrete.rb

Overview

Module to collect all abstractions of distributions

Defined Under Namespace

Classes: Bernoulli, Exponential, Frechet, Gumbel, Laplace, TwoPoint, Uniform, UniformDiscrete, Weibull

Class Method Summary collapse

Class Method Details

.const_missing(cname) ⇒ Object

No need to document this Dynamically add constants when called



20
21
22
# File 'lib/statistical/distribution.rb', line 20

def self.const_missing(cname)
  const_set(cname, make_classmap) if cname == :DISTRIBUTION_TYPES
end

.create(type = :uniform, *args, &block) ⇒ Object

Create a distribution identified by the type hash

Raises:

  • ArgumentError if type was not found



26
27
28
29
# File 'lib/statistical/distribution.rb', line 26

def self.create(type = :uniform, *args, &block)
  raise ArgumentError unless DISTRIBUTION_TYPES.include?(type)
  DISTRIBUTION_TYPES[type].new(*args, &block)
end