l_CV: K-Fold Cross validation for L1/L2 regression

View source: R/models.R

l_CVR Documentation

K-Fold Cross validation for L1/L2 regression

Description

the function realizes K-Fold Cross validation for ridge/Lasso regression to help to choose the lambda that minimise the RSS

Usage

l_CV(data,y,x,lambda,k,mode=2,binary=FALSE,step=1000,bound=0.5,fista=TRUE,tol=10^-7)

Arguments

data

name of the dataset

y

name of the dependent variables

x

name of the independent variable

lambda

a number or a vector of lambda-value to be evaluated in the regression

k

integer, which indicates how many training and test set will be splited from the dataset

mode

1: ridge regression; 2: lasso regression

binary

logical, if TRUE, the dependent variable is binary

step

maximum number of steps

bound

threshold for binary dependent variable

fista

logical, if TRUE, the FISTA algorithm is used

tol

tolerance for convergence, it is 10^-7 by default

Value

the lambda values that minimize the MSE

Examples

l_CV(mtcars,"hp",c("mpg","qsec","disp"),c(0.01,0.1),k=5,mode=2)

ProxReg documentation built on April 3, 2025, 9:21 p.m.