# Using a pilot sample from a population with 10000 sampling units.
strata <- rep(c('Rural', 'Urban'), c(100, 9900))
pilot.sample <- data.frame(c(rpois(5, 1.3), rpois(45, 0.8)),
rep(c('Rural', 'Urban'), c(5, 45)))
CalculateStratifiedSampleSize(strata, pilot.sample)
# 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))
Run the code above in your browser using DataLab