vs.glmnet | R Documentation |
Drop least relevant variables from a glmnet
model with optional diagnostics.
vs.glmnet(formula, data, family, alpha = 1, ...)
formula , data |
a formula and data frame containing the response and all potential predictor variables |
family |
a character string or family function for the error
distribution and link, e.g., |
alpha |
elastic net mixing parameter; default penalty is 1 for lasso, or any value between 0 (ridge penalty) and 1 |
... |
additional arguments passed to |
vs.rfsrc
set.seed(1)
vs.glmnet(iris, family = 'gaussian', alpha = 1) ## lasso - default
vs.glmnet(iris, family = 'gaussian', alpha = 0) ## ridge
vs.glmnet(I(Species == 'setosa') ~ ., iris, family = 'binomial')
library('survival')
f <- Surv(time, status == 0) ~ rx + sex + age + obstruct + adhere + nodes
vs.glmnet(f, colon, family = 'cox')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.