WeiYa's Work Yard

A dog, who fell into the ocean of statistics, tries to write down his ideas and notes to save himself.

BAMLSS: Flexible Bayesian Additive Joint Model

Posted on (Update: )
Tags: Mixture Model, Hypothesis Testing

This post is for Köhler, M., Umlauf, N., Beyerlein, A., Winkler, C., Ziegler, A.-G., & Greven, S. (2017). Flexible Bayesian additive joint models with an application to type 1 diabetes research. Biometrical Journal, 59(6), 1144–1165.

develop a general framework of flexible additive joint models that allows the specification of a variety of effects, such as smooth nonlinear, time-varying and random effects, in the longitudinal and survival parts of the models.

For each subject $i=1,\ldots, n$ we observe a potentially right-censored follow-up time $T_i$ and the event $\delta_i$ (1 if subject $i$ experiences the event, 0 if it is censored).

Model the hazard of an event at time $t$ as

\[h_i(t) = \exp(\eta_i(t)) = \exp(\eta_{\lambda i}(t) + \eta_{\gamma i} + \eta_{\alpha i}(t)\cdot \eta_{\mu i}(t) )\]

including in the full predictor $\eta$

  • a predictor $\eta_\lambda$ for all survival covariates that are time-varying or have a time-varying coefficient including the log-baseline hazard
  • a predictor for baseline survival covariates $\eta_\gamma$
  • a predictor $\eta_\alpha$ representing the potentially time-varying association between the longitudinal marker $\eta_\mu$ and the hazard

observe a longitudinal response $y_i = [y_{i1}], \ldots, y_{in_i}]^T$ at the potentially subject-specific ordered time points $t_i = [t_{i1},\ldots, t_{in_i}]^\top$ with $t_{i1}\le t_{i2}\le \cdots \le t_{in_i}\le T_i$.

the longitudinal response at $t_{ij}$ with $j=1,\ldots,n_i$ is modeled as

\[y_{ij} = \eta_{\mu i}(t_{ij}) + \varepsilon_{ij}\]

with independent errors $\varepsilon_{ij}\sim N(0, \exp[\eta_{\sigma i}(t_{ij})]^2)$ allowing to also model the error variance.

each predictor $\eta_{ki}$ with $k\in {\lambda, \gamma, \alpha, \mu, \sigma}$ is a structured additive predictor, that is, a sum of $M_k$ functions of covariates $x_i$,

\[\eta_{ki} = \sum_{m=1}^{M_k} f_{km}(x_{ki})\,.\]


  • in the survival submodel, the vectors are of length $n$ and potentially time-varying, where $\eta_k(t)$ denotes the evaluation at time $t$.
  • in the longitudinal submodel, the vector $\eta_k(t)$ is of length $N$, containing entries $\eta_{ki}(t_{ij})$ for all $i$ and $j$

the function $f_{km}(x_{ki})$ can model a variety of effects, such as smooth, spatial, time-varying or random effects terms

special cases:

  • P-spline log-baseline hazard $\eta_\lambda(t) = f_\lambda(t) = X_\lambda(t)\beta_\lambda$ with $K_\lambda = D_r^TD_r$
  • parametric effects of baseline survival covariates $\eta_\gamma = f_\gamma = X_\gamma\beta_\gamma$ with $K_\gamma = 0$
  • time-constant association between longitudinal and survival models $\eta_\alpha = f_\alpha = 1_n\beta_\alpha$ with $K_\alpha = 0$
  • longitudinal model with a random intercept $\eta_\mu(t) = f_{\mu 1}(t) + f_{\mu 2}(t) = X_{\mu 1}(t)\beta_{\mu 1} + X_{\mu 2}(t)\beta_{\mu 2}$
  • constant error variance $\eta_\sigma(t) = f_\sigma(t) = 1_N\beta_\sigma$ with $K_\sigma = 0$.



estimate the model in a Bayesian framework using Newton-Raphson and Markov chain Monte Carlo (MCMC) algorithms


assess the estimation in two aspects:

  1. compare with th established joint model implementation in JMbayes for model with time-constant $\eta_\alpha$
  2. assess the ability to model highly complex longitudinal trajectories as well as time-varying effect of $\eta_\alpha(t)$

Simulate survival times

this section is based on Bender, R., Augustin, T., & Blettner, M. (2005). Generating survival times to simulate Cox proportional hazards models. Statistics in Medicine, 24(11), 1713–1723.

the survival function of the Cox proportional hazards model is given by

\[S(t\mid x) = \exp[-H_0(t)\cdot \exp(\beta'x)]\]

where $H_0(t) = \int_0^t h_0(u)du$ is the cumulative baseline hazard function.

Thus, the distribution function of the Cox model is

\[F(t\mid x) = 1 - \exp[-H_0(t)\cdot \exp(\beta' x)]\]

Published in categories Note