CalculateStratifiedSampleSize {capm}  R Documentation 
Stratified random sample size
Description
Calculates sample size to estimate a total from a stratified random sampling design.
Usage
CalculateStratifiedSampleSize(strata = NULL, x = NULL,
conf.level = 0.95, error = 0.1)
Arguments
strata 

x 

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 
Value
numeric sample size rounded up to nearest integer.
References
Levy P and Lemeshow S (2008). Sampling of populations: methods and applications, Fourth edition. John Wiley and Sons, Inc.
http://oswaldosantos.github.io/capm
Examples
# Using a pilot sample from a population with 10000 sampling units.
strata < rep(c("rural", "urban"), c(100, 9900))
pilot < data.frame(c(rpois(5, 1.3), rpois(45, 0.8)),
rep(c("rural", "urban"), c(5, 45)))
CalculateStratifiedSampleSize(strata, pilot)
# Using expected mean and variance for a population with
# 10000 sampling units.
str_n < c(rural = 100, urban = 9900)
str_mean < c(rural = 1.4, urban = 0.98)
str_var < c(rural = 1.48, urban = 1.02)
CalculateStratifiedSampleSize(cbind(str_n, str_mean, str_var))