Class: Capricious::Erlang
- Inherits:
-
Object
- Object
- Capricious::Erlang
- Includes:
- PRNG
- Defined in:
- lib/capricious/erlang.rb
Overview
Models the Erlang distribution, parameterized on the lambda value of the underlying exponential distribution and a shape parameter.
Instance Attribute Summary collapse
-
#expected_mean ⇒ Object
readonly
Returns the value of attribute expected_mean.
-
#expected_variance ⇒ Object
readonly
Returns the value of attribute expected_variance.
Instance Method Summary collapse
-
#initialize(l, shape, seed = nil, policy = MWC5, keep_stats = false) ⇒ Erlang
constructor
Initializes a new Erlang distribution.
Methods included from PRNG
included, #next, #prng_initialize, #reset
Constructor Details
#initialize(l, shape, seed = nil, policy = MWC5, keep_stats = false) ⇒ Erlang
Initializes a new Erlang distribution. =l= is the lambda parameter and
shape= is the shape parameter; =seed=, =policy=, and =keep_stats= are
as in =PRNG=.
33 34 35 36 37 38 39 |
# File 'lib/capricious/erlang.rb', line 33 def initialize(l, shape, seed=nil, policy=MWC5, keep_stats=false) @shape = shape @expected_mean = shape / l.to_f @expected_variance = shape / (l * l).to_f @expo = Exponential.new(l, seed, policy, keep_stats) prng_initialize(seed, policy, keep_stats) end |
Instance Attribute Details
#expected_mean ⇒ Object (readonly)
Returns the value of attribute expected_mean.
28 29 30 |
# File 'lib/capricious/erlang.rb', line 28 def expected_mean @expected_mean end |
#expected_variance ⇒ Object (readonly)
Returns the value of attribute expected_variance.
28 29 30 |
# File 'lib/capricious/erlang.rb', line 28 def expected_variance @expected_variance end |