inputs <- gmb_inputs()
lga_rse <- function(eas) {
rows <- inputs |>
mutate(lga, name = "mcpr", p = mcpr, deff = deff_model,
eligibility_rate = in_scope, resp_rate = resp_in_scope,
eligible_per_unit = married_hh, n = 25 * eas[lga], .keep = "none")
precision <- prec_multi(rows, domains = "lga")$detail
setNames(precision$.cv, precision$lga)
}
national_rse <- function(eas) {
w <- inputs$N * inputs$married_hh
w <- w / sum(w)
se <- lga_rse(eas)[inputs$lga] * inputs$mcpr
sqrt(sum(w^2 * se^2)) / sum(w * inputs$mcpr)
}
inputs |>
select(lga, N, married_hh, deff_model, in_scope, resp_in_scope) |>
mutate(across(c(married_hh, deff_model, in_scope, resp_in_scope),
\(x) round(x, 2))) |>
print(row.names = FALSE)
#> lga N married_hh deff_model in_scope resp_in_scope
#> Banjul 6600 0.59 1.18 0.96 0.88
#> Kanifing 65218 0.90 1.28 0.96 0.86
#> Brikama 148137 1.23 1.59 0.98 0.93
#> Mansakonko 11853 1.15 1.88 0.97 0.96
#> Kerewan 27773 1.37 1.99 0.97 0.94
#> Kuntaur 11278 1.80 2.55 0.96 0.96
#> Janjanbureh 15646 1.50 2.18 0.98 0.96
#> Basse 24608 2.30 2.57 0.94 0.9410 Allocation across domains and strata
Chapter 9 sized each LGA for an RSE of 10% on mCPR and arrived at 290 EAs. Each LGA received what its own target needs, whatever its size. The virtual survey of Chapter 8 showed the consequence for the national estimate. Mansakonko, with 4% of the households, receives more EAs than Brikama, with 48%, and a household of Brikama stands for many more households than one of Mansakonko. The national estimate loses precision to these unequal weights.
How should a total be shared among domains and strata? This is the sixth decision of Figure 1.1. The answer depends on which estimates matter, and most surveys need two kinds at once: each domain on its own and the country as a whole.
10.1 Four rules
A total of \(n\) units is shared among \(H\) strata of sizes \(N_h\). \[ \begin{aligned} \text{Equal} \quad & n_h = n / H \\ \text{Proportional} \quad & n_h = n \, N_h / N \\ \text{Power} \quad & n_h = n \, N_h^q \Big/ \sum_k N_k^q, \quad 0 \le q \le 1 \\ \text{Neyman} \quad & n_h = n \, N_h S_h \Big/ \sum_k N_k S_k \end{aligned} \] \(S_h\) is the standard deviation of the variable in stratum \(h\). The power rule of Bankier (1988) runs from equal allocation at \(q = 0\) to proportional allocation at \(q = 1\).
Equal allocation gives every domain about the same precision. Proportional allocation gives every household the same weight, which is the best for the national estimate when the strata are alike. Neyman allocation is the best for the national estimate when the strata differ in their spread. The power rule is the DHS manual’s compromise between the first two (ICF International 2012).
The national estimate combines the LGA estimates, each weighted by its share of the population the indicator covers.
When domain \(h\) holds a share \(W_h\) of the eligible population and its estimate \(\hat P_h\) has standard error \(\mathrm{SE}_h\), and the domains are sampled independently, \[ \hat P = \sum_h W_h \hat P_h, \qquad \mathrm{SE}(\hat P) = \sqrt{\sum_h W_h^2 \, \mathrm{SE}_h^2}. \]
For mCPR, the eligible population of an LGA is its married women, the households of the frame times the married women per household.
The table holds what the two functions read for each LGA. N is the households of the 2024 frame and married_hh the married women per household, whose product weights the LGA in the national estimate. deff_model is the design effect of Chapter 9 at a take of 25, and the last two columns are the response of Chapter 7.
10.2 Equal, proportional and in between
The 290 EAs of Chapter 9 can be shared by any of the rules. Each LGA keeps a floor (the EAs its 800 interviews with women need), printed first below. Banjul’s floor is the only one that binds, since its households hold the fewest women. n_alloc() applies the power rule with alloc = "power", from the households of each LGA alone.
floors <- with(inputs, setNames(ceiling(800 / (25 * women_hh * resp)), lga))
floors
#> Banjul Kanifing Brikama Mansakonko Kerewan
#> 34 23 17 21 19
#> Kuntaur Janjanbureh Basse
#> 16 18 13
power_eas <- function(q, total = 290) {
fit <- n_alloc(data.frame(stratum = inputs$lga, N = inputs$N,
min_n_stratum = floors[inputs$lga]),
n = total, alloc = "power", alloc_q = q)
setNames(fit$detail$n_int, fit$detail$stratum)
}
quota_eas <- c(Banjul = 35, Kanifing = 37, Brikama = 24, Mansakonko = 42,
Kerewan = 25, Kuntaur = 38, Janjanbureh = 29, Basse = 60)
rules <- list(quota = quota_eas, equal = power_eas(0),
power_25 = power_eas(0.25), power_50 = power_eas(0.5),
proportional = power_eas(1))
sapply(rules, \(e) e[inputs$lga])
#> quota equal power_25 power_50 proportional
#> Banjul 35 37 34 34 34
#> Kanifing 37 37 44 50 49
#> Brikama 24 36 54 76 112
#> Mansakonko 42 36 29 21 21
#> Kerewan 25 36 36 33 21
#> Kuntaur 38 36 28 21 16
#> Janjanbureh 29 36 31 24 18
#> Basse 60 36 34 31 19
sapply(rules, \(e) c(worst_lga = max(lga_rse(e)), national = national_rse(e))) |>
round(3)
#> quota equal power_25 power_50 proportional
#> worst_lga 0.100 0.129 0.133 0.140 0.177
#> national 0.056 0.047 0.040 0.036 0.034The quotas of Chapter 9 hold every LGA at 10% and leave the national RSE at 5.6%. A proportional allocation brings the national RSE down to 3.4%, and lets the worst LGA rise to 17.7%. The power rule moves between the two as \(q\) goes from 0 to 1.
frontier <- tibble(q = seq(0, 1, by = 0.125)) |>
rowwise() |>
mutate(worst = max(lga_rse(power_eas(q))),
national = national_rse(power_eas(q))) |>
ungroup()
ggplot(frontier, aes(100 * national, 100 * worst)) +
geom_path(color = "grey60") +
geom_point(color = "#1f5f99", size = 2) +
geom_text(aes(label = q), nudge_y = 0.4, size = 3) +
annotate("point", x = 100 * national_rse(quota_eas),
y = 100 * max(lga_rse(quota_eas)), shape = 17, size = 3) +
annotate("text", x = 100 * national_rse(quota_eas),
y = 100 * max(lga_rse(quota_eas)) + 0.5, label = "quotas",
size = 3) +
labs(x = "National RSE (%)", y = "Worst LGA RSE (%)") +
theme_minimal(base_size = 11)
No point of the curve meets both a 10% target in every LGA and a national RSE near 4%. At a fixed total, precision taken from the small LGAs goes to Brikama and Kanifing, and the reverse. The choice of \(q\) is a choice of how much of one to give up for the other.
10.3 Two targets at once
A power rule shares a total that was fixed beforehand. The question can be turned around. GBoS states every target it needs, 10% in each LGA and 4% nationally, and asks for the cheapest allocation that meets them all. This is joint allocation, and n_alloc_joint() solves it from three tables.
gmb_synthetic <- readRDS("data/gmb_synthetic.rds")
icc <- gmb_icc()
strata <- gmb_synthetic$clusters |>
summarise(N = sum(households), N_1 = n(), .by = c(lga, urban_rural)) |>
mutate(stratum = paste(lga, urban_rural), take_2 = 25,
cost_1 = 40, cost_2 = 1,
min_n_stratum = if_else(lga == "Banjul", 25 * floors[lga], 50)) |>
left_join(select(inputs, lga, eligibility_rate = in_scope), by = "lga")
measures <- strata |>
left_join(select(inputs, lga, p = mcpr, eligible_per_unit = married_hh,
resp_rate = resp_in_scope), by = "lga") |>
mutate(stratum, name = "mcpr", p, eligible_per_unit, resp_rate,
icc_1 = icc[urban_rural], var_ratio_1 = 1, .keep = "none")
targets <- bind_rows(
tibble(name = "mcpr", domain = ".overall", level = NA, cv = 0.04),
tibble(name = "mcpr", domain = "lga", level = inputs$lga, cv = 0.10)
)
joint <- n_alloc_joint(as.data.frame(strata), measures = measures,
targets = targets,
min_n_stratum = strata$min_n_stratum)
joint_eas <- joint$detail |>
summarise(eas = sum(n_1_int), .by = lga) |>
pull(eas, name = lga)
sum(joint_eas)
#> [1] 307The frame has one row per stratum, with its households, its clusters and its floor in households. The measures have one row per stratum for the single indicator, here mCPR, with a variance ratio of 1 left out of the print. The targets have one row for the country and one per LGA.
strata |>
select(stratum, N, N_1, min_n_stratum, eligibility_rate) |>
mutate(eligibility_rate = round(eligibility_rate, 3)) |>
head(4)
#> stratum N N_1 min_n_stratum eligibility_rate
#> 1 Banjul Urban 6600 93 850 0.956
#> 2 Basse Rural 15848 353 50 0.941
#> 3 Basse Urban 8760 139 50 0.941
#> 4 Brikama Rural 38381 698 50 0.975
measures |>
select(-name, -var_ratio_1) |>
mutate(across(where(is.numeric), \(x) round(x, 3))) |>
head(4)
#> stratum p eligible_per_unit resp_rate icc_1
#> 1 Banjul Urban 0.217 0.588 0.879 0.016
#> 2 Basse Rural 0.078 2.302 0.940 0.040
#> 3 Basse Urban 0.078 2.302 0.940 0.016
#> 4 Brikama Rural 0.197 1.228 0.929 0.040
targets
#> # A tibble: 9 × 4
#> name domain level cv
#> <chr> <chr> <chr> <dbl>
#> 1 mcpr .overall <NA> 0.04
#> 2 mcpr lga Banjul 0.1
#> 3 mcpr lga Kanifing 0.1
#> 4 mcpr lga Brikama 0.1
#> 5 mcpr lga Mansakonko 0.1
#> 6 mcpr lga Kerewan 0.1
#> 7 mcpr lga Kuntaur 0.1
#> 8 mcpr lga Janjanbureh 0.1
#> 9 mcpr lga Basse 0.1Each stratum takes 25 households per cluster, so the frame gives the clusters of each stratum and the take, and the measures give the correlation of Chapter 9. The frame also carries the share of selected households in scope in each LGA, Chapter 7, so that the allocation weights each stratum by its households in scope. The costs only state that a cluster costs as much as 40 interviews, and they matter little here, since every cluster has the same take. Every requirement is met. In the table below, .achieved is the RSE the allocation reaches and .binding marks the targets it meets exactly.
joint$constraints |>
select(constraint, .target, .achieved, .binding) |>
mutate(.achieved = round(.achieved, 4))
#> constraint .target .achieved .binding
#> 1 mcpr@.overall:cv 0.04 0.0400 TRUE
#> 2 mcpr@lga=Banjul:cv 0.10 0.0948 FALSE
#> 3 mcpr@lga=Kanifing:cv 0.10 0.1000 TRUE
#> 4 mcpr@lga=Brikama:cv 0.10 0.0639 FALSE
#> 5 mcpr@lga=Mansakonko:cv 0.10 0.1000 TRUE
#> 6 mcpr@lga=Kerewan:cv 0.10 0.1000 TRUE
#> 7 mcpr@lga=Kuntaur:cv 0.10 0.1000 TRUE
#> 8 mcpr@lga=Janjanbureh:cv 0.10 0.1000 TRUE
#> 9 mcpr@lga=Basse:cv 0.10 0.1000 TRUEThe optimizer needs 307 EAs. The table sets its EAs by LGA beside the quotas.
tibble(lga = inputs$lga, quotas = quota_eas[inputs$lga],
joint = joint_eas[inputs$lga]) |>
mutate(difference = joint - quotas)
#> # A tibble: 8 × 4
#> lga quotas joint difference
#> <chr> <dbl> <dbl> <dbl>
#> 1 Banjul 35 34 -1
#> 2 Kanifing 37 36 -1
#> 3 Brikama 24 56 32
#> 4 Mansakonko 42 38 -4
#> 5 Kerewan 25 25 0
#> 6 Kuntaur 38 35 -3
#> 7 Janjanbureh 29 27 -2
#> 8 Basse 60 56 -4Every LGA but Brikama receives about what its own 10% asks, which is a few EAs fewer than the quotas where the optimizer splits urban and rural better than a proportional rule. Brikama receives 56 EAs instead of 24, enough to bring the national RSE to 4%. The national target is met by adding to the largest LGA, not by taking from the small ones. GBoS can have both targets for 26 EAs more than the 281 of 2019-20.
10.4 Splitting an LGA between urban and rural
Within an LGA, the DHS manual recommends a proportional split between urban and rural parts, the best for the LGA as a whole when nothing else is known (ICF International 2012). The joint allocation splits each LGA itself, and its split is close to proportional. Kish’s factor within each LGA measures the difference.
joint$detail |>
summarise(kish = as.numeric(design_effect(
strata = data.frame(N = N, n = n_1_int))),
.by = lga) |>
mutate(kish = round(kish, 3))
#> lga kish
#> 1 Banjul 1.000
#> 2 Basse 1.013
#> 3 Brikama 1.009
#> 4 Janjanbureh 1.007
#> 5 Kanifing 1.000
#> 6 Kerewan 1.004
#> 7 Kuntaur 1.000
#> 8 Mansakonko 1.003The largest loss is 1.3%, in Basse. Every stratum keeps at least two EAs, so that its variance can be estimated. Kuntaur’s urban part, with 16 EAs and 1,000 households, receives 3.
Two EAs make a variance estimable. They do not make it stable. design_df() counts the degrees of freedom of the allocation, its EAs less its strata. The table per stratum adds up to the degrees of freedom of each LGA.
joint_df <- design_df(joint)
joint_df
#> Design degrees of freedom (planning)
#>
#> df = 293 (307 PSUs - 14 strata)
lga_df <- attr(joint_df, "strata") |>
left_join(distinct(strata, stratum, lga), by = "stratum") |>
summarise(eas = sum(n_units), df = sum(df), .by = lga) |>
mutate(t = round(qt(0.975, df), 3)) |>
arrange(df)
lga_df
#> lga eas df t
#> 1 Kerewan 25 23 2.069
#> 2 Janjanbureh 27 25 2.060
#> 3 Banjul 34 33 2.035
#> 4 Kuntaur 35 33 2.035
#> 5 Kanifing 36 35 2.030
#> 6 Mansakonko 38 36 2.028
#> 7 Basse 56 54 2.005
#> 8 Brikama 56 54 2.005The two LGAs with the fewest EAs, Kerewan and Janjanbureh, have 23 and 25 degrees of freedom. Their intervals use a quantile of about 2.07 rather than 1.96, Chapter 9, and a standard error estimated from so few EAs varies from one sample to the next. The virtual survey below checks how often their intervals miss.
10.5 Backtest
The report says the 2019-20 allocation was “a power allocation with a small adjustment”. The rule can be tested. Banjul was held at 40 EAs, and the other seven LGAs shared the other 241. A power allocation of 241 EAs over the households of Table A.1 reproduces Table A.3 best at one value of \(q\).
frame_2013 <- read.csv("data/gmb_dhs2019_frame.csv") |>
summarise(N = sum(households), .by = lga) |>
filter(lga != "Banjul")
table_a3 <- with(inputs, setNames(eas_urban + eas_rural, lga))
distance <- function(q) {
n <- 241 * frame_2013$N^q / sum(frame_2013$N^q)
sum(abs(n - table_a3[frame_2013$lga]))
}
q_grid <- seq(0, 1, by = 0.05)
q_2019 <- q_grid[which.min(sapply(q_grid, distance))]
q_2019
#> [1] 0.3
frame_2013 |>
mutate(power = round(241 * N^q_2019 / sum(N^q_2019), 1),
table_a3 = table_a3[lga])
#> lga N power table_a3
#> 1 Kanifing 69890 44.0 46
#> 2 Brikama 103664 49.5 50
#> 3 Mansakonko 11965 25.9 27
#> 4 Kerewan 27862 33.4 32
#> 5 Kuntaur 10957 25.2 26
#> 6 Janjanbureh 14451 27.4 28
#> 7 Basse 34641 35.6 32A power of 0.3 reproduces Table A.3 to within two EAs in every LGA but Basse, which received 32 EAs where the rule gives 36. Most of the “small adjustment” is in Basse. Within each LGA, Table A.3 gave the urban part a little more than its share of households. Kerewan, with 27.5% of its households urban, received 11 urban EAs of 32 where a proportional split gives 9.
10.6 Virtual survey
Three allocations are drawn on the synthetic Gambia: the quotas of Chapter 9, the power rule with \(q = 0.25\) at the same total of 290 EAs, and the joint allocation of 307 EAs. The first two split each LGA in proportion to its households, the third as the optimizer chose.
response <- mutate(inputs, lga, household = completed, person = women_rr,
.keep = "none")
design_for <- function(strata_n) {
sampling_design() |>
add_stage("Clusters") |>
stratify_by(lga, urban_rural) |>
cluster_by(cluster) |>
draw(n = strata_n, method = "pps_systematic", mos = households,
control = c(district, ward)) |>
add_stage("Households") |>
draw(n = 25, method = "systematic")
}
proportional_split <- function(eas) {
strata |>
mutate(n = pmax(2, round(eas[lga] * N / sum(N))), .by = lga) |>
select(lga, urban_rural, n)
}
designs <- list(
quotas = design_for(proportional_split(quota_eas)),
power = design_for(proportional_split(rules$power_25)),
joint = design_for(select(joint$detail, lga, urban_rural, n = n_1_int))
)
virtual_surveys <- lapply(designs, virtual_survey, population = gmb_synthetic,
response = response, reps = 1000, seed = 8)
bind_rows(lapply(virtual_surveys, \(r) tibble(
lga_low = min(r$true_rse[r$lga != "National"]),
lga_high = max(r$true_rse[r$lga != "National"]),
national = r$true_rse[r$lga == "National"]
)), .id = "allocation") |>
mutate(across(where(is.numeric), \(x) round(x, 3)))
#> # A tibble: 3 × 4
#> allocation lga_low lga_high national
#> <chr> <dbl> <dbl> <dbl>
#> 1 quotas 0.084 0.114 0.056
#> 2 power 0.07 0.127 0.043
#> 3 joint 0.068 0.116 0.042The quotas keep the worst LGA lowest, at 11.4%, and give the worst national estimate, 5.6%. The power rule brings the national RSE to 4.3% and lets its worst LGA reach 12.7%. The joint allocation reaches the same national precision, 4.2%, with a worst LGA at 11.6%, for 17 more EAs. Its national RSE is a little above the planned 4%, because the synthetic DEFTs of Kerewan and Kuntaur exceed those of the clustering model. The plan of the Gambia takes the joint allocation.
The virtual survey also gives the coverage of the intervals the survey would report, with the normal quantile. The table gives, for the joint allocation, the true RSE, the reported standard error over the true one, and the coverage of the 95% intervals in each domain.
virtual_surveys$joint |>
select(lga, true_rse, se_ratio, coverage) |>
mutate(across(where(is.numeric), \(x) round(x, 3)))
#> # A tibble: 9 × 4
#> lga true_rse se_ratio coverage
#> <chr> <dbl> <dbl> <dbl>
#> 1 Banjul 0.098 1.07 0.955
#> 2 Kanifing 0.097 1.04 0.951
#> 3 Brikama 0.068 0.978 0.939
#> 4 Mansakonko 0.107 1.02 0.946
#> 5 Kerewan 0.116 0.926 0.914
#> 6 Kuntaur 0.098 1.14 0.965
#> 7 Janjanbureh 0.095 1.12 0.957
#> 8 Basse 0.102 0.984 0.935
#> 9 National 0.042 0.992 0.943The intervals cover the true mCPR in 91% of the replicates in Kerewan and 96% in Janjanbureh, and in 94% nationally.
10.7 Floors, steps and the field force
Two practical constraints shape most allocations. A floor gives a domain a minimum whatever its share, such as the 800 interviews with women each LGA needs. In n_alloc() it is min_n_stratum, a lower bound and not a base added to the share. A step makes each stratum’s sample a multiple of some number, so that it divides evenly among months, rotation groups or teams.
The Gambia needs no steps. The other surveys of the book do. The Rwanda LFS of Chapter 27 rounds each district to a multiple of four PSUs a quarter, or of eight in the districts split between urban and rural, so that each rotation group receives the same number. The Malawi IHS of Chapter 28 gives each district its EAs in sets of twelve, one per month of fieldwork. Both share the total in proportion to households above the floors, and both check the result against what the field teams can cover.
10.8 How the other surveys allocate
The Zimbabwe MICS of Chapter 26 compares quotas with a power allocation, as this chapter does. Its provinces differ much less in size than the Gambian LGAs. Quotas cost the national estimate little there, and the plan keeps them across provinces while splitting each province between urban and rural by a power rule.
Strata can also be built from a continuous variable, such as the population density of an EA, rather than taken from administrative boundaries. strata_bound() in svyplan finds the cut points, and its $strata table goes straight to n_alloc().
10.9 What to record
The sample is allocated so that mCPR among currently married women has an RSE of at most 10% in each LGA and 4% nationally, at the lowest cost, with at least 800 completed interviews with women in each LGA and two EAs in each stratum. The allocation was found by joint optimization over the 14 strata, with the design effects of the clustering model. It gives 307 EAs of 25 households, 7,675 households in all. The split between urban and rural within each LGA is close to proportional.
joint$detail |>
select(lga, urban_rural, n_1_int) |>
tidyr::pivot_wider(names_from = urban_rural, values_from = n_1_int,
values_fill = 0) |>
mutate(Total = Urban + Rural, Households = 25 * Total) |>
rename(LGA = lga) |>
knitr::kable()| LGA | Urban | Rural | Total | Households |
|---|---|---|---|---|
| Banjul | 34 | 0 | 34 | 850 |
| Basse | 17 | 39 | 56 | 1400 |
| Brikama | 39 | 17 | 56 | 1400 |
| Janjanbureh | 5 | 22 | 27 | 675 |
| Kanifing | 36 | 0 | 36 | 900 |
| Kerewan | 7 | 18 | 25 | 625 |
| Kuntaur | 3 | 32 | 35 | 875 |
| Mansakonko | 9 | 29 | 38 | 950 |
10.10 Exercises
- Kish’s factor of an allocation measures its national weighting loss. Compute it for the quotas and for the joint allocation, with the households of each LGA as \(N_h\). Which is closer to proportional?
- Rerun the joint allocation with a national target of 3.5% instead of 4%. How many EAs does it need, and where do they go?
- The 2019-20 design held Banjul at 40 EAs. Using the 2024 frame and the floors of this chapter, how many EAs does Banjul need, and why is it fewer?
- A power allocation with \(q = 0.3\) fitted Table A.3. Apply it to the 2024 frame with 281 EAs, Banjul held at 40, and compare the national RSE with the joint allocation.
design_effect(strata = data.frame(N = inputs$N, n = ...))gives about 3.3 for the quotas and 1.8 for the joint allocation. The joint allocation is closer to proportional, because it gives Brikama more EAs.- Replace
cv = 0.04bycv = 0.035intargets. The total rises to 333 EAs, and all 26 added EAs go to Brikama. - 34, the EAs its 800 interviews need. The 2019-20 round held Banjul above its floor. A smaller Banjul sample also reduces the finite population correction that Chapter 6 found in Banjul.
- Share 241 EAs over the 2024 households of the other LGAs with \(N_h^{0.3}\), then use
national_rse()andlga_rse(). The national RSE is 4.0%, as with the joint allocation, for 25 fewer EAs. But the worst LGA rises to 13.7%, in Basse, which receives 32 EAs against 56. Mansakonko and Kuntaur, with 26 and 25 EAs, also miss 10%.