surv_func_joint | R Documentation |
Evaluates the conditional survival function given the random effects, \vec U. The conditional hazard function is
h(t \mid \vec u) = \exp(\vecω^\top\vec b(t) + δ + \vecα^\top\vec o + \vec 1^\top(diag(\vec α) \otimes \vec g(t)^\top)vec(B) + \vec 1^\top(diag(\vec α) \otimes \vec m(t)^\top)\vec u).
surv_func_joint( ti, B, U, omega, delta, alpha, b_func, m_func, gl_dat = get_gl_rule(30L), g_func, offset )
ti |
numeric vector with time points. |
B |
coefficient matrix for time-varying fixed effects.
Use |
U |
random effects matrix for time-varying random effects.
Use |
omega |
numeric vector with coefficients for the baseline hazard. |
delta |
offset on the log hazard scale. Use |
alpha |
numeric vector with association parameters. |
b_func |
basis function for the baseline hazard like |
m_func |
basis function for |
gl_dat |
Gauss–Legendre quadrature data.
See |
g_func |
basis function for |
offset |
numeric vector with non-time-varying fixed effects. |
sim_marker
, draw_U
,
eval_surv_base_fun
##### # example with polynomial basis functions b_func <- function(x){ x <- x - 1 cbind(x^3, x^2, x) } g_func <- function(x){ x <- x - 1 cbind(x^3, x^2, x) } m_func <- function(x){ x <- x - 1 cbind(x^2, x, 1) } # parameters omega <- c(1.4, -1.2, -2.1) Psi <- structure(c(0.18, 0.05, -0.05, 0.1, -0.02, 0.06, 0.05, 0.34, -0.25, -0.06, -0.03, 0.29, -0.05, -0.25, 0.24, 0.04, 0.04, -0.12, 0.1, -0.06, 0.04, 0.34, 0, -0.04, -0.02, -0.03, 0.04, 0, 0.1, -0.08, 0.06, 0.29, -0.12, -0.04, -0.08, 0.51), .Dim = c(6L, 6L)) B <- structure(c(-0.57, 0.17, -0.48, 0.58, 1, 0.86), .Dim = 3:2) alpha <- c(.5, .9) # simulate and draw survival curve gl_dat <- get_gl_rule(30L) set.seed(1) U <- draw_U(chol(Psi), NCOL(B)) tis <- seq(0, 2, length.out = 100) Survs <- surv_func_joint(ti = tis, B = B, U = U, omega = omega, delta = NULL, alpha = alpha, b_func = b_func, m_func = m_func, gl_dat = gl_dat, g_func = g_func, offset = NULL) par_old <- par(mar = c(5, 5, 1, 1)) plot(tis, Survs, xlab = "Time", ylab = "Survival", type = "l", ylim = c(0, 1), bty = "l", xaxs = "i", yaxs = "i") par(par_old)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.