optim_lamb: optimize a lambda for a ridge regression model by cross...

Description Usage Arguments Value Examples

View source: R/optim_ridge_lambda.R

Description

A function that chooses the best lambda for a ridge regression

Usage

1
optim_lamb(X, y, lambdas, folds)

Arguments

X

The predictors of the ridge regression model

Y

The response variable of the ridge regression model

lambda

possible penalizing coefficients

Value

The optimized lambda

Examples

1
2
3
 X = matrix(c(rep(1, 10), seq(2,20,2)+rnorm(10)), ncol=2)
 y = c(seq(10,100,10)+rnorm(10))
 optim_lamb(X,y, lambdas=c(1,2,3,4,5), 5)

wuyinfeistella/bis557 documentation built on Jan. 1, 2021, 12:52 p.m.