There have been similar questions regarding interpretation of glmnet results. However this is more specific to the cox part of the package.

I am trying to create a prognostic score for cancer patients using the cox model in the glmnet R package.

After running the cv.glmnet function I get a series of coefficients. This is where I'm stuck.

How do I translate this to the traditional hazard ratios, confidence intervals and pvals table? Does the package simply help select the variables - of which then I then rerun in a normal full cox regression model?


The coefficients that you get from cv.glmnet are the coefficients that remain after application of the lasso penalty (lasso is the default; other options in glmnet are Ridge regression and elasticnet regression). The magnitude of the penalty is set by the parameter lambda. The optimal value of lambda is determined based on n-fold cross validation. The latter means that retention (or not) of predictors in the penalized model is guided by cross-validated predictive accuracy (e.g., prediction error, area under the ROC curve). This is the reason that no p-values are provided by glmnet. In fact, there is no guarantee that selected predictors in cv.glmnet are significantly associated (in a traditional sense) with the outcome.

Although it is possible to calculate them, glmnet also does not provide standard errors that would be needed for the calculation of 95% confidence intervals. The reason for this is that estimates from penalized regression are biased and accompanying SE's not very meaningful as it is not clear to what extent they reflect bias or variance in the estimates.

The provided coefficients are betas and correspond to log hazard ratios (HR). To obtain the HR, you can take the exponent of the coefficients.

Indeed, the analyses carried out using cv.glmnet can be seen as a tool to select potentially important predictors, which can be used in subsequent analyses.

  • 1
    $\begingroup$ Welcome to Cross Validated. Very clear answer, just one point that deserves a bit of comment. LASSO can help select potentially important predictors for future study, as you note. If, however, you simply plug those selected predictors into a "normal full cox regression model" as proposed by the OP, then the p-values would not be correct, as the analysis would not take into account the prior use of the data to select the predictors. $\endgroup$ – EdM Feb 27 at 15:31
  • $\begingroup$ Thank you both for your answers. I went back to have a read of Harrell's RMS book and also regression methods in biostatistics. From what I gather, these regularisation methods causes shrinkage of the coefficients of the variables. If we utilised an alternate model, you would then restart with the same variables but without those changes; thus missing the point of regularisation in the first place. I went back to the literature as well. It seems in the medical literature, almost no one has used elastic net as a variable selector for cox regression. $\endgroup$ – Prognosticator Mar 9 at 10:38
  • $\begingroup$ If I am looking to build a predictive model for 3000 patients with 20 variables, is elastic net even a good choice? My main rationale originally was to use it to deal with collinearity. My main concerns with elastic net are both the apparent difficulty in finding examples within the literature for building prognostic models and also as you pointed out the difficulty in providing pvalue and confidence intervals. Is expert curation of variables based on literature and then putting them into a full model justifiable? $\endgroup$ – Prognosticator Mar 9 at 10:41
  • $\begingroup$ Sorry for the questions. I have read through large portions of Harrell's RMS but my lack of statistical background and finding appropriate examples in the literature have made it difficult to progress on this project. $\endgroup$ – Prognosticator Mar 9 at 10:42
  • $\begingroup$ You can use elasticnet to estimate a fully usable prediction model: you can use the coefficients of the optimized model to estimate the predicted hazard (using the 'predict.glmnet()' command) for each individual as you would with any regression model. Plugging the selected variables into a 'new' multivariate Cox model to obtain a more familiar looking regression mode is not recommended. Indeed regularization is still not commonly used in the medical literature, but I would still recommend its use given the fact that it is much more suitable for prediction than regression backward elimination. $\endgroup$ – Klaas W Mar 12 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.