elasticnet: Wrapper to use the glmnet package that Elastic Net model can...

Description Usage Arguments Author(s) Examples

View source: R/elasticnet.R

Description

The glmnet package that Elastic Net can use is nice, but you can not use the formula and you need to type it in matrix. So we created an elasticnet package that Elastic Net can use in formula. This is a wrapper for the glmnet package, which requires the glmnet package to work. Also, the elasticnet package can automatically tune the best alpha and lambda.

Usage

1
2
3
elasticnet(formula, data, family = NULL,
offset = NULL, nfolds = 5, lambda = "lambda.1se",
alpha = NULL, alpha_step = 0.05, seed = NULL)

Arguments

formula

an object of class "formula" : a symbolic description of the model to be fitted.

data

an optional data frame containing the variables in the model.

family

Response type. Default is NULL. If NULL, family is automatically selected.

lambda

"lambda.1se" or "lambda.min".

alpha

The elasticnet mixing parameter, 0 or more and 1 or less. alpha=1 is the lasso penalty, and alpha=0 the ridge penalty.

alpha_step

Step in searching for parameter alpha.

seed

Random number generation.

Author(s)

Toshihiro Iguchi

Examples

1
2
3
result <- elasticnet(Sepal.Length ~., iris)
plot(result)
summary(result)

ToshihiroIguchi/elasticnet documentation built on May 20, 2019, 2:20 p.m.