Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 35 2 d Solution Created 2026-10-03 Updated 2026-10-06
In Markov chain Monte Carlo, retain the derived quantity at every iteration. Rough BUGS code using the actual observations isSupply
model {
pM ~ dbeta(0.5,0.5)
pT ~ dbeta(0.5,0.5)
milkAnswers ~ dbin(pM,4)
teaAnswers ~ dbin(pT,4)
delta <- pM-pT
positive <- step(delta)
}milkAnswers=3 and teaAnswers=1. Summarize delta by its posterior mean, empirical quantiles and credible interval; the average of positive estimates . Here . Check Markov chain Monte Carlo convergence diagnostics before interpreting the simulation. Since both Bayesian posteriors are independent known Beta distributions, direct independent sampling is an equally valid, simpler way to obtain the same summaries. Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 35 4 f Solution Created 2026-10-03 Updated 2026-10-06
Represent the independent locally flat intercept prior distributions by broad finite uniform priors, for example on ; this is proper and approximately constant over plausible mortality logits. With calibrated above, rough BUGS code isUse and supply treated death counts with totals , and control death counts with totals . In BUGS, the second
model {
mu ~ dnorm(0,0.25)
tau ~ dunif(0,A)
invtau2 <- pow(tau,-2)
for (j in 1:J) {
alpha[j] ~ dunif(-10,10)
beta[j] ~ dnorm(mu,invtau2)
logit(thetaC[j]) <- alpha[j]-beta[j]/2
logit(thetaT[j]) <- alpha[j]+beta[j]/2
rC[j] ~ dbin(thetaC[j],nC[j])
rT[j] ~ dbin(thetaT[j],nT[j])
oddsRatio[j] <- exp(beta[j])
}
}dnorm argument is a precision parameter, so 0.25 corresponds to variance four. Initialize the positive scale away from zero. Monitor and study odds ratios, checking Markov chain Monte Carlo convergence diagnostics and sensitivity to the finite intercept bounds and scale prior distribution. The fitted hierarchy combines binomial sampling uncertainty with between-study heterogeneity. Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 219 2 iv Solution Created 2026-10-03 Updated 2026-10-05
A log-flat improper prior is not appropriate when all known are positive: the integrated likelihood in (iii) has a positive finite limit as , so its integral against diverges. One defensible noninformative choice is the scalar Jeffreys prior for an additive variance component, calculated holding the mean parameters fixed:Indeed the normal variance score has information . This is a scalar conditional-information prior, not a claim that its product with the flat mean prior is the joint Jeffreys prior. It is bounded near zero and is at infinity. The integrated likelihood is uniformly bounded near zero and is bounded by a constant times at infinity, independently of the mean-shape parameters, since . Thus and a proper external prior on the physically admissible ensure posterior propriety. Proper weak scale priors are another option. If known errors vanish, the boundary argument and appropriate prior need separate reconsideration.
For an efficient parameterization, use with and . A chain on this joint reduced parameter space targetsThe factor is the Jacobian determinant. At each iteration propose , with for a fixed nonsingular proposal covariance, and accept with probability . Proposals outside the physical prior domain have target zero. Tune during warmup and freeze it for the retained Random-walk Metropolis algorithm. To obtain samples of the full original parameter vector, independently draw from its retained positive prior and reconstruct ; the resulting vector is . Analytically marginalizing using (iii) would also be valid.
Use several dispersed chains, trace plots, rank-normalized split , and the effective sample size of a Markov chain for each parameter and for . These Markov chain Monte Carlo convergence diagnostics reveal poor mixing and disagreement but do not prove convergence. Estimate the integrated autocorrelation time ; with retained draws, . Default to no thinning of a Markov chain, so the thinning factor is . If storage requires thinning, choose a spacing after inspecting the autocorrelation and verify the retained-chain effective sample size; no finite spacing guarantees independent draws.
Using the retained samples, computeThese are posterior summaries, provided the corresponding moments exist, not uncertainties of the numerical estimates. A proper prior alone does not ensure finite second moments; choose or check the external prior accordingly. The Monte Carlo standard error of the posterior mean is approximately .