se_prop
se_prop(p, n, pctp=False)Standard error of a proportion.
sqrt(p * (1 - p) / n), the sampling error of a percentage. It is largest when p = 0.5 (a 50/50 split is the hardest to pin down) and shrinks towards the extremes. The result is on the same 0-1 scale as a fractional p; pass pctp=True for percentage points, the form used in report footnotes and the one margin_of_error() needs if you want the margin in points. Inputs above 1 are treated as percentages and divided by 100, so se_prop(33, n) and se_prop(0.33, n) agree.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| p | float or list of float | The proportion, as a fraction in [0, 1] or a percentage in (1, 100]. | required |
| n | int or list of int | The sample size (number of respondents). | required |
| pctp | bool | Return the answer in percentage points instead of on the [0, 1] proportion scale. Default False. | False |
Returns
| Name | Type | Description |
|---|---|---|
| float or pandas.Series | The standard error of the proportion. |
See Also
se_mean, rse, margin_of_error, diagnose
Examples
>>> se_prop(0.33, 1184)
>>> se_prop(0.33, 1184, pctp=True)