Newbie question re MeasureSurvDCalibration.R #442
-
Hi all, I'm a student of statistics and have limited skill with R, so please forgive this ?silly request. What is the syntax for obtaining the D-calibration of a model? I have a large number of synthetic data sets, each divided into one training and one testing subset. (I am not concerned about cross-validation). I want to check the D-calibration of each testing subset. I have written code that gives two versions of the C-index, integrated Brier score, IAE and ISE. But I have not been able to deduce from the mlr-org/mlr3proba page or from the (rather odd-looking) Help pane in RStudio just how to produce the D-calibration. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, here is a minimum working example: library(mlr3proba)
#> Loading required package: mlr3
task = tsk("lung")
learner = lrn("surv.coxph")
part = partition(task)
p = learner$train(task, part$train)$predict(task, part$test)
p$score(msr("surv.dcalib"))
#> surv.dcalib
#> 11.39873 Created on 2025-08-15 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
-
Thank you, I have run that code. A few further questions:
|
Beta Was this translation helpful? Give feedback.
mlr_learners$keys("surv")
. Usingmlr3extralearners
loads a bunch of those.score()
using thedcalib
or other metrics. Learners support also thepredict_newdata()
that can be used on data frames. If you manually do the train and predict steps and you have the survival prediction matrix, you can use .surv_return and then callas_prediction(output-list-from-surv-return)
to make aPredictionSurv
object (see also as_prediction_surv) and there you can use the score with the metric you want (given that it is not a complicated measure, ie doesn't use tra…