Skip to contents

Generic quantile function used internally to simulating from an arbitrary baseline survival distribution.

Usage

qsurv(p, baseline, package = NULL, ...)

Arguments

p

vector of quantiles associated with the right tail area of the baseline survival distribution.

baseline

the name of the baseline distribution.

package

the name of the package where the baseline distribution is implemented. It ensures that the right quantile function from the right package is found, regardless of the current R search path.

...

further arguments passed to other methods.

Value

a vector of quantiles.

Examples


library(rsurv)
set.seed(1234567890)


u <- sort(runif(5))
x1 <- qexp(u, rate = 1, lower.tail = FALSE)
x2 <- qsurv(u, baseline = "exp", rate = 1)
x3 <- qsurv(u, baseline = "exp", rate = 1, package = "stats")
x4 <- qsurv(u, baseline = "gengamma.orig", shape=1, scale=1, k=1, package = "flexsurv")

cbind(x1, x2, x3, x4)
#>              x1         x2         x3         x4
#> [1,] 0.95202641 0.95202641 0.95202641 0.95202641
#> [2,] 0.34595405 0.34595405 0.34595405 0.34595405
#> [3,] 0.29132206 0.29132206 0.29132206 0.29132206
#> [4,] 0.17411789 0.17411789 0.17411789 0.17411789
#> [5,] 0.09339179 0.09339179 0.09339179 0.09339179