Class: Rust::Models::Regression::ModelVariable
- Defined in:
- lib/rust/models/regression.rb
Overview
Slim representation for a variable in a model, with just the variable name, its coefficient and its p-value.
Instance Attribute Summary collapse
-
#coefficient ⇒ Object
Returns the value of attribute coefficient.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pvalue ⇒ Object
Returns the value of attribute pvalue.
Instance Method Summary collapse
-
#initialize(name, coefficient, pvalue) ⇒ ModelVariable
constructor
A new instance of ModelVariable.
- #intercept? ⇒ Boolean
-
#significant?(a = 0.05) ⇒ Boolean
Checks whether the variable is significant w.r.t.
Constructor Details
#initialize(name, coefficient, pvalue) ⇒ ModelVariable
Returns a new instance of ModelVariable.
324 325 326 327 328 |
# File 'lib/rust/models/regression.rb', line 324 def initialize(name, coefficient, pvalue) @name = name @coefficient = coefficient @pvalue = pvalue end |
Instance Attribute Details
#coefficient ⇒ Object
Returns the value of attribute coefficient.
321 322 323 |
# File 'lib/rust/models/regression.rb', line 321 def coefficient @coefficient end |
#name ⇒ Object
Returns the value of attribute name.
320 321 322 |
# File 'lib/rust/models/regression.rb', line 320 def name @name end |
#pvalue ⇒ Object
Returns the value of attribute pvalue.
322 323 324 |
# File 'lib/rust/models/regression.rb', line 322 def pvalue @pvalue end |
Instance Method Details
#intercept? ⇒ Boolean
330 331 332 |
# File 'lib/rust/models/regression.rb', line 330 def intercept? @name == "(Intercept)" end |
#significant?(a = 0.05) ⇒ Boolean
Checks whether the variable is significant w.r.t. a given a (0.05 by default)
337 338 339 |
# File 'lib/rust/models/regression.rb', line 337 def significant?(a = 0.05) @pvalue <= a end |