Gaussian-prior Poisson log-effect conditional Created 2026-10-14 Updated 2026-10-20
For and a centered normal distribution prior, this conditional log-posterior has second derivative . It is strictly concave but does not belong to a normal distribution or gamma distribution family. A random-walk Metropolis algorithm, or a locally scaled proposal around its unique mode with the full proposal correction, can update it. Gaussian conjugacy is unavailable because the Poisson distribution likelihood contains an exponential rate.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 1 b Solution Created 2026-10-03 Updated 2026-10-06
Adaptive rejection sampling is exact rejection sampling for a differentiable log-concave probability density. Given interior evaluation points , construct the upper envelopewhere is the unnormalized target probability density function. The concave function lies below all its tangent lines, so . Interpolation between adjacent evaluation points gives a lower envelope there, allowing a squeeze test. The normalized upper envelope is a piecewise exponential proposal distribution.
Draw and an independent from the uniform distribution, and accept when . A squeeze test can establish acceptance without evaluating . Otherwise evaluate and, whenever it is evaluated, add to the envelope's points. Repeat until acceptance. On each linear piece , its integral is on , with value when . These integrals select a piece; inverse transform sampling samples within it.
Here, with and , the log-posterior on hasChoose evaluation points strictly inside , avoiding any endpoint singularities of the logarithm. Every finite set of tangent lines gives a finite upper-envelope integral on this bounded interval; slope conditions needed for unbounded supports are unnecessary. When the posterior distribution is simply the uniform distribution and may be sampled directly.
For any fixed envelope, proposal times acceptance is proportional to . Conditional on all past evaluations and rejections, the next accepted value therefore has the same normalized posterior density. To see that adaptation does not spoil this, at every attempted draw its accepted mass is a scalar times that fixed posterior density; summing over possible rejection histories preserves it. The acceptance probability stays bounded below by its positive initial-envelope value because insertion only lowers the upper envelope. Thus acceptance occurs almost surely. With fresh independent randomness, successive accepted values are exact independent samples from the posterior distribution, even when the envelope is retained and improved between them.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 4 c Solution Created 2026-10-03 Updated 2026-10-06
Parameterize the initial product normal distribution by , usingRun the given recursion with independent random variables with uniform distributions to obtain . Because the noise laws do not depend on , the chain rule and automatic differentiation give reparameterization gradients through the entire simulated trajectory. The variational objective is , where and .
One must account for the output differential entropy, not just optimize . Simulation and differentiability of do not themselves supply an evaluable . If retains the reversible Markov chain assumption from part (b), a concrete algorithm avoids a transition-density oracle using reversible density-ratio propagation. Write , with an evaluable unnormalized posterior density, and defineDetailed balance impliesFor example, integrate and replace by to obtain the first identity. This also proves absolute continuity of measures of with respect to when . An everywhere finite differentiable log-posterior has positive density, so an ordinary product normal distribution has this domination.
For each outer sample , independently run trajectories of length starting at , with endpoints . These are reverse trajectories because of detailed balance; the same recursion simulates them. Estimate byAverage over an outer batch. Compute it stably by a logarithmic sum of exponentials. Differentiate through both outer and reverse trajectories and through the explicit product-normal probability density function . Only the given state gradients of and , together with elementary normal-density derivatives, are needed. Apply stochastic gradient descent to and , refreshing the independent noise batches. The logarithmic scale parameters keep all variances positive.
This is nested Monte Carlo optimization of the exact objective in the limit of adequately increasing inner and outer sample sizes. For fixed , is generally biased, even though is an unbiased estimator. Finite logarithmic moments, suitable uniform integrability, and justified differentiation under the integral sign are needed for consistency and gradient interchange. Under those conditions increasing and controlling the optimization error yields a justified numerical approximation; nonconvexity prevents a generic guarantee of a global optimum.
There is a real assumption issue: part (c) redefines without explicitly restating reversibility. The algorithm above uses the reversible interpretation inherited from part (b). For an arbitrary differentiable recursion, one additionally needs access to output densities or a simulatable reverse kernel and regularity of the objective. Differentiability alone is insufficient: is differentiable and, with a standard-normal target, makes a point mass for , so every candidate has infinite Kullback-Leibler divergence. Thus a universal finite-objective algorithm cannot be justified solely from the literal differentiability assumptions. An invertible recursion with computable density transformations offers a different sufficient route, but invertibility is not stated here.
Use several complementary Markov chain Monte Carlo convergence diagnostics, monitoring both and rather than judging the chain solely by its length:
- Trace plots of each parameter and the log-posterior against iteration, including early iterations and later windows. Look for initial drift, long flat stretches, abrupt switches and sustained changes in spread. Several independent chains started at dispersed points should explore the same region after burn-in.
- Plots of cumulative sample means and selected sample quantiles against iteration. Compare chains and successive long blocks; persistent movement indicates that the estimated posterior moments or tails have not stabilized.
- Autocorrelation function plots for both parameters after tentative burn-in. Slow decay reveals strong serial dependence and a small effective sample size of a Markov chain, even when iterations have been generated.
- Overlaid histograms or kernel density estimation curves from successive retained blocks and from different chains. Their agreement provides evidence of stable marginal posterior distributions.
- A scatter plot of retained pairs, colored by time block if helpful. Strong dependence or separate clusters can expose slow joint exploration that marginal plots conceal.
A million iterations and stable-looking plots do not prove convergence. Agreement across dispersed chains, exploration of all visible modes and adequate effective sample size of a Markov chain provide stronger evidence. Estimate the Monte Carlo standard error using the chain's autocorrelation; the independent random variables formula from 3(b)(ii) does not apply directly to these dependent draws.
Assume and a current state with , . The unnormalized posterior density isThus the log-posterior, up to an additive constant, is the log-likelihood plus the beta distribution and exponential distribution log prior densities. The exponential distribution rate is , since is its mean. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Beta.html. Official R documentation: dbeta arguments and logarithmic density output
[ref]https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Exponential.html. Official R documentation: dexp rate parameter and mean equal to inverse rate
Choose a symmetric joint random-walk Metropolis algorithm proposal: and , for independent standard normal distribution draws. Its scale depends only on fixed hyperparameters, so forward and reverse proposal probability density functions agree. Reject immediately outside ; otherwise accept with Metropolis–Hastings acceptance probabilityThe following function makes exactly one proposal, with rejection retaining both old parameters:
MHstep <- function(x, p, beta, a, b, mu) {
p_new <- rnorm(1, mean = p, sd = 0.1)
beta_new <- rnorm(1, mean = beta, sd = mu / 2)
if (p_new <= 0 || p_new >= 1 || beta_new <= 0)
return(list(p = p, theta = beta))
logpost <- function(pp, bb) {
ll_f(pp, bb, x) + dbeta(pp, a, b, log = TRUE) +
dexp(bb, rate = 1 / mu, log = TRUE)
}
logA <- logpost(p_new, beta_new) - logpost(p, beta)
if (log(runif(1)) <= min(0, logA)) {
p <- p_new
beta <- beta_new
}
list(p = p, theta = beta)
}The returned field
theta contains the updated value of beta. The original PDF really asks for p and theta, although no parameter is defined in this question. This choice preserves its literal interface while making the intended second parameter explicit. A caller therefore advances with state <- MHstep(x, p, beta, a, b, mu), p <- state$p, and beta <- state$theta.The proposal is an unrestricted symmetric normal distribution followed by rejection outside the support. Repeatedly drawing until a valid proposal appears would instead truncate and renormalize the proposal, requiring a proposal-density correction. The code uses immediate rejection and needs no such correction. The displayed scales are valid fixed choices; practical efficiency can be improved using a separate tuning phase.
Posterior score control variate Created 2026-10-05 Updated 2026-10-14
If a smooth posterior density has vanishing boundary terms, its log-posterior gradient satisfies andThis is a posterior integration-by-parts identity; it concerns differentiation in the random parameter, distinct from the usual mean-zero score identity for sampling distributions. It makes a vector control variate. Finite moments and known coefficients preserve unbiasedness of the Monte Carlo estimator.