Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 34 2 h Solution Created 2026-10-03 Updated 2026-10-07
Assuming independent digits under Benford law, put and . The count vector has a multinomial distribution, with expected counts . Suitable predictive discrepancy statistics include the Pearson chi-squared statistic and multinomial deviance:The zero-count terms of have limiting value zero. A Monte Carlo method gives a direct null comparison even when expected counts are small.
For example, an original R implementation is:Each column returned by
benford_check <- function(y, B = 9999L) {
p <- log10(1 + 1/(1:9))
n <- sum(y)
expected <- n*p
observed <- sum((y - expected)^2/expected)
replicas <- rmultinom(B, size = n, prob = p)
simulated <- colSums((replicas - expected)^2/expected)
(1 + sum(simulated >= observed))/(B + 1)
}rmultinom is a replicated count vector. R recycles the nine expected counts down each column. The add-one ratio is a Monte Carlo test estimate. In WinBUGS, alternatively generate a replicated dmulti vector using fixed , compute its discrepancy and monitor exceedance of the observed value. The null does not estimate unknown digit probabilities. Dependence or selection in the accounts would require an appropriate simulation model. Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 208 5 d Solution Created 2026-10-03 Updated 2026-10-06
The printed identity needs an expectation on its right-hand side. For fixed , condition on and use independence of :The expression inside this expectation is generally random and cannot equal the unconditional probability by itself.
For each independent Monte Carlo method replicate, draw from its given distribution. If , draw independent -variables, form and set . For the empty sum is . If may equal zero, use when , since . The law of total expectation givesSince , the estimator has statistical consistency by the strong law of large numbers. It is the conditional Monte Carlo estimator obtained by Rao-Blackwellization of the direct indicator , and the law of total variance gives .
This version assumes that the cumulative distribution function can be evaluated. An easy sampler alone does not automatically supply an easy cumulative distribution function evaluation. If only sampling is available, use the direct indicator estimator, or replace each conditional cumulative distribution function by the average of several independent indicators ; the nested version remains an unbiased estimator. With such inner draws its variance per outer replicate is .