Module: Statistical::Distribution

Defined in:
lib/statistical/distribution.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, 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



16
17
18
# File 'lib/statistical/distribution.rb', line 16

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



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

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