Glmnet

Lasso Regression Example using glmnet package in R

More details please refer to the link below: (https://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html#lin) This post shows how to use glmnet package to fit lasso regression and how to visualize the output. The description of data is shown in here. dt <- readRDS(url("https://s3.amazonaws.com/pbreheny-data-sets/whoari.rds")) attach(dt) fit <- glmnet(X, y) Visualize the coefficients plot(fit) Label the path plot(fit, label = TRUE) The summary table below shows from left to right the number of nonzero coefficients (DF), the percent (of null) deviance explained (%dev) and the value of \(\lambda\) (Lambda).