ridge.reg: Ridge regression

View source: R/ridge.reg.R

Ridge regressionR Documentation

Ridge regression

Description

Regularisation via ridge regression is performed.

Usage

ridge.reg(target, dataset, lambda, B = 1, newdata = NULL)

Arguments

target

A numeric vector containing the values of the target variable. If the values are proportions or percentages, i.e. strictly within 0 and 1 they are mapped into R using log( target/(1 - target) ).

dataset

A numeric matrix containing the variables. Rows are samples and columns are features.

lambda

The value of the regularisation parameter λ.

B

Number of bootstraps. If B = 1 no bootstrap is performed and no standard error for the regression coefficients is returned.

newdata

If you have new data and want to predict the value of the target put them here, otherwise, leave it NULL.

Details

There is also the lm.ridge command in MASS library if you are interested in ridge regression.

Value

A list including:

beta

The regression coefficients if no bootstrap is performed. If bootstrap is performed their standard error appears as well.

seb

The standard erorr of the regression coefficients. If bootstrap is performed their bootstrap estimated standard error appears.

est

The fitted values if no new data are available. If you have used new data these will be the predicted target values.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr

References

Hoerl A.E. and R.W. Kennard (1970). Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 12(1): 55-67.

Brown P. J. (1994). Measurement, Regression and Calibration. Oxford Science Publications.

See Also

ridgereg.cv

Examples

#simulate a dataset with continuous data
dataset <- matrix(runif(100 * 30, 1, 100), nrow = 100 ) 
#the target feature is the last column of the dataset as a vector
target <- dataset[, 10]
dataset <- dataset[, -10]
a1 <- ridge.reg(target, dataset, lambda = 0.5, B = 1, newdata = NULL)
a2 <- ridge.reg(target, dataset, lambda = 0.5, B = 100, newdata = NULL) 

MXM documentation built on Aug. 25, 2022, 9:05 a.m.