Class: Reputation::Functions::GeneralisedLogisticCurve
- Inherits:
-
Object
- Object
- Reputation::Functions::GeneralisedLogisticCurve
- Includes:
- Mixin
- Defined in:
- lib/reputation/functions/generalised_logistic_curve.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#k ⇒ Object
Returns the value of attribute k.
-
#m ⇒ Object
Returns the value of attribute m.
-
#q ⇒ Object
Returns the value of attribute q.
-
#v ⇒ Object
Returns the value of attribute v.
Instance Method Summary collapse
- #f(t) ⇒ Object
-
#initialize(args = {}) ⇒ GeneralisedLogisticCurve
constructor
A new instance of GeneralisedLogisticCurve.
Methods included from Mixin
#google_chart, #google_chart_url
Constructor Details
#initialize(args = {}) ⇒ GeneralisedLogisticCurve
Returns a new instance of GeneralisedLogisticCurve.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 9 def initialize(args = {}) constants = { :a => -1, # lower asymptote :k => 1, # upper asymptote :b => 10, # growth rate :v => 0.5, # affects near which asymptote maximum growth occurs :q => 0.5, # depends on the value Y(0) :m => 0, # the time of maximum growth if Q=v }.merge( args ) @a = constants[:a] @k = constants[:k] @b = constants[:b] @v = constants[:v] @q = constants[:q] @m = constants[:m] end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
7 8 9 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 7 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
7 8 9 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 7 def b @b end |
#k ⇒ Object
Returns the value of attribute k.
7 8 9 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 7 def k @k end |
#m ⇒ Object
Returns the value of attribute m.
7 8 9 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 7 def m @m end |
#q ⇒ Object
Returns the value of attribute q.
7 8 9 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 7 def q @q end |
#v ⇒ Object
Returns the value of attribute v.
7 8 9 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 7 def v @v end |
Instance Method Details
#f(t) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/reputation/functions/generalised_logistic_curve.rb', line 26 def f(t) limit( a.to_f + ( (k.to_f - a.to_f) / (1 + q.to_f * Math.exp(-1 * b.to_f*(t.to_f-m.to_f)) )**(1.to_f/v.to_f) ) ) end |