Skip to contents

Compute the required sample size for estimating a population proportion with a specified margin of error or coefficient of variation.

Usage

n_prop(p, ...)

# Default S3 method
n_prop(
  p,
  moe = NULL,
  cv = NULL,
  alpha = 0.05,
  N = Inf,
  deff = 1,
  resp_rate = 1,
  method = "wald",
  ...
)

# S3 method for class 'svyplan_prec'
n_prop(p, moe = NULL, cv = NULL, ...)

Arguments

p

For the default method: expected proportion, in (0, 1). For svyplan_prec objects: a precision result from prec_prop().

...

Additional arguments passed to methods.

moe

Desired margin of error. Specify exactly one of moe or cv.

cv

Target coefficient of variation. Specify exactly one of moe or cv.

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 sample size is inflated by 1 / resp_rate.

method

One of "wald" (default), "wilson", or "logodds".

Value

A svyplan_n object.

Details

Three confidence interval methods are available:

  • Wald ("wald"): Standard normal approximation (Cochran, 1977, Ch. 3). Supports both moe and cv modes, with optional finite population correction.

  • Wilson ("wilson"): Wilson (1927) score interval. Only moe mode, no FPC.

  • Log-odds ("logodds"): Log-odds (logit) transform interval. Only moe mode, with optional FPC.

For proportions near 0 or 1 (below 0.1 or above 0.9), the Wald interval has poor coverage; method = "wilson" is recommended in those cases.

For the Wilson and log-odds methods, the design effect is applied as a multiplicative factor to the final SRS sample size, which is an approximation.

The Wald FPC uses the Cochran (1977, Ch. 3) form with an N/(N-1) factor to account for the Bernoulli finite-population variance.

All methods use the normal (z) quantile. This is standard for survey sampling where the sample size is large enough for the CLT to apply.

References

Cochran, W. G. (1977). Sampling Techniques (3rd ed.). Wiley.

Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22(158), 209–212.

See also

n_mean() for continuous variables, n_cluster() for multistage designs, n_multi() for multiple indicators, prec_prop() for the inverse.

Examples

# Wald, absolute margin of error
n_prop(p = 0.3, moe = 0.05)
#> Sample size for proportion (wald)
#> n = 323 (p = 0.30, moe = 0.050)

# Wald, target CV with finite population
n_prop(p = 0.5, cv = 0.10, N = 10000)
#> Sample size for proportion (wald)
#> n = 100 (p = 0.50, cv = 0.100)

# Wilson score interval
n_prop(p = 0.1, moe = 0.03, method = "wilson")
#> Sample size for proportion (wilson)
#> n = 388 (p = 0.10, moe = 0.030)

# With design effect and response rate
n_prop(p = 0.3, moe = 0.05, deff = 1.5, resp_rate = 0.8)
#> Sample size for proportion (wald)
#> n = 606 (net: 485) (p = 0.30, moe = 0.050, deff = 1.50, resp_rate = 0.80)