Q39. A generalised linear mixed model

[6 marks]

Patients receive treatment A or B and are assessed at weeks 0,4,8,12. The response is 1 if infection is present and 0 otherwise. Treatment A is the reference category.

glmer(
  infection ~ treatment * weeks + (1 | patientID),
  family = binomial
)

(a) Write down explicitly the complete model corresponding to this code. Define the patient and visit indices, and state the relevant distributional and independence assumptions.

(b) Briefly explain why including a patient-specific random intercept is sensible.

Definitions. Let i=1,\ldots,m index patients and j=1,\ldots,4 index visits. Y_{ij} is the infection indicator, t_{ij}\in\{0,4,8,12\} is time in weeks, and G_i=0 for treatment A or 1 for B. b_i is a patient-specific random intercept, with conditional infection probability p_{ij}(b_i)=\mathbb P(Y_{ij}=1\mid b_i,G_i,t_{ij}). The logit is \log\{p/(1-p)\}; N(0,\tau^2) uses variance \tau^2.

(a) Model statement. The conditional response model is Y_{ij}\mid b_i,G_i,t_{ij} \sim\operatorname{Bernoulli}\{p_{ij}(b_i)\}. Responses are conditionally independent given all random effects and covariates. The R term treatment * weeks expands to treatment, weeks, and their interaction, so \boxed{ \log\left(\frac{p_{ij}(b_i)}{1-p_{ij}(b_i)}\right) =\beta_0+\beta_GG_i+\beta_Tt_{ij} +\beta_{GT}G_it_{ij}+b_i. } The random effects satisfy \boxed{b_i\overset{\mathrm{iid}}{\sim}N(0,\tau^2).} They are assumed independent of the covariates, and different patients are independent. Repeated responses within a patient are generally not independent after the random effect is integrated out.

(b) Why include a patient-specific random intercept? Patients can have persistent differences in infection propensity that treatment and time do not explain. The shared b_i represents this baseline heterogeneity across all visits for patient i.

To see the induced dependence, let X collect the covariates and consider two distinct visits j\ne k. By the law of total covariance, \begin{aligned} \operatorname{Cov}(Y_{ij},Y_{ik}\mid X) &=\mathbb{E}\{\operatorname{Cov}(Y_{ij},Y_{ik}\mid b_i,X)\mid X\}\\ &\quad+\operatorname{Cov}\{ \mathbb{E}(Y_{ij}\mid b_i,X),\mathbb{E}(Y_{ik}\mid b_i,X)\mid X\}\\ &=\operatorname{Cov}\{p_{ij}(b_i),p_{ik}(b_i)\mid X\}. \end{aligned} The first term is zero by conditional independence, but the remaining covariance is generally nonzero.

Conclusion: The random intercept accounts for persistent between-patient differences and dependence among repeated observations from the same patient.