I am very new to R. I am performing Cox model with LASSO variable selection in one group. I am using the coefficients of the selected variables and apply to another dataset. My goal is to produce and compare predicted probabilities between cases and controls. My codes below are working but I want to make sure what I am getting are correct. It looks like 'predict' function gives xBeta (linear predictor) and not expected survival probability. Can someone let me know if it's possible to produce expected survival probability based on the model estimates? thanks!

cv.fit <- cv.glmnet(x, y, family="cox", standardize=T, alpha=1)

# predicted values for controls (original train model)
pred_controls <- predict(cv.fit, s=cv.fit$lambda.1se, newx=x, type="link")

# predicted values for cases (test model)
pred_cases <- predict(cv.fit, s=cv.fit$lambda.1se, newx=newX, type="link")

If you change type into response, basically it's the exponential of linear predictor, the result is a relative risk of survival outcome.

But because it's relative, if you want to get survival probability, you need a baseline measure, which you can just consider as intercept.

However, the Cox model itself cannot give you the S0, you need another method to estimate the S0, for example, fitting you covariate with beta into a coxph model with initial covariates and then estimate baseline with basehaz. From this post: How to estimate baseline hazard function in Cox Model with R


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.