[R] glmnet with binary logistic regression

mxkuhn mxkuhn at gmail.com
Sun Jul 24 12:13:22 CEST 2011

10 fold cv has high variation compared to other methods. Use repeated cv or the bootstrap instead (both of which can be used with glmnet by way of the train() function on the caret package). 


On Jul 23, 2011, at 11:43 AM, fongchun <fongchunchan at gmail.com> wrote:

> 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?
> Thanks,
> Fong
> --
> 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.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list