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.
385 386 387 388 389 |
# File 'lib/rust/models/regression.rb', line 385 def initialize(name, coefficient, pvalue) @name = name @coefficient = coefficient @pvalue = pvalue end |
Instance Attribute Details
#coefficient ⇒ Object
Returns the value of attribute coefficient.
382 383 384 |
# File 'lib/rust/models/regression.rb', line 382 def coefficient @coefficient end |
#name ⇒ Object
Returns the value of attribute name.
381 382 383 |
# File 'lib/rust/models/regression.rb', line 381 def name @name end |
#pvalue ⇒ Object
Returns the value of attribute pvalue.
383 384 385 |
# File 'lib/rust/models/regression.rb', line 383 def pvalue @pvalue end |
Instance Method Details
#intercept? ⇒ Boolean
391 392 393 |
# File 'lib/rust/models/regression.rb', line 391 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)
398 399 400 |
# File 'lib/rust/models/regression.rb', line 398 def significant?(a = 0.05) @pvalue <= a end |