Solution

ID: past-exam-of-the-simulation-and-statistical-programming-course-of-the-university-of-oxford/2023/3/c/i/solution

Each state has exactly neighbours: choose one occupied coordinate and one unoccupied coordinate to swap. The normalized proposal distribution is therefore
The swap relation is symmetric and the number of neighbours is constant, so . The discrete uniform distribution used as the prior distribution is also constant on , with mass . Both factors cancel in the Metropolis–Hastings acceptance probability.
Let and . The displayed multivariate normal distribution presupposes that the covariance matrix is a positive-definite matrix, so is a symmetric matrix. Expanding the difference of quadratic forms gives
Consequently
The truncation at zero is essential: a log acceptance ratio can be positive, but the logarithm of an acceptance probability cannot.
For the particular proposed swap, let be the coordinate changing from zero to one and the coordinate changing from one to zero. Then , and the untruncated scalar simplifies further to
Only two rows and four entries of are needed for this evaluation. This is Metropolis sampling on fixed-cardinality subsets.

New to topics? Read the docs here!