Class: Rust::Models::Regression::LinearRegressionModel

Inherits:
RegressionModel show all
Defined in:
lib/rust/models/regression.rb

Overview

Represents a linear regression model in R.

Instance Attribute Summary

Attributes inherited from RegressionModel

#data, #dependent_variable, #options

Class Method Summary collapse

Methods inherited from RegressionModel

#actuals, #backward_selection, #coefficients, #fitted, #initialize, #load_in_r_as, #method_missing, #model, #mse, #r_2, #r_2_adjusted, #r_hash, #residuals, #significant_variables, #summary, #variables

Methods inherited from RustDatatype

#load_in_r_as, #r_hash, #r_mirror, #r_mirror_to

Constructor Details

This class inherits a constructor from Rust::Models::Regression::RegressionModel

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rust::Models::Regression::RegressionModel

Class Method Details

.can_pull?(type, klass) ⇒ Boolean

Returns:

  • (Boolean)


212
213
214
# File 'lib/rust/models/regression.rb', line 212

def self.can_pull?(type, klass)
    return type == "list" && klass == self.r_model_name
end

.generate(dependent_variable, independent_variables, data, **options) ⇒ Object

Generates a linear regression model, given its dependent_variable and independent_variables and its data. options can be specified and directly passed to the model.



234
235
236
237
238
239
240
241
242
243
# File 'lib/rust/models/regression.rb', line 234

def self.generate(dependent_variable, independent_variables, data, **options)
    RegressionModel.generate(
        LinearRegressionModel,
        self.r_model_name, 
        dependent_variable, 
        independent_variables, 
        data, 
        **options
    )
end

.pull_priorityObject



216
217
218
# File 'lib/rust/models/regression.rb', line 216

def self.pull_priority
    1
end

.pull_variable(variable, type, klass) ⇒ Object



220
221
222
223
224
# File 'lib/rust/models/regression.rb', line 220

def self.pull_variable(variable, type, klass)
    model = Rust::RustDatatype.pull_variable(variable, Rust::List)
    
    return LinearRegressionModel.new(model)
end

.r_model_nameObject



226
227
228
# File 'lib/rust/models/regression.rb', line 226

def self.r_model_name
    "lm"
end