vs.glmnet: glmnet variable selection

View source: R/stat.R

vs.glmnetR Documentation

glmnet variable selection

Description

Drop least relevant variables from a glmnet model with optional diagnostics.

Usage

vs.glmnet(formula, data, family, alpha = 1, ...)

Arguments

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., "gaussian", "binomial", or "cox"; see glmnet

alpha

elastic net mixing parameter; default penalty is 1 for lasso, or any value between 0 (ridge penalty) and 1

...

additional arguments passed to cv.glmnet or further to glmnet

See Also

vs.rfsrc

Examples

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')


raredd/rawr documentation built on April 29, 2024, 10:29 a.m.