Joint Model
This type implements a general family of joint models. Let $h_0:\mathbb{R} \to\mathbb{R}_{+}$ be a baseline hazard function. Suppose we have $k\in \mathbb{N}$ longitudinal models $\{m_{1},\dots, m_{k}\}\subset \{\text{Functions: }\mathbb{R}\to\mathbb{R}\}$ as well as $k$ links $\{l_{1},\dots, l_{k}\}\subset \{\text{Operators on functions: }\mathbb{R}\to\mathbb{R}\}$. Let $M: \mathbb{R} \to \mathbb{R}^k$ and $L:\mathbb{R}^k \to \mathbb{R}^k$ be the multidimensional vector versions
\[\begin{align*} M(t) \mapsto \begin{pmatrix} m_{1}(t) \\ m_{2}(t) \\ \dots \\ m_{k}(t) \end{pmatrix} \text{, } L\begin{pmatrix} \mu_1 \\ \mu_2 \\ \dots \\ \mu_k \end{pmatrix} \mapsto \begin{pmatrix} l_1(\mu_1) \\ l_2(\mu_2) \\ \dots \\ l_k(\mu_k) \end{pmatrix} \text{ and } L(M(t)) =\begin{pmatrix} l_1(m_{1}(t)) \\ l_2(m_{2}(t)) \\ \dots \\ l_k(m_{k}(t)) \end{pmatrix}. \end{align*}\]
In code $L(M(t))$ corresponds to an array of unary functions (one argument). You are responsible for choosing the longitudinal model and link and finally the application of the link to the longitudinal model. For the link model vector $L(M(t))$ we consider a coefficient vector $\gamma \in \mathbb{R}^k$. Then we can formulate a hazard as follows
\[h(t) = h_0(t) \exp\left(\sum_{j\in [k]}\gamma_{j} l_j(m_{j}(t)) \right) = h_0(t) \exp(\gamma' \cdot L(M(t))).\]
Additionally we consider covariates $x\in \mathbb{R}^l, l\in\mathbb{N}$ and coefficients $\beta \in \mathbb{R}^l$. This results in the hazard
\[\begin{align*} h(t) &= h_0(t) \exp\left(\gamma' \cdot L(M(t)) + \beta' \cdot x\right)\\ &= h_0(t) \exp\left(\sum_{j\in [k]}\gamma_{j} l_j(m_{j}(t)) + \sum_{j\in [l]} x_j \beta_j \right), \end{align*}\]
which is implemented in JointSurvivalModel
:
JointSurvivalModels.JointSurvivalModel
— TypeJointSurvivalModel <: HazardBasedDistribution <: ContinuousUnivariateDistribution
JointSurvivalModel
is based on the hazard formulation:
$h_i(t) = h_0(t) \exp\left(\gamma' \cdot L(M_i (t)) + \beta' \cdot x \right),$
where $h_0: \mathbb{R} \to \mathbb{R}_{+}$ is the baseline hazard function. The term $L(M(t)): \mathbb{R} \to \mathbb{R}^k, k\in\mathbb{N}$ represents the link to the longitudinal model(s) and $\gamma\in\mathbb{R}^k$ are the link coefficients. Lastly $x \in\mathbb{R}^l, l\in\mathbb{N}$ the covariates with coefficients $\beta\in\mathbb{R}^l$.
Fields:
h₀::Function
: a positive valued function in time representing the baseline hazardγ::Vector{Real}
: coefficients for links to longitudinal models, should have the same length aslink_m
link_m::Vector{Function}
: unary functions (one argument) in time representing the link to a single or multiple longitudinal modelsβ::Vector{Real}
: coefficients for covariates, should have the same length asx
x::Vector{Real}
: covariates
Example
There are constructors for calling JointSurvivalModel
without covariates and for single longitudinal models without the need for arrays. For example:
using JointSurvivalModels
JointSurvivalModel(identity, 0.01, identity, 0.02, 3)
# corresponds to hazard: identity(t) * exp(0.01 * identity(t) + 0.02 * 3)
JointSurvivalModel(identity, 0.01, identity)
# corresponds to hazard: identity(t) * exp(0.01 * identity(t))
JointSurvivalModel(identity,
[0.01,-0.02,0.03],
[x -> sqrt(x), x -> sin(x)+1, x -> cos(x)^2],
[2, 0.3],
[ 0, sqrt(2)])
# corresponds to hazard: identity(t) * exp(0.01 * sqrt(t) - 0.02 * (sin(t)+1) + 0.03 * cos(t)^2 + 2 * 0 + 0.3 * sqrt(2))
Its hazard is calculated by:
JointSurvivalModels.hazard
— MethodThe hazard
for JointSurvivalModel
calculates the hazard according to the formulation $h(t) = h_0(t) \exp\left(\gamma' \cdot L(M(t)) + \beta' \cdot x \right)$ described in the documentation of JointSurvivalModel
Example
my_joint_model = JointSurvivalModel(identity, 0.01, identity) hazard(my_joint_model, 10)
`