Compute the sampling error (SE, margin of error, CV) for estimating a
population proportion given a sample size. This is the inverse of
n_prop().
Usage
prec_prop(p, ...)
# Default S3 method
prec_prop(
p,
n,
alpha = 0.05,
N = Inf,
deff = 1,
resp_rate = 1,
method = "wald",
...
)
# S3 method for class 'svyplan_n'
prec_prop(p, ...)Arguments
- p
For the default method: expected proportion, in (0, 1). For
svyplan_nobjects: a sample size result fromn_prop().- ...
Additional arguments passed to methods.
- n
Sample size.
- alpha
Significance level, default 0.05.
- N
Population size.
Inf(default) means no finite population correction.- deff
Design effect multiplier (> 0). Values < 1 are valid for efficient designs (e.g., stratified sampling with Neyman allocation).
- resp_rate
Expected response rate, in (0, 1]. Default 1 (no adjustment). The effective sample size is deflated by
resp_rate.- method
One of
"wald"(default),"wilson", or"logodds".
Details
Computes the standard error for the given sample size and design
parameters, then derives the margin of error and coefficient of
variation. The effective sample size is n * resp_rate / deff, with
optional finite population correction.
The Wald FPC uses the Cochran (1977, Ch. 3) form: the finite-population
correction for a Bernoulli proportion is (N - n_eff) / (N - 1), not
the simpler 1 - n_eff / N used for means.
See also
n_prop() for the inverse (compute n from a precision target),
prec_mean() for continuous variables.
Examples
# Precision with n = 400
prec_prop(p = 0.3, n = 400)
#> Sampling precision for proportion (wald)
#> n = 400
#> se = 0.0229, moe = 0.0449, cv = 0.0764
# With design effect and response rate
prec_prop(p = 0.3, n = 400, deff = 1.5, resp_rate = 0.8)
#> Sampling precision for proportion (wald)
#> n = 400 (net: 320)
#> se = 0.0314, moe = 0.0615, cv = 0.1046