assert_surv_matrix: Assert survival matrix

View source: R/assertions.R

assert_surv_matrixR Documentation

Assert survival matrix

Description

Asserts if the given input matrix is a (discrete) survival probabilities matrix using Rcpp code. The following checks are performed:

  1. All values are probabilities, i.e. S(t) \in [0,1]

  2. Column names correspond to time-points and should therefore be coercable to numeric and increasing

  3. Per row/observation, the survival probabilities decrease non-strictly, i.e. S(t) \ge S(t+1)

Usage

assert_surv_matrix(x)

Arguments

x

(matrix())
A matrix of (predicted) survival probabilities. Rows are observations, columns are (increasing) time points.

Value

if the assertion fails an error occurs, otherwise NULL is returned invisibly.

Examples

x = matrix(data = c(1,0.6,0.4,0.8,0.8,0.7), nrow = 2, ncol = 3, byrow = TRUE)
colnames(x) = c(12, 34, 42)
x

assert_surv_matrix(x)


mlr-org/mlr3proba documentation built on April 12, 2025, 4:38 p.m.