# On glmnet lasso cox model, when to use "deviance and when to use "c"?

I am trying to use glmnet lasso cox model to select the best variables for the model using coxph, like described here https://r.789695.n4.nabble.com/estimating-survival-times-with-glmnet-and-coxph-td4614225.html

My plan is to use cv.glmnet() instead of separating the data manually, get the optimum lamdba, plug back either lambda.1se or lambda.min, whatever I feel correct graphically.

I run it once with type.measure = "c", but the plot of lambda here fluctuates alot and the lamdba.1e and lamdba.min are very different.

cvfit <- cv.glmnet(x, y , family = "cox" , alpha = 1, type.measure ="C")
plot(cvfit)
cvfit$lambda.1se cvfit$lambda.min

> [1] 0.05046017
> [1] 0.002821133


Also tried "deviance", but I cannot really find any reference to interpret this plot. But the lambda.1se and lamdba.min is the same (yet very different from the "c" measure!)

cvfit <- cv.glmnet(x, y , family = "cox" , alpha = 1, type.measure ="deviance")
plot(cvfit)
cvfit$lambda.1se cvfit$lambda.min

> [1] 0.06077946
> [1] 0.05046017


So, what does that tells me?

I saw some analysis runs multiple cv to get optimal lambda, but I am not sure how this is working.

My plan after I settle the optimum lambda is to rerun a model this and follow the code in the reference to get HR 1

fit <- glmnet(x, y , family = "cox" , alpha = 1,lambda =  cvfit\$lambda.1se)


So, tell me if you have any concerns on my analysis

Thank you

Deviance, based on the log partial likelihood for a Cox model, is the best choice. Harrell finds the C-index to be useful for describing a single model but not very sensitive for distinguishing among models. Your data illustrate this: the C-index values bounce around a lot over a fairly narrow range, with high standard errors, as you change the penalty factor. The deviance is much better behaved.

With your data, the outlier in terms of lambda values is the lambda.min for the C-index plot; that would give you a model maintaining ~80 predictors out of your 146 total. (The vertical dotted lines on the plots show the values for lambda.min and lambda.1se along the lower horizontal axis, with the corresponding number of maintained predictors shown along the top horizontal axis.) You might expect to find about 1 predictor maintained at lambda.min per 10 to 20 events, so unless you have on the order of 1000 events in your data set that outlier in terms of lambda values should already be raising some questions.

The C-index value for that outlier lambda value is very close to the C-index of a model with ~7 predictors. If you had done repeated cross-validation with different random seeds and combined results, I suspect that you would have ended up with that scale of a model instead of one with ~80 predictors. The optimum lambda.min from your deviance plot provides a model with ~6 predictors. So those are pretty close.

The lambda.1se value for the deviance criterion might seem to be close to that for the lambda.min, but according to your lower plot it would provide a model maintaining only ~1 predictor. There isn't much reason to use lambda.1se in a study like yours; it was developed as a way to get highly parsimonious models in a situation with many more predictors than cases. See this page for a bit more on that.