brier: Brier Score for Right-Censored Survival Data at a Fixed Time

View source: R/metrics.R

brierR Documentation

Brier Score for Right-Censored Survival Data at a Fixed Time

Description

Computes the Brier score at a fixed time point using inverse probability of censoring weights (IPCW).

Usage

brier(object, pre_sp, t_star)

Arguments

object

A 'Surv' object with observed time and status.

pre_sp

A numeric vector of predicted survival probabilities at 't_star'.

t_star

The evaluation time point.

Value

A single numeric value representing the Brier score a a specific time point.

Examples


if (requireNamespace("torch", quietly = TRUE) && torch::torch_is_installed()) {
  veteran <- survival::veteran
  mod <- survdnn(survival::Surv(time, status) ~
  age + karno + celltype, data = veteran, epochs = 50, verbose = FALSE)
  pred <- predict(mod, newdata = veteran, type = "survival", times = c(30, 90, 180))
  y <- model.response(model.frame(mod$formula, veteran))
  survdnn::brier(y, pre_sp = pred[["t=90"]], t_star = 90)
}


survdnn documentation built on April 29, 2026, 9:07 a.m.