surv_quantile {hesim} | R Documentation |
Survival quantiles
Description
Compute quantiles from survival curves.
Usage
surv_quantile(x, probs = 0.5, t, surv_cols, by)
Arguments
x |
A |
probs |
A numeric vector of probabilities with values in |
t |
A character scalar of the name of the time column. |
surv_cols |
A character vector of the names of columns containing survival curves. |
by |
A character vector of the names of columns to group by. |
Value
A data.table
of quantiles of each survival curve in
surv_cols
by each group in by
.
Examples
library("data.table")
t <- seq(0, 10, by = .01)
surv1 <- seq(1, .3, length.out = length(t))
surv2 <- seq(1, .2, length.out = length(t))
strategies <- c("Strategy 1", "Strategy 2")
surv <- data.table(strategy = rep(strategies, each = length(t)),
t = rep(t, 2),
surv = c(surv1, surv2))
surv_quantile(surv, probs = c(.4, .5), t = "t",
surv_cols = "surv", by = "strategy")
[Package hesim version 0.5.4 Index]