linear_regressor {StabilizedRegression} | R Documentation |
R6 Class Representing a Linear Regression
Description
An R6-class for linear regression that is used within the StabilizedRegression framework.
Currently this is the only regression procedure that has been implemented. In order to extend the StabilizedRegression framework to a different regression procedure a custom R6-class with the same structure as this function can be written and used within StabilizedRegression.
Details
Constructer method initializes a linear regression object
specifying on which subset of variables S
to fit the
regression and which type of stability test and prediction score
to compute. The methods fit()
and predict()
can be
applied to the object to fit and predict, respectively.
Public fields
estimator
Numeric vector of regression coefficients.
S
Numeric vector specifying the subset of variables to perform regression on.
scores
Numeric vector of fitted stability and prediction scores.
pars
List specifying the stability test via
test
and prediction score viapred_score
.
Methods
Public methods
Method new()
Create a new linear_regression object.
Usage
linear_regressor$new( S = numeric(), pars = list(test = "mean", pred_score = c("mse", "mse")) )
Arguments
S
Subset of variables.
pars
Parameters.
Returns
A new 'linear_regression' object.
Method fit()
Fit a 'linear_regression' object on data and computes the stability and prediction scores.
Usage
linear_regressor$fit(X, Y, A, extra = NA)
Arguments
X
Predictor matrix.
Y
response vector.
A
environemnt indicator.
extra
not required (placeholder)
Returns
A fitted 'linear_regression' object.
Method predict()
Predict using a fitted 'linear_regression' object.
Usage
linear_regressor$predict(X)
Arguments
X
Predictor matrix on which to predict response.
Returns
Numeric vector of predicted response.
Method clone()
The objects of this class are cloneable with this method.
Usage
linear_regressor$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Niklas Pfister