powered by
the function realizes K-Fold Cross validation for ridge/Lasso regression to help to choose the lambda that minimise the RSS
l_CV(data,y,x,lambda,k,mode=2,binary=FALSE,step=1000,bound=0.5,fista=TRUE,tol=10^-7)
the lambda values that minimize the MSE
name of the dataset
name of the dependent variables
name of the independent variable
a number or a vector of lambda-value to be evaluated in the regression
integer, which indicates how many training and test set will be splited from the dataset
1: ridge regression; 2: lasso regression
logical, if TRUE, the dependent variable is binary
maximum number of steps
threshold for binary dependent variable
logical, if TRUE, the FISTA algorithm is used
tolerance for convergence, it is 10^-7 by default
l_CV(mtcars,"hp",c("mpg","qsec","disp"),c(0.01,0.1),k=5,mode=2)
Run the code above in your browser using DataLab