Level 3 — ProductionProbability Theory & Statistics

Probability Theory & Statistics

45 minutes60 marksprintable — key stays hidden on paper

Level: 3 — Production (from-scratch derivations, code-from-memory, explain-out-loud) Time limit: 45 minutes Total marks: 60

Instructions: Derive results from first principles where asked. Show all working. Code may be written in pseudocode or Python; correctness of logic is what is marked.


Question 1 — MGF and moments from scratch (10 marks)

(a) State the definition of the moment generating function MX(t)M_X(t) of a random variable XX, and prove that MX(0)=E[X]M_X'(0)=E[X] and MX(0)=E[X2]M_X''(0)=E[X^2], stating the regularity assumption you use. (4)

(b) For XPoisson(λ)X\sim\text{Poisson}(\lambda), derive MX(t)M_X(t) from the definition. (3)

(c) Use your MGF to obtain E[X]E[X] and Var(X)\operatorname{Var}(X). (3)


Question 2 — Transformation of variables (10 marks)

Let UUniform(0,1)U\sim\text{Uniform}(0,1). Define X=1λlnUX=-\dfrac{1}{\lambda}\ln U with λ>0\lambda>0.

(a) Using the change-of-variable (CDF) technique, derive the pdf of XX and name the distribution. (5)

(b) Explain out loud (in 2–3 sentences) how this result gives an algorithm to simulate exponential random variables from a uniform generator. (2)

(c) Write pseudocode/Python (from memory) for a Monte Carlo estimate of E[X]E[X] using nn such samples, and state which theorem guarantees convergence. (3)


Question 3 — Estimation: MLE vs method of moments (12 marks)

Let X1,,XnX_1,\dots,X_n be i.i.d. from an exponential distribution with rate λ\lambda, pdf f(x)=λeλxf(x)=\lambda e^{-\lambda x}, x>0x>0.

(a) Derive the maximum likelihood estimator λ^MLE\hat\lambda_{MLE}. (4)

(b) Derive the method-of-moments estimator λ^MM\hat\lambda_{MM}. (2)

(c) Show whether λ^MLE=1/Xˉ\hat\lambda_{MLE}=1/\bar X is unbiased for λ\lambda (state the relevant expectation; you may quote E[1/Xˉ]=nn1λE[1/\bar X]=\frac{n}{n-1}\lambda). (3)

(d) Explain out loud what consistency means and argue λ^MLE\hat\lambda_{MLE} is consistent. (3)


Question 4 — Central Limit Theorem (10 marks)

(a) State the classical CLT precisely (i.i.d., finite mean μ\mu and variance σ2\sigma^2). (3)

(b) Give the MGF-based proof sketch: show that the standardized sum's MGF converges to et2/2e^{t^2/2}, justifying each step. (5)

(c) A fair die is rolled n=100n=100 times. Using the CLT, approximate P(Xˉ>3.7)P(\bar X > 3.7) where μ=3.5\mu=3.5, σ2=35/12\sigma^2=35/12. (2)


Question 5 — Confidence interval & hypothesis test (10 marks)

A sample of n=40n=40 light bulbs has mean lifetime xˉ=1180\bar x = 1180 hours and known population σ=90\sigma=90 hours.

(a) Derive the 95%95\% confidence interval for the mean μ\mu from the CLT/pivot, and compute it. (4)

(b) Test H0:μ=1200H_0:\mu=1200 vs H1:μ1200H_1:\mu\neq1200 at α=0.05\alpha=0.05 using a z-test. Compute the test statistic, state the decision, and approximate the two-sided p-value. (4)

(c) Explain the difference between a Type I and Type II error in this context. (2)


Question 6 — Covariance & conditional expectation (8 marks)

Let (X,Y)(X,Y) have joint pdf f(x,y)=x+yf(x,y)=x+y for 0<x<1, 0<y<10<x<1,\ 0<y<1, and 00 otherwise.

(a) Find the marginal fX(x)f_X(x). (2)

(b) Find E[X]E[X] and E[XY]E[XY]. (3)

(c) Compute Cov(X,Y)\operatorname{Cov}(X,Y) and comment on whether X,YX,Y are independent. (3)

Answer keyMark scheme & solutions

Question 1 (10)

(a) Definition: MX(t)=E[etX]M_X(t)=E[e^{tX}] (for tt in a neighbourhood of 0 where the expectation is finite). (1) Assuming we may interchange differentiation and expectation (valid because MXM_X exists on an open interval about 0): MX(t)=E[XetX]MX(0)=E[X]M_X'(t)=E[Xe^{tX}]\Rightarrow M_X'(0)=E[X]. (1.5) MX(t)=E[X2etX]MX(0)=E[X2]M_X''(t)=E[X^2e^{tX}]\Rightarrow M_X''(0)=E[X^2]. (1.5)

(b) MX(t)=k=0etkeλλkk!=eλk=0(λet)kk!=eλeλet=eλ(et1)M_X(t)=\sum_{k=0}^\infty e^{tk}\frac{e^{-\lambda}\lambda^k}{k!}=e^{-\lambda}\sum_{k=0}^\infty\frac{(\lambda e^t)^k}{k!}=e^{-\lambda}e^{\lambda e^t}=e^{\lambda(e^t-1)}. (3)

(c) MX(t)=λeteλ(et1)M_X'(t)=\lambda e^t e^{\lambda(e^t-1)}, so E[X]=MX(0)=λE[X]=M_X'(0)=\lambda. (1) MX(t)=(λet+λ2e2t)eλ(et1)M_X''(t)=(\lambda e^t+\lambda^2 e^{2t})e^{\lambda(e^t-1)}, MX(0)=λ+λ2=E[X2]M_X''(0)=\lambda+\lambda^2=E[X^2]. (1) Var(X)=λ+λ2λ2=λ\operatorname{Var}(X)=\lambda+\lambda^2-\lambda^2=\lambda. (1)

Question 2 (10)

(a) For x>0x>0: FX(x)=P(Xx)=P(1λlnUx)=P(lnUλx)=P(Ueλx)=1eλxF_X(x)=P(X\le x)=P(-\frac1\lambda\ln U\le x)=P(\ln U\ge -\lambda x)=P(U\ge e^{-\lambda x})=1-e^{-\lambda x} (since UU uniform). (3) Differentiate: fX(x)=λeλxf_X(x)=\lambda e^{-\lambda x}, x>0x>0Exponential(λ\lambda). (2)

(b) Since F1(u)=1λln(1u)F^{-1}(u)=-\frac1\lambda\ln(1-u) (or 1λlnu-\frac1\lambda\ln u as 1UU1-U\sim U), applying the inverse CDF to a uniform draw yields an exponential draw — the inverse-transform / inverse-CDF sampling method. (2)

(c)

import numpy as np
def mc_mean(n, lam):
    U = np.random.rand(n)
    X = -np.log(U)/lam
    return X.mean()

Convergence to E[X]=1/λE[X]=1/\lambda guaranteed by the (Strong) Law of Large Numbers. (3)

Question 3 (12)

(a) Likelihood L=λeλxi=λneλxiL=\prod\lambda e^{-\lambda x_i}=\lambda^n e^{-\lambda\sum x_i}; log-likelihood =nlnλλxi\ell=n\ln\lambda-\lambda\sum x_i. (2) ddλ=nλxi=0λ^MLE=nxi=1Xˉ\frac{d\ell}{d\lambda}=\frac n\lambda-\sum x_i=0\Rightarrow \hat\lambda_{MLE}=\frac{n}{\sum x_i}=\frac1{\bar X}. Second derivative n/λ2<0-n/\lambda^2<0 ⇒ max. (2)

(b) E[X]=1/λE[X]=1/\lambda; set Xˉ=1/λλ^MM=1/Xˉ\bar X=1/\lambda\Rightarrow\hat\lambda_{MM}=1/\bar X. Same as MLE. (2)

(c) E[λ^MLE]=E[1/Xˉ]=nn1λλE[\hat\lambda_{MLE}]=E[1/\bar X]=\frac{n}{n-1}\lambda\neq\lambda. So it is biased (overestimates), bias =λn1=\frac{\lambda}{n-1}. (3)

(d) Consistency: λ^nPλ\hat\lambda_n\xrightarrow{P}\lambda as nn\to\infty. By LLN XˉP1/λ\bar X\xrightarrow{P}1/\lambda, and by continuous mapping 1/XˉPλ1/\bar X\xrightarrow{P}\lambda. Also bias 0\to0 and variance 0\to0. (3)

Question 4 (10)

(a) If X1,,XnX_1,\dots,X_n i.i.d. with mean μ\mu, variance σ2(0,)\sigma^2\in(0,\infty), then Zn=Xinμσn=n(Xˉμ)σdN(0,1).Z_n=\frac{\sum X_i-n\mu}{\sigma\sqrt n}=\frac{\sqrt n(\bar X-\mu)}{\sigma}\xrightarrow{d} N(0,1). (3)

(b) Let Yi=(Xiμ)/σY_i=(X_i-\mu)/\sigma, mean 0, var 1, MGF m(t)m(t) with m(0)=1,m(0)=0,m(0)=1m(0)=1,m'(0)=0,m''(0)=1. Then Zn=1nYiZ_n=\frac1{\sqrt n}\sum Y_i and MZn(t)=[m ⁣(tn)]n.M_{Z_n}(t)=\left[m\!\left(\tfrac{t}{\sqrt n}\right)\right]^n. (2) Taylor: m(t/n)=1+t22n+o(1/n)m(t/\sqrt n)=1+\frac{t^2}{2n}+o(1/n). (1.5) So MZn(t)=(1+t22n+o(1/n))net2/2M_{Z_n}(t)=\left(1+\frac{t^2}{2n}+o(1/n)\right)^n\to e^{t^2/2}, the MGF of N(0,1)N(0,1); convergence of MGF ⇒ convergence in distribution. (1.5)

(c) SE of Xˉ=(35/12)/100=0.029167=0.17078\bar X=\sqrt{(35/12)/100}=\sqrt{0.029167}=0.17078. z=(3.73.5)/0.17078=1.1711z=(3.7-3.5)/0.17078=1.1711. P(Xˉ>3.7)1Φ(1.171)0.121P(\bar X>3.7)\approx1-\Phi(1.171)\approx0.121. (2)

Question 5 (10)

(a) Pivot Z=Xˉμσ/nN(0,1)Z=\frac{\bar X-\mu}{\sigma/\sqrt n}\approx N(0,1). CI: xˉ±z0.025σn\bar x\pm z_{0.025}\frac{\sigma}{\sqrt n}. σn=90/40=14.230\frac{\sigma}{\sqrt n}=90/\sqrt{40}=14.230; margin =1.96×14.230=27.89=1.96\times14.230=27.89. CI =1180±27.89=(1152.1, 1207.9)=1180\pm27.89=(1152.1,\ 1207.9). (4)

(b) z=1180120014.230=1.4055z=\frac{1180-1200}{14.230}=-1.4055. z<1.96|z|<1.96fail to reject H0H_0. Two-sided p-value =2(1Φ(1.4055))2(0.0799)=0.160=2(1-\Phi(1.4055))\approx2(0.0799)=0.160. (4)

(c) Type I: rejecting H0H_0 (concluding mean ≠ 1200) when in fact μ=1200\mu=1200. Type II: failing to reject H0H_0 when the true mean differs from 1200. (2)

Question 6 (8)

(a) fX(x)=01(x+y)dy=x+12f_X(x)=\int_0^1(x+y)\,dy=x+\frac12, 0<x<10<x<1. (2)

(b) E[X]=01x(x+12)dx=13+14=712E[X]=\int_0^1 x(x+\frac12)dx=\frac13+\frac14=\frac{7}{12}. (1.5) E[XY]=0101xy(x+y)dxdy=(x2y+xy2)=1312+1213=16+16=13E[XY]=\int_0^1\int_0^1 xy(x+y)\,dx\,dy=\int\int(x^2y+xy^2)=\frac13\cdot\frac12+\frac12\cdot\frac13=\frac16+\frac16=\frac13. (1.5)

(c) By symmetry E[Y]=7/12E[Y]=7/12. Cov=13(712)2=1349144=4849144=1144\operatorname{Cov}=\frac13-(\frac{7}{12})^2=\frac13-\frac{49}{144}=\frac{48-49}{144}=-\frac1{144}. Nonzero ⇒ not independent (also ffXfYf\neq f_Xf_Y). (3)

[
{"claim":"Poisson MGF gives mean and variance lambda","code":"t,lam=symbols('t lambda',positive=True); M=exp(lam*(exp(t)-1)); mean=diff(M,t).subs(t,0); m2=diff(M,t,2).subs(t,0); var=simplify(m2-mean**2); result=(simplify(mean-lam)==0 and simplify(var-lam)==0)"},
{"claim":"X=-ln(U)/lam has exponential pdf; E[X]=1/lam","code":"lam,x=symbols('lambda x',positive=True); f=lam*exp(-lam*x); EX=integrate(x*f,(x,0,oo)); result=simplify(EX-1/lam)==0"},
{"claim":"MLE E[1/Xbar]=n/(n-1)*lam so biased","code":"n,lam=symbols('n lambda',positive=True); bias=n/(n-1)*lam-lam; result=simplify(bias-lam/(n-1))==0"},
{"claim":"Cov(X,Y)=-1/144 for f=x+y","code":"x,y=symbols('x y'); f=x+y; EX=integrate(integrate(x*f,(y,0,1)),(x,0,1)); EY=integrate(integrate(y*f,(y,0,1)),(x,0,1)); EXY=integrate(integrate(x*y*f,(y,0,1)),(x,0,1)); cov=simplify(EXY-EX*EY); result=cov==Rational(-1,144)"},
{"claim":"Die CI/z-test: z for Q5b approx -1.4055","code":"z=(1180-1200)/(90/sqrt(40)); result=abs(float(z)+1.40554)<0.01"}
]