For X ~ Bin(100, 0.30), compare the exact P(X ≤ 25) and P(X ≥ 36) with the normal approximation (z rounded to two decimals), with and without the ±0.5 correction.
For X ~ Bin(100, 0.30), compare the exact P(X ≤ 25) and P(X ≥ 36) with the normal approximation (z rounded to two decimals), with and without the ±0.5 correction.
Answer
import math def phi(z): return 0.5 * (1 + math.erf(z / math.sqrt(2))) n, p = 100, 0.30 mu, sigma = n * p, math.sqrt(n * p * (1 - p)) pmf = lambda k: math.comb(n, k) * p ** k * (1 - p) ** (n - k) exact_le25 = sum(pmf(k) for k in range(26)) approx_le25 = phi(round((25.5 - mu) / sigma, 2)) no_corr = phi(round((25 - mu) / sigma, 2)) print(f"exact P(X<=25)={exact_le25:.4f} approx={approx_le25:.4f} no-correction={no_corr:.4f}") exact_ge36 = 1 - sum(pmf(k) for k in range(36)) approx_ge36 = 1 - phi(round((35.5 - mu) / sigma, 2)) print(f"exact P(X>=36)={exact_ge36:.4f} approx={approx_ge36:.4f}")
IS1 §7.3 (the approximation with the ±0.5 correction), IBS1 §6.3 (the conditions; no correction — the contrast), CC BY 4.0 — shape only; original dataset