Level 5 — MasteryStatistics & Probability — Intermediate

Statistics & Probability — Intermediate

75 minutes60 marksprintable — key stays hidden on paper

LEVEL 5 — Mastery Paper (Cross-domain: Math + Physics + Coding)

Time limit: 75 minutes
Total marks: 60
Instructions: Answer all three questions. Show all reasoning. Proofs must be rigorous; code must be complete and runnable (Python 3, pseudocode acceptable only where stated). Use ...... for mathematics.


Question 1 — Bayes, Detectors, and the Physics of False Positives (20 marks)

A particle physics experiment uses a scintillation detector to flag candidate "signal" events against a "background" of noise. In a given run:

  • The true fraction of signal events among all events is P(S)=0.001P(S) = 0.001.
  • The detector fires ("D") with probability P(DS)=0.98P(D\mid S) = 0.98 on a genuine signal (efficiency).
  • The detector fires on background with probability P(DB)=0.03P(D\mid B) = 0.03 (false-alarm rate).

(a) Starting from the definition of conditional probability, derive Bayes' theorem in the form P(SD)=P(DS)P(S)P(DS)P(S)+P(DB)P(B).P(S\mid D) = \frac{P(D\mid S)\,P(S)}{P(D\mid S)\,P(S) + P(D\mid B)\,P(B)}. State clearly which axiom / law of total probability you use. (4)

(b) Compute P(SD)P(S\mid D) numerically to 3 significant figures. Interpret physically why the "purity" of a flagged sample is so low despite high efficiency. (4)

(c) The team runs a second independent detector with the same characteristics. Assuming the two detectors' firings are conditionally independent given the event type, compute the posterior P(SD1D2)P(S \mid D_1 \cap D_2) when both fire. State precisely the independence assumption used and where it enters. (5)

(d) Write a short Python function posterior(prior, eff, far, n_fires) that returns P(Sn coincident independent firings)P(S\mid n\text{ coincident independent firings}) for nn identical detectors, and use it to find the smallest nn giving posterior 0.99\geq 0.99. Show the recurrence/logic and the final nn. (7)


Question 2 — Binomial Distribution: Radioactive Counting & Estimation (22 marks)

A radioactive sample is monitored. In each fixed 1-second window the probability that a decay is registered by a Geiger counter is modelled as a Bernoulli trial with success probability pp. Over nn independent windows let XX be the number of registered decays, so XBin(n,p)X \sim \text{Bin}(n,p).

(a) From the binomial PMF P(X=k)=(nk)pk(1p)nkP(X=k) = \binom{n}{k}p^k(1-p)^{n-k}, prove that E[X]=npE[X] = np using the identity k(nk)=n(n1k1)k\binom{n}{k} = n\binom{n-1}{k-1}. (5)

(b) Prove that Var(X)=np(1p)\operatorname{Var}(X) = np(1-p). You may use E[X(X1)]=n(n1)p2E[X(X-1)] = n(n-1)p^2; derive that intermediate result. (6)

(c) For n=20n=20, p=0.15p=0.15: compute E[X]E[X], Var(X)\operatorname{Var}(X), and the exact probability P(X2)P(X \leq 2). Give P(X2)P(X\le 2) to 4 significant figures. (5)

(d) An experimenter observes X=6X = 6 decays in n=20n=20 windows and uses the estimator p^=X/n\hat p = X/n. Show p^\hat p is unbiased, give its standard error in terms of p,np,n, and evaluate the numerical standard error using p^\hat p as a plug-in. Comment on how the physicist would report the count rate. (6)


Question 3 — Grouped Data, Dispersion & a Combinatorial Proof (18 marks)

The energies (keV) of 60 detected photons are grouped:

Energy (keV) Frequency
0200\text{–}20 6
204020\text{–}40 14
406040\text{–}60 20
608060\text{–}80 12
8010080\text{–}100 8

(a) Estimate the mean and median (grouped, using the standard interpolation formula), showing the cumulative-frequency working. (6)

(b) Estimate the standard deviation using midpoints (assumed-mean or direct method). Give it to 3 significant figures. (5)

(c) Determine Q1Q_1 and Q3Q_3 (grouped interpolation) and hence the interquartile range. Sketch (describe) the box-and-whisker plot and comment on skew. (4)

(d) Prove the Pascal identity (nr)=(n1r1)+(n1r)\binom{n}{r} = \binom{n-1}{r-1} + \binom{n-1}{r} combinatorially (not algebraically), and state how it generates one row of Pascal's triangle from the previous. (3)


Answer keyMark scheme & solutions

Question 1

(a) Derivation. (4)

By definition of conditional probability (from Kolmogorov axioms, with P(D)>0P(D)>0): P(SD)=P(SD)P(D),P(SD)=P(DS)P(S). (1 mark)P(S\mid D)=\frac{P(S\cap D)}{P(D)},\qquad P(S\cap D)=P(D\mid S)P(S).\ \text{(1 mark)} By the law of total probability, since {S,B}\{S,B\} partition the sample space (B=ScB=S^c): P(D)=P(DS)P(S)+P(DB)P(B). (2 marks)P(D)=P(D\mid S)P(S)+P(D\mid B)P(B).\ \text{(2 marks)} Substituting: P(SD)=P(DS)P(S)P(DS)P(S)+P(DB)P(B). (1 mark)P(S\mid D)=\frac{P(D\mid S)P(S)}{P(D\mid S)P(S)+P(D\mid B)P(B)}.\ \text{(1 mark)}

(b) (4) With P(B)=0.999P(B)=0.999:

  • Numerator =0.98×0.001=0.00098=0.98\times0.001 = 0.00098. (1)
  • Denominator =0.00098+0.03×0.999=0.00098+0.02997=0.03095=0.00098 + 0.03\times0.999 = 0.00098 + 0.02997 = 0.03095. (1)
  • P(SD)=0.00098/0.03095=0.031670.0317P(S\mid D)=0.00098/0.03095 = 0.03167\approx \mathbf{0.0317} (3 s.f.). (1)

Interpretation: Signals are extremely rare (0.1%0.1\%), so even a small false-alarm rate (3%3\%) applied to the vast background produces far more false firings (0.03\approx0.03) than true firings (0.001\approx0.001). High efficiency cannot overcome a low base rate — purity is dominated by the prior. (1)

(c) (5) Conditional independence assumption: given the event type (SS or BB), D1D_1 and D2D_2 are independent, so P(D1D2S)=P(DS)2=0.982=0.9604,P(D_1\cap D_2\mid S)=P(D\mid S)^2=0.98^2=0.9604, P(D1D2B)=P(DB)2=0.032=0.0009.P(D_1\cap D_2\mid B)=P(D\mid B)^2=0.03^2=0.0009. (2, for stating & using assumption)

Bayes again: P(SD1D2)=0.9604×0.0010.9604×0.001+0.0009×0.999=0.00096040.0009604+0.0008991.P(S\mid D_1D_2)=\frac{0.9604\times0.001}{0.9604\times0.001+0.0009\times0.999}=\frac{0.0009604}{0.0009604+0.0008991}. (2) Denominator =0.0018595=0.0018595; ratio =0.0009604/0.0018595=0.51650.516=0.0009604/0.0018595=\mathbf{0.5165}\approx0.516. (1) (Coincidence requirement dramatically raises purity from 3% to ~52%.)

(d) (7) Logic: for nn identical conditionally-independent detectors all firing, P(Sn)=(eff)nprior(eff)nprior+(far)n(1prior).P(S\mid n)=\frac{(\text{eff})^n\cdot\text{prior}}{(\text{eff})^n\cdot\text{prior}+(\text{far})^n\cdot(1-\text{prior})}.

def posterior(prior, eff, far, n_fires):
    like_s = eff**n_fires * prior
    like_b = far**n_fires * (1 - prior)
    return like_s / (like_s + like_b)
 
n = 1
while posterior(0.001, 0.98, 0.03, n) < 0.99:
    n += 1
print(n, posterior(0.001, 0.98, 0.03, n))

Checking:

  • n=2n=2: 0.5160.516;
  • n=3n=3: like_s =0.983(0.001)=9.412×104=0.98^3(0.001)=9.412\times10^{-4}, like_b =0.033(0.999)=2.697×105=0.03^3(0.999)=2.697\times10^{-5}; posterior =9.412e-4/(9.412e-4+2.697e-5)=0.9721=9.412\text{e-}4/(9.412\text{e-}4+2.697\text{e-}5)=0.9721.
  • n=4n=4: like_b =0.034(0.999)=8.09×107=0.03^4(0.999)=8.09\times10^{-7}, like_s =0.984(0.001)=9.224e-4=0.98^4(0.001)=9.224\text{e-}4; posterior =0.999120.99=0.99912\ge0.99. ✓

Smallest n=4\mathbf{n=4}. (Marks: function 3, recurrence logic 2, correct n=4n=4 with working 2.)


Question 2

(a) (5) E[X]=k=0nk(nk)pkqnk, q=1p.E[X]=\sum_{k=0}^n k\binom nk p^k q^{n-k},\ q=1-p. k=0k=0 term vanishes. Use k(nk)=n(n1k1)k\binom nk=n\binom{n-1}{k-1} (1): =k=1nn(n1k1)pkqnk=npk=1n(n1k1)pk1qnk. (2)=\sum_{k=1}^n n\binom{n-1}{k-1}p^k q^{n-k}=np\sum_{k=1}^n\binom{n-1}{k-1}p^{k-1}q^{n-k}.\ (2) Let j=k1j=k-1: =npj=0n1(n1j)pjq(n1)j=np(p+q)n1=np.=np\sum_{j=0}^{n-1}\binom{n-1}{j}p^{j}q^{(n-1)-j}=np(p+q)^{n-1}=np. (2)

(b) (6) Compute E[X(X1)]=k(k1)(nk)pkqnkE[X(X-1)]=\sum k(k-1)\binom nk p^k q^{n-k}. Using k(k1)(nk)=n(n1)(n2k2)k(k-1)\binom nk=n(n-1)\binom{n-2}{k-2} (2): =n(n1)p2k=2n(n2k2)pk2qnk=n(n1)p2(p+q)n2=n(n1)p2. (2)=n(n-1)p^2\sum_{k=2}^n\binom{n-2}{k-2}p^{k-2}q^{n-k}=n(n-1)p^2(p+q)^{n-2}=n(n-1)p^2.\ (2) Then E[X2]=E[X(X1)]+E[X]=n(n1)p2+npE[X^2]=E[X(X-1)]+E[X]=n(n-1)p^2+np. (1) Var(X)=E[X2](E[X])2=n(n1)p2+npn2p2=npnp2=np(1p). (1)\operatorname{Var}(X)=E[X^2]-(E[X])^2=n(n-1)p^2+np-n^2p^2=np-np^2=np(1-p).\ (1)

(c) (5) n=20,p=0.15,q=0.85n=20,p=0.15,q=0.85:

  • E[X]=20(0.15)=3E[X]=20(0.15)=\mathbf{3}. (1)
  • Var=20(0.15)(0.85)=2.55\operatorname{Var}=20(0.15)(0.85)=\mathbf{2.55}. (1)
  • P(X2)=k=02(20k)0.15k0.8520kP(X\le2)=\sum_{k=0}^2\binom{20}{k}0.15^k0.85^{20-k}:
    • k=0k=0: 0.8520=0.0387600.85^{20}=0.038760
    • k=1k=1: 20(0.15)(0.8519)=20(0.15)(0.045599)=0.13679620(0.15)(0.85^{19})=20(0.15)(0.045599)=0.136796
    • k=2k=2: 190(0.0225)(0.8518)=190(0.0225)(0.053646)=0.229334190(0.0225)(0.85^{18})=190(0.0225)(0.053646)=0.229334
    • Sum =0.4048900.4049=0.404890\approx\mathbf{0.4049} (4 s.f.). (3)

(d) (6) E[p^]=E[X/n]=np/n=pE[\hat p]=E[X/n]=np/n=p ⇒ unbiased. (2) Var(p^)=Var(X)/n2=np(1p)/n2=p(1p)/n\operatorname{Var}(\hat p)=\operatorname{Var}(X)/n^2=np(1-p)/n^2=p(1-p)/n, so SE =p(1p)/n=\sqrt{p(1-p)/n}. (2) Plug-in p^=6/20=0.3\hat p=6/20=0.3: SE =0.3×0.7/20=0.0105=0.10250.102=\sqrt{0.3\times0.7/20}=\sqrt{0.0105}=0.1025\approx\mathbf{0.102}. (1) Report: count rate p^=0.30±0.10\hat p=0.30\pm0.10 decays per window (i.e. state estimate with its standard error / confidence interval, noting the large relative uncertainty from small nn). (1)


Question 3

(a) (6) Midpoints: 10,30,50,70,90; ff: 6,14,20,12,8; f=60\sum f=60. fx=60+420+1000+840+720=3040\sum fx = 60+420+1000+840+720=3040. Mean =3040/60=50.67=3040/60=\mathbf{50.67} keV. (2)

Cumulative freq: 6, 20, 40, 52, 60. N/2=30N/2=30 ⇒ median class 406040\text{–}60 (L=40L=40, CF=20CF=20, f=20f=20, h=20h=20). (2) Median=40+302020×20=40+10=50 keV. (2)\text{Median}=40+\frac{30-20}{20}\times20=40+10=\mathbf{50}\text{ keV}.\ (2)

(b) (5) fx2=6(100)+14(900)+20(2500)+12(4900)+8(8100)\sum fx^2 = 6(100)+14(900)+20(2500)+12(4900)+8(8100) =600+12600+50000+58800+64800=186800=600+12600+50000+58800+64800=186800. Variance =186800/60(50.667)2=3113.332567.11=546.22=186800/60 - (50.667)^2 = 3113.33 - 2567.11 = 546.22. (3) SD =546.22=23.3723.4=\sqrt{546.22}=23.37\approx\mathbf{23.4} keV (3 s.f.). (2)

(c) (4) Q1Q_1: position N/4=15N/4=15 → class 204020\text{–}40 (L=20,CF=6,f=14,h=20L=20,CF=6,f=14,h=20): Q1=20+15614×20=20+12.857=32.86Q_1=20+\frac{15-6}{14}\times20=20+12.857=\mathbf{32.86} keV. (1.5) Q3Q_3: position 3N/4=453N/4=45 → class 608060\text{–}80 (L=60,CF=40,f=12,h=20L=60,CF=40,f=12,h=20): Q3=60+454012×20=60+8.333=68.33Q_3=60+\frac{45-40}{12}\times20=60+8.333=\mathbf{68.33} keV. (1.5) IQR=68.3332.86=35.48\text{IQR}=68.33-32.86=\mathbf{35.48} keV. Box from 32.86 to 68.33, median line at 50 (≈ centred, slightly left), whiskers to 0 and 100. Since median (5050) is near the box centre and mean (50.6750.67)≈median, distribution is nearly symmetric with very slight right skew. (1)

(d) (3) Combinatorial proof: (nr)\binom nr counts rr-subsets of an nn-set. Fix element xx. Every rr-subset either contains xx — choose the remaining r1r-1 from the other n1n-1 elements: (n1r1)\binom{n-1}{r-1} ways — or excludes xx — choose all rr from the other n1n-1: (n1r)\binom{n-1}{r} ways. These cases are disjoint and exhaustive, so by the addition rule (nr)=(n1r1)+(n1r)\binom nr=\binom{n-1}{r-1}+\binom{n-1}{r}. (2) This is exactly the rule that each entry in a Pascal-triangle row equals the sum of the two entries above it in the previous row, generating row nn from row n1n-1. (1)

[
  {"claim":"Q1b single-detector posterior ~0.0317",
   "code":"num=Rational(98,100)*Rational(1,1000); den=num+Rational(3,100)*Rational(999,1000); val=float(num/den); result = abs(val-0.0317)<0.001"},
  {"claim":"Q1d smallest n with posterior>=0.99 is 4",
   "code":"def post(n):\n    ls=(0.98**n)*0.001; lb=(0.03**n)*0.999; return ls/(ls+lb)\nn=1\nwhile post(n)<0.99:\n    n+=1\nresult = (n==4)"},
  {"claim":"Q2c P(X<=2)=0.4049 for Bin(20,0.15)",
   "code":"p=Rational(15,100); tot=sum(binomial(20,k)*p**k*(1-p)**(20-k) for k in range(3)); result = abs(float(tot)-0.4049)<0.0005"},
  {"claim":"Q3 mean=50.667, median=50, SD~23.4",
   "code":"import math\nf=[6,14,20,12,8]; x=[10,30,50,70,90]; N=sum(f)\nmean=sum(fi*xi for fi,xi in zip(f,x))/N\nvar=sum(fi*xi*xi for fi,xi in zip(f,x))/N-mean**2\nsd=math.sqrt(var)\nresult = abs(mean-50.667)<0.01 and abs(sd-23.37)<0.1"}
]