cv_lasso {iilasso} | R Documentation |
Fit a model using a design matrix with cross validation
cv_lasso(X, y, nfolds = 10, lambda.min.ratio = 1e-04, nlambda = 100, lambda = NULL, foldid = NULL, unit = "sample", seed, cl, ...)
X |
matrix of explanatory variables |
y |
vector of objective variable |
nfolds |
the number of folds (ignored if foldid is specified) |
lambda.min.ratio |
ratio of max lambda and min lambda (ignored if lambda is specified) |
nlambda |
the number of lambda (ignored if lambda is specified) |
lambda |
lambda sequence |
foldid |
vector indicating id of fold for each sample |
unit |
unit for cross validation error: "sample" (default) or "fold" |
seed |
random seed of cross validation |
cl |
(not yet implemented) |
... |
parameters of lasso function |
lasso model
fit |
lasso model with hole data |
lambda.min |
lambda with minimum cross validation error |
lambda.min.index |
index of lambda.min |
lambda.1se |
largest lambda such that error is within 1 standard error of the minimum |
lambda.1se.index |
index of lambda.1se |
delta |
delta defined above |
foldid |
fold id |
cve |
cross validation error |
cvse |
cross validation standard error |
cvup |
cross validation error + standard error |
cvlo |
cross validation error - standard error |
pe |
prediction error (for family="binomial") |
X <- matrix(c(1,2,3,5,4,7,6,8,9,10), nrow=5, ncol=2) b <- matrix(c(-1,1), nrow=2, ncol=1) e <- matrix(c(0,-0.1,0.1,-0.1,0.1), nrow=5, ncol=1) y <- as.numeric(X %*% b + e) cv_fit <- cv_lasso(X, y, nfolds=5) fit <- cv_fit$fit pr <- predict_lasso(fit, X, cv_fit$lambda.min) plot_cv_lasso(cv_fit)