Cochran's two-step form: compute n_0 ignoring the population size,
then correct it. Both are returned.
Usage
Nsamp(e, S, N = Inf, level = 0.95)
Arguments
- e
Desired half-width of the confidence interval, e > 0.
- S
Population standard deviation (an advance estimate).
- N
Population size; Inf for the infinite-population case.
- level
Confidence level.
Value
List with n, n0, z, e, S,
N.
Details
Formula: n_0 = z^2 S^2 / e^2; n = n_0 / (1 + n_0/N), rounded up
References
Cochran (1977), Sampling Techniques, 3rd edition, Chapter
4: n_0 = z^2 S^2 / e^2 with the correction n = n_0/(1 + n_0/N).
Cross-checked against the reference implementation in the CRAN
package samplingbook 1.2.4, whose sample.size.mean computes
S^2 / (e^2/q^2 + S^2/N) – the same quantity rearranged.
Examples
Nsamp(e = 2, S = 10)$n
#> [1] 97
Nsamp(e = 2, S = 10, N = 500)$n
#> [1] 81