Description Usage Arguments Value Examples
Integrated Brier Score
1 2 3 |
surv_probs |
a matrix of survival probabilities |
label |
a numeric vector of class |
time |
(needed iff |
status |
(needed iff |
cens_data |
(optional) a |
cens_model |
Method for estimating inverse probability of censoring weights:
Note: if |
eval_times |
A numeric vector giving times at which to compute Brier scores, which will then be used collectively to compute the integrated Brier score. |
scale |
( |
a numeric value. If scale = TRUE
, return values of
0 indicate a non-informative model and values of 1 indicate
a perfect model. If scale = FALSE
, return values of 0 indicate
a perfect model, and return values greater than 0 are difficult
to interpret.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # prodlim needs to be loaded for pec functions to work.
library(prodlim)
library(survival)
set.seed(329)
# predict 1/2 for everyone, all the time
surv_probs <- matrix(
data = rep(1/2, 1000),
nrow = 100,
ncol = 10
)
# make random time & status values
time = runif(100, min = 1, max = 10)
status = c(rep(1, 50), rep(0, 50))
# use all the possible times
eval_times = seq(1, 10, length.out = 10)
# censor data has one variable that is
# related to time values
cens_data = data.frame(x1 = time + rnorm(100, sd = 1/2))
# note that the Brier score is 1/4, as expected, when
# no adjustment is applied for censoring.
eval_bscore(
surv_probs = surv_probs,
label = sgb_label(time, status),
eval_times = eval_times,
cens_data = cens_data,
cens_model = 'marginal',
scale = FALSE
)
# Now adjust for censoring:
eval_bscore(
surv_probs = surv_probs,
label = sgb_label(time, status),
eval_times = eval_times,
cens_data = cens_data,
cens_model = 'cox',
scale = FALSE
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.