Search code examples
rmeasurepoissonglmnetlasso-regression

Specifying type of measure with lasso regression


I'm trying to do variable selection with glmnet and lasso poisson regression.

It runs if I use:

model.lasso <- glmnet(X,ED.visits, family="poisson", alpha=1, nlambda=1000)

But I've been asked to use "deviance" as a measure. I get an error when I run:

model.lasso <- glmnet(X,ED.visits, type.measure=c("deviance"), family="poisson", alpha=1, nlambda=1000)

type.measure is the right specification according to: the documentation.


Solution

  • The argument: type.measure, is not part of the glmnet function but the cv.glmnet function. You are calling to an argument that is not part of the above described function.