if (FALSE) {
# Formula interface
model1 <- ridge.regression(mpg ~ wt + hp + disp, data = mtcars)
# Matrix interface
X <- as.matrix(mtcars[, c("wt", "hp", "disp")])
y <- mtcars$mpg
model2 <- ridge.regression(x = X, y = y)
# Custom lambda range and folds
model3 <- ridge.regression(mpg ~ .,
data = mtcars,
lambda.range = c(0.1, 10), folds = 10
)
}
Run the code above in your browser using DataLab