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

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

Overview

Represents a linear regression model in R.

Class Method Summary collapse

Methods inherited from RegressionModel

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

Methods inherited from RustDatatype

#load_in_r_as, pull_priority, #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)


147
148
149
# File 'lib/rust/models/regression.rb', line 147

def self.can_pull?(type, klass)
    return type == "list" && klass == "lm"
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.



161
162
163
164
165
166
167
168
169
170
# File 'lib/rust/models/regression.rb', line 161

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

.pull_variable(variable, type, klass) ⇒ Object



151
152
153
154
155
# File 'lib/rust/models/regression.rb', line 151

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