assert_surv_matrix | R Documentation |
Asserts if the given input matrix is a (discrete) survival probabilities matrix using Rcpp code. The following checks are performed:
All values are probabilities, i.e. S(t) \in [0,1]
Column names correspond to time-points and should therefore be coercable to
numeric
and increasing
Per row/observation, the survival probabilities decrease non-strictly, i.e.
S(t) \ge S(t+1)
assert_surv_matrix(x)
x |
( |
if the assertion fails an error occurs, otherwise NULL
is returned
invisibly.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.