eval_surv_base_fun | R Documentation |
Evaluates the survival function at given points where the hazard is given by
h(t) = \exp(\vecω^\top\vec b(t) + δ).
eval_surv_base_fun(ti, omega, b_func, gl_dat = get_gl_rule(30L), delta = NULL)
ti |
numeric vector with time points. |
omega |
numeric vector with coefficients for the baseline hazard. |
b_func |
basis function for the baseline hazard like |
gl_dat |
Gauss–Legendre quadrature data.
See |
delta |
offset on the log hazard scale. Use |
# Example of a hazard function b_func <- function(x) cbind(1, sin(2 * pi * x), x) omega <- c(-3, 3, .25) haz_fun <- function(x) exp(drop(b_func(x) %*% omega)) plot(haz_fun, xlim = c(0, 10)) # plot the hazard library(SimSurvNMarker) gl_dat <- get_gl_rule(60L) plot(function(x) eval_surv_base_fun(ti = x, omega = omega, b_func = b_func, gl_dat = gl_dat), xlim = c(1e-4, 10), ylim = c(0, 1), bty = "l", xlab = "time", ylab = "Survival", yaxs = "i") # using to few nodes gives a wrong result in this case! gl_dat <- get_gl_rule(15L) plot(function(x) eval_surv_base_fun(ti = x, omega = omega, b_func = b_func, gl_dat = gl_dat), xlim = c(1e-4, 10), ylim = c(0, 1), bty = "l", xlab = "time", ylab = "Survival", yaxs = "i")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.