.surv_return | R Documentation |
Internal helper function to easily return the correct survival predict types.
.surv_return(
times = NULL,
surv = NULL,
crank = NULL,
lp = NULL,
response = NULL,
which.curve = NULL
)
times |
( |
surv |
( |
crank |
( |
lp |
( |
response |
( |
which.curve |
Which curve (3rd dimension) should the |
Sonabend, Raphael, Bender, Andreas, Vollmer, Sebastian (2022). “Avoiding C-hacking when evaluating survival distribution predictions with discrimination measures.” Bioinformatics. ISSN 1367-4803, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/BIOINFORMATICS/BTAC451")}, https://academic.oup.com/bioinformatics/advance-article/doi/10.1093/bioinformatics/btac451/6640155.
n = 10 # number of observations
k = 50 # time points
# Create the matrix with random values between 0 and 1
mat = matrix(runif(n * k, min = 0, max = 1), nrow = n, ncol = k)
# transform it to a survival matrix
surv_mat = t(apply(mat, 1L, function(row) sort(row, decreasing = TRUE)))
# crank is expected mortality, distr is the survival matrix
.surv_return(times = 1:k, surv = surv_mat)
# if crank is set, it's not overwritten
.surv_return(times = 1:k, surv = surv_mat, crank = rnorm(n))
# lp = crank
.surv_return(lp = rnorm(n))
# if response is set and no crank, crank = -response
.surv_return(response = sample(1:100, n))
# if both are set, they are not overwritten
.surv_return(crank = rnorm(n), response = sample(1:100, n))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.