Description Usage Arguments Value References Examples
View source: R/CalculateSimpleSampleSize.R
Calculates sample size to estimate a total from a simple sampling design.
1 2 | CalculateSimpleSampleSize(x = NULL, N = NULL, conf.level = 0.95,
error = 0.1)
|
x |
|
N |
|
conf.level |
the confidence level required. It must be |
error |
the maximum relative difference between the estimate and the unknown population value. It must be |
numeric sample size rounded up to nearest integer.
Levy P and Lemeshow S (2008). Sampling of populations: methods and applications, Fourth edition. John Wiley and Sons, Inc.
http://oswaldosantos.github.io/capm
1 2 3 4 5 6 7 8 9 10 11 12 | # Using a pilot sample from a population with 10000 sampling units.
pilot <- rpois(50, 0.8)
CalculateSimpleSampleSize(x = pilot, N = 10000,
conf.level = 0.95, error = 0.1)
# Using expected mean and standard deviation for a population
# with 10000 sampling units.
mean_x <- mean(pilot)
sd_x <- sd(pilot)
N <- 10000
V <- ((N - 1) / N * sd_x^2) / mean_x^2
CalculateSimpleSampleSize(x = V, N = 10000, conf.level = 0.95, error = 0.1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.