# NOT RUN {
data(city)
data(hh)
## Two-stage cluster design that included 65 PSU.
data(cluster_sample)
cluster_sample2 <- cluster_sample[complete.cases(cluster_sample), c(1:2, 8:10)]
DesignSurvey(sample = cluster_sample2,
psu.ssu = city[, c("track_id", "hh")],
psu.col = 1, ssu.col = 2, psu.2cd = 65,
cal.col = 3, cal.N = sum(hh$persons))
#'
## Simple design.
data(sys_sample)
sys_sample2 <- sys_sample[complete.cases(sys_sample), 7:9]
DesignSurvey(sample = sys_sample[, -c(1:2)], N = sum(city$hh))
## Assuming that systematic_sample is a stratified design.
# Hypothetical strata
strat <- sys_sample2
strat$strat <- sample(c("urban", "rural"), nrow(strat), prob = c(.95, .05),
replace = TRUE)
strat$strat_size <- round(sum(city$hh) * .95)
strat$strat_size[strat$strat == "rural"] <- round(sum(city$hh) * .05)
DesignSurvey(strat, N = "strat_size", strata = "strat")
# }
Run the code above in your browser using DataLab