pbreheny / grpreg

Regularization paths for regression models with grouped covariates
http://pbreheny.github.io/grpreg/
34 stars 14 forks source link

standard error in cv.grpsurv #20

Closed SoufianeAjana closed 6 years ago

SoufianeAjana commented 6 years ago

Hi, thank you for this very useful package! I am working with cv.grpsurv, I would like to use the 1 standard error rule to perform variable selection. However, unlike cv.grpreg, cv.grpsurv returns only the mean cross validation error (cve) for each lambda without the estimated standard error associated with each value of cve. Is it possible to return this extra vector as an output value in cv.grpsurv? Thanks :)

pbreheny commented 6 years ago

Seems like you figured this out on your own, but just in case anyone else comes across this thread, the standard errors are returned as cvfit$cvse. To use the 1 standard error rule:

library(grpreg)
data(Birthwt)
cvfit <- cv.grpreg(Birthwt$X, Birthwt$bwt, Birthwt$group)
ub <- cvfit$cve[cvfit$min] + cvfit$cvse[cvfit$min]  # Upper bound implied by 1 SE rule
max(cvfit$lambda[cvfit$cve < ub])                   # Largest lambda within that bound
# [1] 0.06761796
SoufianeAjana commented 6 years ago

Thanks for this piece of code and the package updates! It works very well :)

Le jeu. 4 oct. 2018 à 22:19, Patrick Breheny notifications@github.com a écrit :

Seems like you figured this out on your own, but just in case anyone else comes across this thread, the standard errors are returned as cvfit$cvse. To use the 1 standard error rule:

library(grpreg) data(Birthwt)cvfit <- cv.grpreg(Birthwt$X, Birthwt$bwt, Birthwt$group)ub <- cvfit$cve[cvfit$min] + cvfit$cvse[cvfit$min] # Upper bound implied by 1 SE rule max(cvfit$lambda[cvfit$cve < ub]) # Largest lambda within that bound# [1] 0.06761796

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/pbreheny/grpreg/issues/20#issuecomment-427155576, or mute the thread https://github.com/notifications/unsubscribe-auth/AcQU0y7uSiyajwP1FtUfc6tqUfN8OzUeks5uhm1vgaJpZM4XIh3c .