Solution (source code)

= Solution

Model 2 is an <errors-in-variables model>: the follow-up regression depends on a latent true baseline rather than substituting its noisy observation. A common <normal distribution> for the true baselines provides <partial pooling> and allows uncertainty about each baseline to propagate to the regression coefficients and predictions. Conditional on the shared parameters, the child-specific factorization is
$$
p(\alpha_i\mid\delta,\tau)\,p(\mu_{0i}\mid\theta,\psi)\,p(y_{0i}\mid\mu_{0i},q)
\prod_{j=1}^3p(y_{ij}\mid\alpha_i,\mu_{0i},\beta,\gamma,q,t_{ij}),\qquad q=1/\sigma^2.
$$
The <Directed acyclic graph> below includes the shared parameters, the two local <latent variables>, both observed measurements, and the deterministic regression mean. The outer plate repeats over children and the inner plate over follow-up visits. Filled nodes are observed; rectangular mean nodes are deterministic.

\Image[/past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2010/iii/paper-36-model-2.png]
{title=Directed graph of the latent-baseline random-intercept model, including shared priors, baseline measurement error and repeated follow-up visits}

One complete adapted <BUGS> specification uses the non-centered form of the <random intercept>, retaining the original priors and adding proper broad priors for $\theta$ and $\psi$:

``
for (i in 1:N) {
  z[i] ~ dnorm(0, 1)
  alpha[i] <- delta + tau*z[i]
  truebase[i] ~ dnorm(theta, baseprec)
  baseline[i] ~ dnorm(truebase[i], noiseprec)
  for (j in 1:3) {
    followmean[i,j] <- alpha[i] + beta*log(time[i,j]) + gamma*truebase[i]
    followup[i,j] ~ dnorm(followmean[i,j], noiseprec)
  }
}
noiseprec ~ dgamma(0.001, 0.001)
beta ~ dunif(-100, 100)
gamma ~ dunif(-100, 100)
delta ~ dunif(-100, 100)
tau ~ dunif(0, 100)
theta ~ dunif(-100, 100)
psi ~ dunif(0, 100)
baseprec <- 1/(psi*psi)
``

Here $N$ is the number of children, `baseline` and `followup` contain the observed data, and `dnorm` uses precision rather than variance. The priors on the newly introduced population baseline mean and standard deviation are explicit choices, not consequences of the likelihood; sensible alternatives can be checked for sensitivity. The code uses the noisy baseline only in its own measurement likelihood, and uses `truebase` in every follow-up mean.