Class: Philiprehberger::MathKit::Regression::Result
- Inherits:
-
Struct
- Object
- Struct
- Philiprehberger::MathKit::Regression::Result
- Defined in:
- lib/philiprehberger/math_kit/regression.rb
Overview
Result of a linear regression
Instance Attribute Summary collapse
-
#intercept ⇒ Object
Returns the value of attribute intercept.
-
#r_squared ⇒ Object
Returns the value of attribute r_squared.
-
#slope ⇒ Object
Returns the value of attribute slope.
Instance Method Summary collapse
-
#predict(x) ⇒ Float
Predict the y value for a given x.
Instance Attribute Details
#intercept ⇒ Object
Returns the value of attribute intercept
8 9 10 |
# File 'lib/philiprehberger/math_kit/regression.rb', line 8 def intercept @intercept end |
#r_squared ⇒ Object
Returns the value of attribute r_squared
8 9 10 |
# File 'lib/philiprehberger/math_kit/regression.rb', line 8 def r_squared @r_squared end |
#slope ⇒ Object
Returns the value of attribute slope
8 9 10 |
# File 'lib/philiprehberger/math_kit/regression.rb', line 8 def slope @slope end |
Instance Method Details
#predict(x) ⇒ Float
Predict the y value for a given x
13 14 15 |
# File 'lib/philiprehberger/math_kit/regression.rb', line 13 def predict(x) intercept + (slope * x) end |