| 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
estimatorNumeric vector of regression coefficients.
SNumeric vector specifying the subset of variables to perform regression on.
scoresNumeric vector of fitted stability and prediction scores.
parsList specifying the stability test via
testand 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
SSubset of variables.
parsParameters.
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
XPredictor matrix.
Yresponse vector.
Aenvironemnt indicator.
extranot required (placeholder)
Returns
A fitted 'linear_regression' object.
Method predict()
Predict using a fitted 'linear_regression' object.
Usage
linear_regressor$predict(X)
Arguments
XPredictor 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
deepWhether to make a deep clone.
Author(s)
Niklas Pfister