25  A DHS for The Gambia

Parts II and III built the design of the next Gambia DHS one decision at a time. This chapter puts it in one place. It lists the decisions with the chapter that took each, gives the whole design as a single script that does not depend on the book’s helper functions, and summarizes the three tests. It is the template to copy for the next round of a DHS, here or elsewhere.

25.1 The decisions

Decision The Gambia Chapter
1 Domains and strata Country, urban and rural, 8 LGAs. 14 strata, LGA by residence 7
2 Inputs 2019-20 GDHS, LGA levels and yields, urban and rural DEFTs 7
3 Targets RSE of mCPR at most 10% by LGA and 4% nationally, 800 women per LGA 8
4 Design effect and take \(1 + (b - 1)\rho\), with an urban and a rural \(\rho\), 25 households 9
5 Sample size Set by the joint allocation, 307 clusters 8
6 Allocation Joint allocation at the lowest cost over the 14 strata 10
7 Frame 2024 EAs, those under 25 households merged with a neighbor 5, 11
8 PSUs Systematic PPS on households, sorted by district and ward 11
9 Households Listing, 25 by systematic sampling, no replacement, men in half 12
10 Weights and report Inverse probabilities, nonresponse adjustment, Appendix A 13, 14

25.2 The script

The script reads only the frame and the tables transcribed from the 2019-20 report. Each block carries the number of its decision.

library(svyplan)
library(samplyr)
library(dplyr)

## 1. Frame and strata
gmb24_eas <- readRDS("data/gmb24_eas.rds")

## 2. Inputs of the 2019-20 GDHS: LGA yields, frame and residence errors
inputs <- read.csv("data/gmb_dhs2019_lga.csv") |>
  mutate(interviewed = selected * completed,
         women_hh = women / interviewed,
         married_hh = married / women_rr / interviewed,
         resp = completed * women_rr,
         in_scope = completed / hrr,
         resp_in_scope = hrr * women_rr)
frame_2019 <- read.csv("data/gmb_dhs2019_frame.csv")
residence <- read.csv("data/gmb_dhs2019_residence.csv")

## 4. An urban and a rural intraclass correlation, after removing the
## weighting loss of the 2019-20 allocation
icc <- bind_rows(
  mutate(inputs, lga, urban_rural = "Urban", n = eas_urban, .keep = "none"),
  mutate(inputs, lga, urban_rural = "Rural", n = eas_rural, .keep = "none")
) |>
  inner_join(frame_2019, by = c("lga", "urban_rural")) |>
  filter(n > 0) |>
  summarise(kish = as.numeric(design_effect(
              strata = data.frame(N = households, n = n))),
            clusters = sum(n), .by = urban_rural) |>
  left_join(residence, by = c(urban_rural = "domain")) |>
  rowwise() |>
  mutate(icc = varcomp(deff = mcpr_deft^2 / kish,
                       take = married / clusters)$icc) |>
  ungroup()
icc <- setNames(icc$icc, icc$urban_rural)

## 7. Clusters of at least 25 households
ea_clusters <- gmb24_eas |>
  arrange(lga, urban_rural, district, ward, ea_id) |>
  mutate(cluster = merge_psus(ea_id, min_size = 25, size = households),
         .by = c(lga, urban_rural))
clusters <- ea_clusters |>
  summarise(district = first(district), ward = first(ward),
            households = sum(households), .by = c(lga, urban_rural, cluster))

## 3, 5 and 6. Joint allocation for 10% by LGA and 4% nationally
floor_banjul <- with(filter(inputs, lga == "Banjul"),
                     25 * ceiling(800 / (25 * women_hh * resp)))
strata <- 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", floor_banjul, 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)
)
allocation <- n_alloc_joint(as.data.frame(strata), measures = measures,
                            targets = targets,
                            min_n_stratum = strata$min_n_stratum)$detail |>
  mutate(lga, urban_rural, n = n_1_int, .keep = "none")

## 8 and 9. The design
design <- sampling_design("A DHS for The Gambia") |>
  add_stage("Clusters") |>
    stratify_by(lga, urban_rural) |>
    cluster_by(cluster) |>
    draw(n = allocation, method = "pps_systematic", mos = households,
         control = c(district, ward)) |>
  add_stage("Households") |>
    draw(n = 25, method = "systematic")

## 8. Clusters, checked before and after selection
stopifnot(all(frame_summary(design, clusters, stages = 1,
                            detail = "unit")$chance < 1))
selected <- execute(design, clusters, stages = 1, seed = 2025)
write_design(selected, file.path(tempdir(), "gmb_dhs_design.json"),
             frame = clusters)

## 9. Listing (synthetic here), households and the men's half
set.seed(2026)
listing <- selected |>
  as.data.frame() |>
  mutate(listed = pmax(1L, as.integer(round(
    households * exp(rnorm(n(), log(1.05), 0.2)))))) |>
  reframe(hh_id = seq_len(listed), .by = c(lga, urban_rural, cluster))
issued <- execute(selected, listing, seed = 2027)
mens_half <- sampling_design("Men's subsample") |>
  stratify_by(cluster) |>
  draw(frac = 0.5, method = "systematic") |>
  execute(issued, seed = 2028)

## 10. Weights checked, field list
stopifnot(isTRUE(all.equal(issued$.weight,
                           issued$.weight_1 * issued$.weight_2)))
field_list <- selected |>
  as.data.frame() |>
  select(cluster) |>
  left_join(ea_clusters, by = "cluster") |>
  select(lga, urban_rural, district, ward, ea_id, households)

c(clusters = sum(allocation$n), households = nrow(issued),
  mens_half = nrow(mens_half), field_list_eas = nrow(field_list))
#>       clusters     households      mens_half field_list_eas 
#>            307           7671           3989            313

The script selects 307 clusters and 7,671 households, of which 3,989 are in the men’s half, and it writes the design file that Chapter 14 replays. The analysis design comes from as_svydesign(issued) once interviews are joined to issued (Chapter 13).

selected |>
  as.data.frame() |>
  mutate(ea_id = cluster) |>
  map_eas(country = "gmb", outline = "districts", top = "lgas",
          polygons = "gmb24_ea_polygons", size = 0.9)

Map of The Gambia along the river, divided into eight LGAs and their districts. Points mark the selected clusters, densest around Banjul and Kanifing on the Atlantic coast and spread along the river elsewhere.

The clusters of the next Gambia DHS over the LGAs (thick lines) and districts (thin lines).

25.3 The three tests

The backtests of Parts II and III tied each method to the 2019-20 report. The sizing formula returned the published RSE of every LGA (Chapter 8). The 2013 yields of each LGA predicted the 2019-20 interviews twice as well as the national yields the planners used (Chapter 7). The clustering model reproduced the pattern of the published DEFTs (Chapter 9). An allocation power of 0.3 reproduced Table A.3 (Chapter 10), and the weights matched the formulas of Appendix A (Chapter 11, Chapter 12). The Appendix B standard error was written out and matched the survey package (Chapter 13).

The virtual survey runs the script’s design on the synthetic Gambia.

gmb_synthetic <- readRDS("data/gmb_synthetic.rds")
response <- mutate(inputs, lga, household = completed, person = women_rr,
                   .keep = "none")
virtual <- virtual_survey(design, gmb_synthetic, response, reps = 1000,
                          seed = 14)

virtual |>
  select(lga, true_rse, estimated_rse, se_ratio, coverage) |>
  mutate(across(where(is.numeric), \(x) round(x, 3)))
#> # A tibble: 9 × 5
#>   lga         true_rse estimated_rse se_ratio coverage
#>   <chr>          <dbl>         <dbl>    <dbl>    <dbl>
#> 1 Banjul         0.097         0.105    1.09     0.962
#> 2 Kanifing       0.102         0.1      0.984    0.935
#> 3 Brikama        0.068         0.066    0.965    0.935
#> 4 Mansakonko     0.109         0.11     1.01     0.947
#> 5 Kerewan        0.112         0.108    0.966    0.932
#> 6 Kuntaur        0.099         0.112    1.13     0.969
#> 7 Janjanbureh    0.094         0.107    1.14     0.968
#> 8 Basse          0.106         0.1      0.944    0.932
#> 9 National       0.041         0.042    1.02     0.946

The table gives, for each LGA and the country, the true RSE over the 1,000 replicates, the RSE the survey would report on average, their ratio and the coverage of the 95% intervals. The true RSE runs from 6.8% in Brikama, which carries the national target, to 11.2% in Kerewan, and the country reaches 4.1%. Kerewan, Mansakonko, and Basse come out more than half a point above the 10% target. The plan sizes each LGA with the clustering model, and these LGAs show where the synthetic Gambia departs from it, as Chapter 10 found for Kerewan. The reported standard errors are within 14% of the true ones in every LGA, and the intervals cover the truth in 93% to 97% of the replicates.

The stress tests of Part IV break the plan’s assumptions one at a time on the same population: an older frame, excluded areas and nonresponse that depends on the outcome.

25.4 Adapting the template

Another DHS changes the inputs and the targets, not the script. The table of LGA inputs becomes a table of the new country’s regions, read from its last report. The residence errors of Tables B.3 and B.4 give its two correlations. The frame needs the same columns: an EA code, the domain, the residence, the administrative units used for sorting and a household count. Chapter 29 describes these formats and how to build a synthetic population for the virtual survey.

25.5 Exercises

  1. Raise the LGA target to 12% and keep 4% nationally. How many clusters does the design need, and which LGAs lose clusters?
  2. Add full vaccination to the joint allocation, with its own rows in measures and targets. Does it bind anywhere?
  3. Change the take to 20 households. Recompute the correlations’ design effects and the allocation. Does the total number of households rise or fall?
  4. Run the virtual survey with Brewer’s method in place of systematic PPS, and compare the SE ratios, as in Chapter 11.
  1. Replace cv = 0.10 by cv = 0.12 in targets. The total falls to about 254 clusters. Banjul keeps the clusters of its floor of 800 women, Brikama gains about ten for the national target of 4%, and the other six LGAs lose about 30% of theirs.
  2. Vaccination needs p = vacc, eligible_per_unit = children_hh and its own correlation. With a relative target of 10%, it binds nowhere, since coverage near 85% is cheap under a relative target (Chapter 8).
  3. With 20 households, \(b\) falls and so does the design effect, so each household is worth more. The allocation needs 352 clusters instead of 307, but 7,040 households instead of 7,675. Whether that is cheaper depends on the cost of a cluster (Chapter 9).
  4. Replace "pps_systematic" by "pps_brewer" and drop control. The SE ratios move closer to one, except where the finite population fraction is large.