DCA and ROC curves for multivariable analysis #10
-
|
Hi all I'm new to R (and specially with %>%). I wonder whether someone could point me in the right direction? I'm interested in creating a 10-fold cross validation set for dca and also roc analysis for 3 or 4 models. The code below which is provided in the tutorial looks at one logistic regression model, I wonder how I could incorporate more than 1 model (and also ROC curves)? create a 10-fold cross validation setrsample::vfold_cv(df_cancer_dx, v = 10, repeats = 25) %>% for each cut of the data, build logistic regression on the 90% (analysis set),and perform DCA on the 10% (assessment set)rowwise() %>% pool results from the 10-fold cross validationpull(dca_assessment) %>% plot cross validated net benefit valuesggplot(aes(x = threshold, y = net_benefit, color = label)) + Many thanks in advance!! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
Hi Miguel, After discussing with Dr. Vickers, it seems the cross validation from the tutorial is not ideal. It recalculates the net benefit for each cross validation assessment set and then takes the average for each patient from all sets at the end. Instead, we want to perform the cross validation, concatenate all of the resulting predictions, and generate mean predictions for each row. After doing so, only then should we generate metrics such as net benefit scores and ROC/AUC values. Thank you for asking this question! I will update the tutorial accordingly. I have written such code below to iterate over 3 different models, and to generate both DCA and ROC curves. If you are confused about the R dplyr 'pipe' (%>%), I would highly advise you to thoroughly read dplyr pipe documentation online or watch explanatory YouTube videos, as the dplyr pipe is a fundamental aspect of R programming. R Code: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks so much Shaun. I suppose I can then plot ROC curves easily with the values of cv_pred_1, cv_pred_2 etc. |
Beta Was this translation helpful? Give feedback.


Hi Miguel,
After discussing with Dr. Vickers, it seems the cross validation from the tutorial is not ideal. It recalculates the net benefit for each cross validation assessment set and then takes the average for each patient from all sets at the end. Instead, we want to perform the cross validation, concatenate all of the resulting predictions, and generate mean predictions for each row. After doing so, only then should we generate metrics such as net benefit scores and ROC/AUC values. Thank you for asking this question! I will update the tutorial accordingly.
I have written such code below to iterate over 3 different models, and to generate both DCA and ROC curves. If you are confused ab…