Class: Rust::Models::Regression::ModelVariable

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#coefficientObject

Returns the value of attribute coefficient.



382
383
384
# File 'lib/rust/models/regression.rb', line 382

def coefficient
  @coefficient
end

#nameObject

Returns the value of attribute name.



381
382
383
# File 'lib/rust/models/regression.rb', line 381

def name
  @name
end

#pvalueObject

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

Returns:

  • (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)

Returns:

  • (Boolean)


398
399
400
# File 'lib/rust/models/regression.rb', line 398

def significant?(a = 0.05)
    @pvalue <= a
end