Compute the required sample size for estimating a population mean with a specified margin of error or coefficient of variation.
Usage
n_mean(var, ...)
# Default S3 method
n_mean(
var,
mu = NULL,
moe = NULL,
cv = NULL,
alpha = 0.05,
N = Inf,
deff = 1,
resp_rate = 1,
...
)
# S3 method for class 'svyplan_prec'
n_mean(var, moe = NULL, cv = NULL, ...)Arguments
- var
For the default method: population variance \(S^2\). For
svyplan_precobjects: a precision result fromprec_mean().- ...
Additional arguments passed to methods.
- mu
Population mean magnitude (positive). Required when
cvis specified.- moe
Desired margin of error. Specify exactly one of
moeorcv.- cv
Target coefficient of variation. Specify exactly one of
moeorcv.- 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.
Details
Two modes:
MOE mode:
n = z^2 * var / (moe^2 + z^2 * var / N), then multiplied bydeff.CV mode: Computes
CVpop = sqrt(var) / mu, thenn = CVpop^2 / (cv^2 + CVpop^2 / N), multiplied bydeff.
The FPC is the standard Cochran (1977) one-step form. Unlike n_prop(),
no N/(N-1) adjustment is needed because var is already defined on
N-1 degrees of freedom.
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.
Valliant, R., Dever, J. A., and Kreuter, F. (2018). Practical Tools for Designing and Weighting Survey Samples (2nd ed.). Springer.
See also
n_prop() for proportions, n_cluster() for multistage designs,
n_multi() for multiple indicators, prec_mean() for the inverse.
Examples
# MOE mode
n_mean(var = 100, moe = 2)
#> Sample size for mean
#> n = 97 (var = 100.00, moe = 2.000)
# CV mode
n_mean(var = 100, mu = 50, cv = 0.05)
#> Sample size for mean
#> n = 16 (var = 100.00, cv = 0.050)
# With FPC, design effect, and response rate
n_mean(var = 100, moe = 2, N = 5000, deff = 1.5, resp_rate = 0.8)
#> Sample size for mean
#> n = 177 (net: 142) (var = 100.00, moe = 2.000, deff = 1.50, resp_rate = 0.80)