Level 4 — Application (novel problems, no hints)Time: 60 minutes Total Marks: 50
Answer all questions. Show full working. Use ... for mathematical notation. Standard normal values you may use: Φ(1.645)=0.95, Φ(1.96)=0.975, Φ(1)=0.8413.
Question 1 — Bayesian diagnostics & information (12 marks)
A spam filter classifies emails. From training data, 30% of incoming emails are spam. A word "FREE" appears in 60% of spam emails and in 10% of legitimate emails.
(a) An email contains "FREE". Compute the posterior probability that it is spam. (4)
(b) Two independent word-features are now used: "FREE" (as above) and "WINNER" which appears in 50% of spam and 5% of legitimate emails. Assuming conditional independence of the two words given the class, compute the posterior probability of spam for an email containing both words. (5)
(c) Compute the entropy (in bits) of the prior class distribution (spam vs legitimate). (3)
Question 2 — MLE for an exponential model (10 marks)
Server response times (in seconds) are modelled as i.i.d. Exponential(λ) with density f(x)=λe−λx, x≥0.
(a) Derive the maximum likelihood estimator λ^ for a sample x1,…,xn. (4)
(b) A sample of n=5 gives observations 0.5,1.0,2.0,1.5,0.5 seconds. Compute λ^. (2)
(c) Using your fitted model, compute P(X>2). (2)
(d) State (with brief justification) whether λ^ is the reciprocal of the sample mean, and what the MLE of the mean response time is. (2)
Question 3 — Sums, CLT and a probability bound (10 marks)
A factory produces bolts whose lengths are i.i.d. with mean μ=10 mm and standard deviation σ=0.4 mm. A box contains n=100 bolts.
(a) Let Xˉ be the sample mean length. State the approximate distribution of Xˉ and give its mean and standard deviation. (3)
(b) Compute the approximate probability that Xˉ exceeds 10.05 mm. (3)
(c) Give a symmetric 95% interval for Xˉ centred on 10 mm. (2)
(d) A colleague claims the exact distribution of individual bolt lengths must be Normal for part (a) to hold. Is this correct? Justify in one sentence. (2)
(c)10±1.96(0.04)=10±0.0784, i.e. [9.9216,10.0784] mm. (2)
(d) Incorrect — the CLT gives an approximate Normal distribution for Xˉ regardless of the individual distribution (given finite variance and large n); individual lengths need not be Normal. (2)
[{"claim":"Q1a posterior spam given FREE = 0.72","code":"pS=Rational(3,10); pFS=Rational(6,10); pFnS=Rational(1,10); post=pFS*pS/(pFS*pS+pFnS*(1-pS)); result = (post==Rational(72,100))"},{"claim":"Q1b posterior both words approx 0.9626","code":"num=0.3*0.3; den=num+0.005*0.7; result = abs(num/den-0.9626)<1e-3"},{"claim":"Q2 exp MLE lambda=5/5.5 and P(X>2)","code":"lam=Rational(5,55)*10; result = (lam==Rational(10,11)) and abs(exp(-float(lam)*2)-0.1623)<1e-3"},{"claim":"Q3b P(Xbar>10.05) approx 0.1056","code":"from sympy import erf; z=1.25; p=1-(0.5*(1+erf(z/sqrt(2)))); result = abs(float(p)-0.1056)<2e-3"},{"claim":"Q4 covariance -0.02 and correlation approx -0.0891","code":"cov=0.4-0.7*0.6; rho=cov/sqrt(0.21*0.24); result = abs(cov+0.02)<1e-9 and abs(rho+0.0891)<1e-3"},{"claim":"Q5 z-statistic = 2.5","code":"z=(0.85-0.80)/sqrt(0.8*0.2/400); result = abs(z-2.5)<1e-9"}]