R/train_lasso.R

train_lasso <-
function(X,y,pars = list())
{
    cvres <- cv.glmnet(X,y)
    mod <- glmnet(X,y,lambda = cvres$lambda.1se)
    result <- list()
    result$Yfit <- predict(mod,X)
    result$residuals <- y - result$Yfit
    result$model <- mod
    return(result)
}

Try the CAM package in your browser

Any scripts or data that you put into this service are public.

CAM documentation built on May 2, 2019, 8:24 a.m.