
An R6 class to assess a model with scalar metrics
AssScalar.RdAssess how well a model can predict time to event less than a certain threshold with a scalar metric.
Public fields
metricsAssess the model for these scalar metrics. Check out the initializer for possible choices.
prev_rangeFor metrics that need thresholding only consider thresholds that yield a prevalence in this range.
confidence_levelConfidence level gamma, e.g. for confidence intervals.
benchmarkName and pivot time cutoff of the benchmark
Model.round_digitsRound the results in tables to round_digits digits after the point.
fileSave the resulting tibble to this csv file.
Methods
Method new()
Construct an AssScalar R6 object.
Usage
AssScalar$new(
metrics = c("auc", "accuracy", "precision", "prevalence", "precision_ci_ll",
"precision_ci_ul", "hr", "hr_ci_ll", "hr_ci_ul", "hr_p", "n_true", "perc_true",
"n_samples", "logrank", "threshold"),
prev_range = c(0, 1),
confidence_level = 0.95,
benchmark = NULL,
file = NULL,
round_digits = 3
)Arguments
metricscharacter. Assess the model for these metrics. For currently offered choices see "Usage". If you have a model with non-binary output (like the linear predictor of a Cox model), we choose a threshold by maximizing the left-most metric in
metricsthat is made for classifiers with binary output (e.g. precision withinprev_rangebelow). If this cannot be done reasonably, throw an error. Make sure thathrprecedeshr_ci_ll,hr_ci_ulandhr_pinmetrics;precision_ci_llmust precedeprecision_ci_ul.prev_rangenumeric numeric vector of length 2. For metrics that need thresholding only consider thresholds that yield a prevalence in this range.
confidence_levelnumeric. The confidence level gamma (e.g. for confidence intervals).
benchmarklist or
NULL. If not NULL, it is a list with names"name": thenameattribute of the benchmarkModelin themodel_listparameter of theassess()andassess_center()method,"prev_range": An extra value for theprev_rangeattribute used for the benchmarkModel. Often, we need a higher prevalence for our, new models to gain statistical power and be able to significantly outperform the benchmark.
filestring or NULL. If not
NULL, save the resulting tibble to this csv file.round_digitsnumeric. The number of digits to round the results to.
Method assess()
Assess a single model.
Method assess_center()
Wrap assess() to assess multiple models and store the result.