Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 44 3 g Solution 2026-10-14
The hierarchical Bayesian model separates variability between individuals from variability between repeated measurements on an individual. In WinBUGS,
dnorm takes a precision parameter, so inverse variance is the appropriate second argument.Line (1) gives , hence a positive log-normal distribution for each within-individual variance. Estimating the shared parameters supplies partial pooling of these variances without forcing them equal. Line (2) assigns a proper bounded flat prior to the between-individual standard deviation , and line (3) does the same for the standard deviation on the log-variance scale. The broad bounded priors on and are also proper.
This is a reasonable structure for heterogeneous repeated measurements, but flat does not mean uninformative on all transformed scales. The bounds must be wide enough for plausible values, while such enormous ranges can put substantial mass on implausible predictions. Use prior predictive checks and sensitivity analysis, and check the Markov chain Monte Carlo convergence diagnostics. Serial dependence or systematic trends would require an extension of the independent-measurement likelihood.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 44 3 h Solution 2026-10-14
Add the new individual's latent mean and log variance to the same population hierarchy. Enter only that individual's first two measurements as observations; use the historical data and these two values to fit the model. The third measurement must be held out, or the predictive check reuses the value it is meant to test. For example, augment the unchanged population hyperpriors with this WinBUGS structure:
new.mean ~ dnorm(mu, invtau2)
new.logvar ~ dnorm(phi, invpsi2)
new.precision <- exp(-new.logvar)
for (k in 1:2) {
new.Y[k] ~ dnorm(new.mean, new.precision)
}
future.Y ~ dnorm(new.mean, new.precision)
upper.indicator <- step(future.Y - held.out.third)future.Y is unobserved. Its simulated values give the posterior predictive distribution, including uncertainty in the population parameters and personal variance. A central 99.9% prediction interval uses its and empirical quantiles. Flag the third value if it is outside that interval. Equivalently, estimate its predictive tail probability by the mean of upper.indicator and flag if that mean is below or above . This is two-sided, unlike the earlier one-sided upper limit. Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 44 4 d Solution Created 2026-10-03 Updated 2026-10-14
Model B replaces independent tree parameters by multivariate normal random effects. It permits correlated asymptote, timing and slope variation and supplies partial pooling, a useful improvement if the five trees can be regarded as exchangeable.
The Wishart distribution prior is on the precision matrix , not the covariance matrix. In the WinBUGS convention, dimension three and degrees of freedom three give a proper but very dispersed prior. The induced inverse-Wishart distribution has no finite mean at those degrees of freedom. Thus this is not a neutral choice of covariance prior, and estimating six covariance components from only five trees is weakly informed. The broad mean priors and possible negative growth slopes also remain. Check prior-predictive curves and sensitivity, and consider separate, interpretable scale and correlation priors.
The resulting posterior means of the second and third parameters are quite similar across trees, motivating a simpler shared-shape model; their uncertainty means this similarity is evidence to explore, rather than a proof of exact equality.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 36 2 g Solution Created 2026-10-03 Updated 2026-10-14
The WinBUGS model uses a finite truncation of the reciprocal prior. The numbered lines have the following roles:
- Line (1) forms , the normalized prior probability vector on the integer labels . The deterministic sum may be declared after its use because the model is declarative.
- Line (2) assigns that categorical distribution. The following observation model treats the supplied value as observed data, rather than as an unknown parameter.
- Line (3) forms observation probabilities for and zero for . For integer , the small positive offset in
step(N-j+0.01)includes the endpoint without depending on the convention at zero. There are exactly nonzero entries, so this vector sums to one.
Combining that categorical distribution observation likelihood with the truncated reciprocal prior producesThe Markov chain Monte Carlo output approximates this posterior. The actual PDF separates the observation line from the preceding comment; it must remain an active stochastic statement.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 36 3 d Solution Created 2026-10-03 Updated 2026-10-14
The regression coefficients have independent proper uniform distributions on very wide finite intervals. These are flat in the coefficients, not flat in fitted rates, and can be highly informative on the rate scale. The scale is uniform on , and WinBUGS receives the corresponding precision for each normal distribution random effect. Writing , the induced prior density isIt is proper and integrable at zero.
The usual scale-invariant variance prior would instead cause an improper posterior from a log-uniform random-effect scale prior. After integrating out the plate effects, the likelihood function tends as to the ordinary positive Poisson likelihood. On any compact interior set of coefficient values this limit is positive and bounded away from zero. Hence the posterior normalizing integral contains a divergent factor . There is no posterior distribution under that prior, even if formal full conditional distributions appear usable. Thus a proper prior with integrable mass near zero is needed here. The reciprocal-scale rule is the standard pure-scale Jeffreys prior; it should not be confused with the model-specific information prior for an additive variance component.
Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 36 3 e Solution Created 2026-10-03 Updated 2026-10-14
Delete the plate random effects from the linear predictor and remove their stochastic nodes and the unused scale/precision nodes. The observation layer then remains a Poisson distribution withFor example the essential WinBUGS observation block can be written asRetain the coefficient priors. This is the sampling model implemented directly; attempting to keep
for (i in 1:doses) {
for (j in 1:plates) {
y[i,j] ~ dpois(mu[i,j])
log(mu[i,j]) <- alpha + beta*log(x[i]+10) + gamma*x[i]
}
}1/(tau*tau) while fixing tau to zero would divide by zero. Past exam of the mathematics course of the University of Cambridge 2009 iii Paper 36 4 f Solution Created 2026-10-03 Updated 2026-10-14
Introduce independent component indicators , and auxiliary slab effects , independent of the indicators. Set . Then inactive genes have exactly zero effect, while active genes have the stipulated normal distribution. With supplied as known data and elicited positive beta shapes, one suitable WinBUGS model isThe normal arguments are precisions, not variances. Supply all observed
model {
q ~ dbeta(aq, bq)
for (i in 1:N) {
z[i] ~ dbern(q)
u[i] ~ dnorm(0, 1/V)
theta[i] <- z[i]*u[i]
y[i] ~ dnorm(theta[i], 1)
}
}y values, monitor q, theta and optionally z, and assess Markov chain Monte Carlo convergence diagnostics. The proper auxiliary prior remains defined for inactive genes, where is not informed by the likelihood. This represents the exact point-null mixture prior, rather than replacing its point mass by a narrow continuous spike. Conditional on the indicators, has beta distribution , providing a useful check on the update. Wishart distribution 2026-10-14
For integer , the sum of independent vectors has a Wishart distribution. Its positive-definite density extends to real and is proportional to . It is a conjugate prior for the precision matrix of a multivariate normal distribution. Its mean is .
The WinBUGS declaration
dwish(R, nu) uses ; the density convention is documented in the NIMBLE BUGS-language manual. For it is proper, while the expected inverse matrix does not exist: that expectation requires . Specifying a Wishart prior on precision is therefore a substantive covariance assumption.