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
>  0.05046017 >  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
>  0.06077946 >  0.05046017
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