linear_regressor | R Documentation |
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.
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.
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 via pred_score
.
new()
Create a new linear_regression object.
linear_regressor$new( S = numeric(), pars = list(test = "mean", pred_score = c("mse", "mse")) )
S
Subset of variables.
pars
Parameters.
A new 'linear_regression' object.
fit()
Fit a 'linear_regression' object on data and computes the stability and prediction scores.
linear_regressor$fit(X, Y, A, extra = NA)
X
Predictor matrix.
Y
response vector.
A
environemnt indicator.
extra
not required (placeholder)
A fitted 'linear_regression' object.
predict()
Predict using a fitted 'linear_regression' object.
linear_regressor$predict(X)
X
Predictor matrix on which to predict response.
Numeric vector of predicted response.
clone()
The objects of this class are cloneable with this method.
linear_regressor$clone(deep = FALSE)
deep
Whether to make a deep clone.
Niklas Pfister
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.