~/ learn/ afm-113/ cards/ p̂ and its confidence interval
1 of 6

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

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/b45bc783-61a7-46b5-9a20-39bfb9fa65b1/flashcard utf-8 LF