MXM (version 0.9.7)

Ridge regression: 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 $\lambda$.
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.

Value

A list including: A list including:

Details

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

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

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

Run the code above in your browser using DataLab