CalculateStratifiedSampleSize {capm}R Documentation

Stratified random sample size


Calculates sample size to estimate a total from a stratified random sampling design.


CalculateStratifiedSampleSize(strata = NULL, x = NULL,
  conf.level = 0.95, error = 0.1)



vector, matrix or data.frame. If vector, named elements represent the size of the strata. If matrix or data.frame, first column represent the size of each strata, second column represent the expected mean in each strata and third column represent the expected variance in each strata. Each row is a strata and must be named.


data.frame representing a pilot sample. First column has the variable to be estimated and second column has the strata membership of each observation. Needed when strata is a vector.


the confidence level required. It must be numeric between 0 and 1 inclusive.


the maximum relative difference between the estimate and the unknown population value. It must be numeric between 0 and 1 inclusive.


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.


# 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))

[Package capm version 0.14.0 Index]