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.



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

#coefficientObject

Returns the value of attribute coefficient.



321
322
323
# File 'lib/rust/models/regression.rb', line 321

def coefficient
  @coefficient
end

#nameObject

Returns the value of attribute name.



320
321
322
# File 'lib/rust/models/regression.rb', line 320

def name
  @name
end

#pvalueObject

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

Returns:

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

Returns:

  • (Boolean)


337
338
339
# File 'lib/rust/models/regression.rb', line 337

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