From 60 errors in 500 invoices, compute p̂, its standard error with p̂ in the formula, and the 95 % interval with z = 1.96.
From 60 errors in 500 invoices, compute p̂, its standard error with p̂ in the formula, and the 95 % interval with z = 1.96.
Answer
import math x, n = 60, 500 phat = x / n se = math.sqrt(phat * (1 - phat) / n) margin = 1.96 * se print(f"phat={phat:.4f} SE={se:.4f} 95% CI: {phat - margin:.4f} to {phat + margin:.4f}")
IBS1 §8.3 (confidence interval for a proportion), CC BY 4.0; BCc ch 3; original dataset