Class: Correlation
- Inherits:
-
Object
- Object
- Correlation
- Defined in:
- lib/correlation_x_y.rb
Overview
class
Instance Attribute Summary collapse
-
#coefficient ⇒ Object
Returns the value of attribute coefficient.
-
#equation ⇒ Object
Returns the value of attribute equation.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#serie_a ⇒ Object
Returns the value of attribute serie_a.
-
#serie_b ⇒ Object
Returns the value of attribute serie_b.
Instance Method Summary collapse
- #dependance ⇒ Object
-
#initialize(serie_a, serie_b) ⇒ Correlation
constructor
A new instance of Correlation.
Constructor Details
#initialize(serie_a, serie_b) ⇒ Correlation
Returns a new instance of Correlation.
11 12 13 14 15 16 17 |
# File 'lib/correlation_x_y.rb', line 11 def initialize(serie_a, serie_b) @serie_a = Serie.new(serie_a) @serie_b = Serie.new(serie_b) @parameters = Parameters.new(Serie.new(serie_a), Serie.new(serie_b)) if Check.series_sizes_valid?(serie_a, serie_b) @dependance = dependance @equation = Equation.new(Parameters.new(@serie_a, @serie_b)) if @dependance == 'true' end |
Instance Attribute Details
#coefficient ⇒ Object
Returns the value of attribute coefficient.
9 10 11 |
# File 'lib/correlation_x_y.rb', line 9 def coefficient @coefficient end |
#equation ⇒ Object
Returns the value of attribute equation.
9 10 11 |
# File 'lib/correlation_x_y.rb', line 9 def equation @equation end |
#parameters ⇒ Object
Returns the value of attribute parameters.
9 10 11 |
# File 'lib/correlation_x_y.rb', line 9 def parameters @parameters end |
#serie_a ⇒ Object
Returns the value of attribute serie_a.
9 10 11 |
# File 'lib/correlation_x_y.rb', line 9 def serie_a @serie_a end |
#serie_b ⇒ Object
Returns the value of attribute serie_b.
9 10 11 |
# File 'lib/correlation_x_y.rb', line 9 def serie_b @serie_b end |
Instance Method Details
#dependance ⇒ Object
19 20 21 |
# File 'lib/correlation_x_y.rb', line 19 def dependance (-0.8..0.8).include?(@parameters.coefficient) ? 'false' : 'true' end |