[R] glmnet with binary logistic regression

Patrick Breheny patrick.breheny at uky.edu
Sat Jul 23 12:33:03 CEST 2011


On 07/22/2011 07:51 PM, fongchun wrote:
> I am using the glmnet R package to run LASSO with binary logistic
> regression.
> ...
> What I am finding is that this optimal lambda value fluctuates
> everytime I run glmnet with LASSO.
 > ...
> Does anyone know why there is such a fluctuation  in the
> generation of an optimal lambda?

Cross-validation is a random procedure, and the results will vary every 
time.  This reflects the underlying uncertainty regarding the optimal 
lambda.

Or are you saying that you've used glmnet many times, but this time, the 
fluctuations in lambda are much larger than usual?  If so, and you 
suspect a problem with the way that glmnet is partitioning the data set 
into cross-validation folds, you can specify that with the 'foldid' option.

-- 
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky



More information about the R-help mailing list