model.Rmd
This document provides a summary of a hierarchical statistical model of antibody kinetics, implemented in Stan. The model is designed to analyse longitudinal titre data, accounting for boosting and waning effects over time. It incorporates individual-level random effects and covariate influences on key model parameters. A full description of the model can be found in the supplementary material in the published paper using the methods described here: Russell TW et al. Real-time estimation of immunological responses against emerging SARS-CoV-2 variants in the UK: a mathematical modelling study. Lancet Infect Dis. 2024 Sep 11:S1473-3099(24)00484-5.
This model is suitable for analysing longitudinal titre data with either lower, upper, both (or no) censoring and incorporates both individual-level variability and arbitrary regression structure to adjust for covariates. Users can adapt the model by specifying appropriate covariates via a R style linear model formula, priors, and data inputs relevant to their study.
The model describes the expected log-transformed titre value μn for individual n at time tn and titre type k, using a piecewise linear function to capture boosting and waning phases:
The expected log-transformed titre value μn is given by:
μn=t0,n+{m1,n⋅tn,iftn<tp,nm1,n⋅tp,n+m2,n⋅(tn−tp,n),iftp,n≤tn≤ts,nm1,n⋅tp,n+m2,n⋅(ts,n−tp,n)+m3,n⋅(tn−ts,n),iftn>ts,n
where:
The observed log-transformed titre values yn are modeled as:
yn∼Normal(μn,σ)
where σ is the measurement error standard deviation.
The model accounts for left-censoring and right-censoring:
Left-Censoring: For observations below detection limit L, the likelihood contribution is:
P(yn≤L)=Φ(L−μnσ)
Right-Censoring: For observations above detection limit U, the likelihood contribution is:
P(yn≥U)=1−Φ(U−μnσ)
where Φ(⋅) is the cumulative distribution function of the standard normal distribution.
For each individual n and titre type k, the parameters are modeled as:
t0,n=t0,k+𝐱⊤n𝛃t0+σt0,k⋅zt0,ntp,n=tp,k+𝐱⊤n𝛃tp+σtp,k⋅ztp,nts,n=tp,n+Δts,k+𝐱⊤n𝛃ts+σts,k⋅zts,nm1,n=m1,k+𝐱⊤n𝛃m1+σm1,k⋅zm1,nm2,n=m2,k+𝐱⊤n𝛃m2+σm2,k⋅zm2,nm3,n=m3,k+𝐱⊤n𝛃m3+σm3,k⋅zm3,n
where:
The population-level parameters for each titre type k have the following priors:
Tp,k0∼Normal(μt0,σt0)tp,kp∼Normal(μtp,σtp)Δtp,k∼Normal(μts−μtp,σts)mp,k1∼Normal(μm1,σm1)mp,k2∼Normal(μm2,σm2)mp,k3∼Normal(μm3,σm3)
The standard deviations of the individual-level random effects have priors:
σk∼Normal(0,σp)
The prior distributions are specified based on previous studies and domain knowledge: