margin_of_error

margin_of_error(se, z=Z_95)

Margin of error from a standard error.

z * se, the half-width of a confidence interval. A confidence interval is the estimate plus or minus this margin. z=1.96 gives the standard 95% interval; z=2 reproduces the “two standard errors” rule of thumb often quoted in survey reports; z=2.58 gives 99%. The result is on the same scale as se, so for a proportion error in percentage points, pass se_prop(p, n, pctp=True).

Parameters

Name Type Description Default
se float or list of float A standard error. required
z float The critical value / multiplier. Default 1.96 (95%). Z_95

Returns

Name Type Description
float or pandas.Series The plus-or-minus margin of error, on the same scale as se.

See Also

se_mean, se_prop, diagnose

Examples

>>> margin_of_error(se_prop(0.33, 1184, pctp=True))
>>> margin_of_error(0.02, z=2)