~/ learn/ afm-113/ cards/ Inference for Proportions
1 of 29

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/eb7d59f4-0c1b-4a1d-8e27-284c37a0fde1/flashcard utf-8 LF