[R] glmnet with binary logistic regression

fongchun fongchunchan at gmail.com
Sat Jul 23 17:43:13 CEST 2011

Hi Patrick, 

Thanks for the reply.  I am referring to using the cv.glmnet() function with
10-fold cross validation and letting glmnet determine the lambda sequence. 
The optimal lambda that it is returning fluctuates between different runs of
cv.glmnet.  Sometimes the model that is return deviates from like including
anywhere from 3-25 predictor variables (I am doing LASSO and I originally
had 235 predictor variables).  I will try the foldid option.  

I was also thinking of a bootstrapping approach where I would actually run
cv.glmnet say 100 times and then take the mean/median lambda across all the
cv.glmnet runs.  This way I generate a confidence interval for my optimal
lambda I woud use in the end.

Another question that I have is I am currently using glmnet to help me fit a
two-class predictor (binary logistic regression).  The cv.glmnet() function
has a type.measure parameter which can be set to auc.  If I am understanding
this correctly, for each lambda it is doing 10 cross-validation and at each
fold it is calculating an AUC.  Therefore, the cross-validation score for
this lambda is the AVERAGE auc across all folds?  Or is it they pool the
predicted response values from each fold and then generate one ROC on all
the predicted values?



View this message in context: http://r.789695.n4.nabble.com/glmnet-with-binary-logistic-regression-tp3688126p3689024.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list