# surv_func_joint: Evaluates the Conditional Survival Function Given the Random... In SimSurvNMarker: Simulate Survival Time and Markers

## Description

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).

## Usage

  1 2 3 4 5 6 7 8 9 10 11 12 13 surv_func_joint( ti, B, U, omega, delta, alpha, b_func, m_func, gl_dat = get_gl_rule(30L), g_func, offset ) 

## Arguments

 ti numeric vector with time points. B coefficient matrix for time-varying fixed effects. Use NULL if there is no effect. U random effects matrix for time-varying random effects. Use NULL if there is no effects. omega numeric vector with coefficients for the baseline hazard. delta offset on the log hazard scale. Use NULL if there is no effect. alpha numeric vector with association parameters. b_func basis function for the baseline hazard like poly. m_func basis function for U like poly. gl_dat Gauss–Legendre quadrature data. See get_gl_rule. g_func basis function for B like poly. offset numeric vector with non-time-varying fixed effects.

sim_marker, draw_U, eval_surv_base_fun
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ##### # 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)