inputs <- read.csv("data/gmb_dhs2019_lga.csv") |>
mutate(
interviewed = selected * completed,
women_hh = women / interviewed,
married_hh = married / women_rr / interviewed,
children_hh = children / women_rr / interviewed,
in_scope = completed / hrr,
resp_in_scope = hrr * women_rr
)
inputs |>
select(lga, mcpr, mcpr_deft, married_hh, in_scope, resp_in_scope) |>
mutate(across(where(is.numeric), \(x) round(x, 3)))
#> lga mcpr mcpr_deft married_hh in_scope resp_in_scope
#> 1 Banjul 0.217 1.016 0.588 0.956 0.879
#> 2 Kanifing 0.159 1.246 0.899 0.956 0.864
#> 3 Brikama 0.197 1.086 1.228 0.975 0.929
#> 4 Mansakonko 0.144 1.571 1.151 0.975 0.964
#> 5 Kerewan 0.208 1.494 1.375 0.973 0.937
#> 6 Kuntaur 0.141 1.533 1.804 0.965 0.960
#> 7 Janjanbureh 0.182 1.867 1.495 0.976 0.956
#> 8 Basse 0.078 1.645 2.302 0.941 0.9408 Precision targets and sample size
The Gambia Bureau of Statistics (GBoS) wants the next DHS to estimate, in each of the eight local government areas (LGAs), the share of married women who use a modern contraceptive method (mCPR). How many households must each LGA receive for that estimate to be precise enough? This chapter takes the two decisions the question contains. The first is the precision target, decision 3 of Figure 1.1. The second is the sample size that reaches it, decision 5. The design effect, decision 4, is taken as the 2019-20 report gives it, and Chapter 9 returns to it.
The inputs are those of Chapter 7. For each LGA, the 2019-20 report gives the level of mCPR and of full vaccination, their design effects, the households selected and completed, and the eligible people found. Three derived columns matter here. married_hh is the number of married women in a completed household. in_scope is the share of selected households found occupied and located, and resp_in_scope the household response rate among them times the response rate of women. Their product is the overall response of a selected household.
8.1 Four ways to state precision
An estimate from a sample differs from the value a census would give. Its standard error (SE) measures by how much. It is the spread of the estimates over all the samples the design could have drawn. A precision target is a bound on the SE, or on one of three measures derived from it.
For an estimated proportion \(P\) with standard error \(\mathrm{SE}\), \[ \mathrm{CV} = \frac{\mathrm{SE}}{P}, \qquad \mathrm{MOE} = z \, \mathrm{SE}, \qquad \mathrm{RME} = \frac{\mathrm{MOE}}{P} = z \, \mathrm{CV}. \] The coefficient of variation (CV) is called the relative standard error (RSE) in DHS reports. MOE is the margin of error, the half-width of the confidence interval, and RME the relative margin of error. \(z\) is the quantile of the normal distribution for the confidence level, 1.96 at 95%.
Table B.2 of the 2019-20 report gives the national mCPR as 0.171, with a standard error of 0.007 and an RSE of 0.039. The other measures follow.
p <- 0.171
se <- 0.007
c(cv = se / p, moe = 1.96 * se, rme = 1.96 * se / p)
#> cv moe rme
#> 0.04093567 0.01372000 0.08023392The national estimate is known to within 1.4 percentage points at 95% confidence, or 8% of its value. The report prints the interval as \(R \pm 2\,\mathrm{SE}\), 0.158 to 0.184, with \(z = 2\).
The SE and the MOE are absolute. For a proportion they are in percentage points, so moe = 0.05 means plus or minus 5 points. The CV and the RME are relative, so rmoe = 0.05 means 5% of the proportion, which is 0.4 points for Basse’s mCPR of 7.8%. The choice between the two kinds determines which indicators are expensive. Under simple random sampling, the variance of a proportion is \(P(1 - P)/n\). The next chunk sizes three proportions of the 2019-20 round under a 10% RSE and under a 5-point margin.
p <- c(basse_mcpr = 0.078, brikama_mcpr = 0.197, brikama_vaccination = 0.845)
rbind(
rse_10 = sapply(p, \(x) n_prop(x, cv = 0.10)$n),
moe_5 = sapply(p, \(x) n_prop(x, moe = 0.05)$n)
) |>
round()
#> basse_mcpr brikama_mcpr brikama_vaccination
#> rse_10 1182 408 18
#> moe_5 111 243 201A relative target is hard on rare outcomes. Basse’s mCPR needs 1,182 respondents for an RSE of 10%, and vaccination at 85% needs 18. An absolute target is hard on outcomes near one half, and the three needs are then of the same order. Each survey program has settled on one kind of measure.
| Program | Measure | Example of a target |
|---|---|---|
| DHS | RSE | 10% on mCPR in each domain (ICF International 2012) |
| MICS | RME, with \(z = 2\) | 12% nationally, 15% by province in Zimbabwe 2019 (Zimbabwe National Statistics Agency and UNICEF 2019) |
| Labor force survey | CV | 12% a year on district unemployment in Rwanda (National Institute of Statistics of Rwanda 2024) |
| Integrated household survey | MOE | 10 points on district poverty in Malawi (National Statistical Office 2020) |
The Gambia design follows the DHS manual and asks for an RSE of 10% on mCPR in every LGA.
8.2 The sample size for a proportion
Turning a target into a number of households takes four steps. The first solves the SRS variance for \(n\). The design effect then scales the result up for the clustering, the response rates scale it up for nonresponse, and the eligible people per household turn respondents into households to select.
The number of households to select for a target RSE \(\alpha\) is \[ n = \mathrm{deff} \times \frac{1/P - 1}{\alpha^2} \times \frac{1}{R_h \, R_i \, d}, \] with \(P\) the expected proportion, \(\mathrm{deff}\) the design effect (\(\mathrm{DEFT}^2\)), \(R_h\) the share of selected households completed, \(R_i\) the response rate of eligible persons and \(d\) the eligible persons per completed household (ICF International 2012). \(R_h\) is itself the share \(E_h\) of selected households in scope times the household response rate. For a margin of error, the middle factor becomes \(z^2 P (1 - P) / \mathrm{MOE}^2\).
DHS reports publish the DEFT, the ratio of standard errors, and the formula needs its square. In svyplan, n_prop() computes the formula. Its cv argument is \(\alpha\), deff is \(\mathrm{DEFT}^2\), eligibility_rate is \(E_h\), resp_rate is the household response rate times \(R_i\), and eligible_per_unit is \(d\). With eligible_per_unit, the result is counted in households. The next chunk applies the steps one at a time to Basse.
basse <- filter(inputs, lga == "Basse")
c(
respondents_srs = n_prop(basse$mcpr, cv = 0.10)$n,
respondents = n_prop(basse$mcpr, cv = 0.10, deff = basse$mcpr_deft^2)$n,
households = n_prop(basse$mcpr, cv = 0.10, deff = basse$mcpr_deft^2,
eligibility_rate = basse$in_scope,
resp_rate = basse$resp_in_scope,
eligible_per_unit = basse$married_hh)$n
) |>
round()
#> respondents_srs respondents households
#> 1182 3199 1572A simple random sample of 1,182 married women would reach the target. The clustered sample has a design effect of \(1.645^2 = 2.71\) and needs 3,199. In Basse, 94% of the selected households are in scope, and 94% of those respond with their women, an overall response of 88%. A completed household holds 2.3 married women, so 1,572 selected households deliver the 3,199. With 25 households per EA, that is 63 EAs.
The formula leaves out the finite population correction, \(1 - n/N\), which matters only when the sample is a large part of the domain. Chapter 13 shows where it matters in The Gambia.
8.3 Several indicators and a floor
The DHS manual sizes a survey on two indicators: mCPR and full vaccination among children aged 12 to 23 months. It also asks for at least 800 completed interviews with women in every domain, which the fertility and mortality rates need (ICF International 2012). n_multi() takes all three requirements as one table, with one row per LGA and requirement. Each row counts its own eligible group. The floor is a row with min_respondents and no target, and its eligible group is all women aged 15 to 49.
targets <- bind_rows(
mutate(inputs, lga, name = "mcpr", p = mcpr, cv = 0.10,
deff = mcpr_deft^2, eligibility_rate = in_scope,
resp_rate = resp_in_scope, eligible_per_unit = married_hh,
.keep = "none"),
mutate(inputs, lga, name = "vaccination", p = vacc, cv = 0.10,
deff = vacc_deft^2, eligibility_rate = in_scope,
resp_rate = resp_in_scope, eligible_per_unit = children_hh,
.keep = "none"),
mutate(inputs, lga, name = "women", eligibility_rate = in_scope,
resp_rate = resp_in_scope, eligible_per_unit = women_hh,
min_respondents = 800, .keep = "none")
)
requirements <- n_multi(targets, domains = "lga")$domains |>
rename(households = .n, binding = .binding) |>
mutate(eas = ceiling(households / 25))
requirements |>
mutate(households = round(households))
#> lga households binding eas
#> 1 Banjul 844 women 34
#> 2 Kanifing 1106 mcpr 45
#> 3 Brikama 432 mcpr 18
#> 4 Mansakonko 1357 mcpr 55
#> 5 Kerewan 679 mcpr 28
#> 6 Kuntaur 857 mcpr 35
#> 7 Janjanbureh 1123 mcpr 45
#> 8 Basse 1572 mcpr 63
sum(requirements$eas)
#> [1] 323n_multi() sizes each row as n_prop() does and keeps the largest requirement in each LGA. The binding column names it. mCPR binds in seven LGAs. In Banjul, households hold so few women that the 800 interviews need more households than mCPR does. Vaccination never binds, because coverage near 85% is cheap under a relative target. The eight LGAs need 323 EAs of 25 households, against 281 in 2019-20.
8.4 Backtest
Two checks tie these numbers to the 2019-20 report. The first runs the formula backwards. prec_multi() takes the same mCPR rows with the households each LGA selected in 2019-20, and returns the RSE they give.
check <- targets |>
filter(name == "mcpr") |>
select(-cv, -min_respondents) |>
left_join(select(inputs, lga, n = selected, published = mcpr_rse),
by = "lga")
prec_multi(check, domains = "lga")$detail |>
select(lga, predicted = .cv) |>
left_join(select(check, lga, published), by = "lga") |>
mutate(predicted = round(predicted, 3))
#> lga predicted published
#> 1 Banjul 0.087 0.087
#> 2 Kanifing 0.098 0.098
#> 3 Brikama 0.059 0.059
#> 4 Mansakonko 0.142 0.142
#> 5 Kerewan 0.092 0.092
#> 6 Kuntaur 0.115 0.115
#> 7 Janjanbureh 0.127 0.127
#> 8 Basse 0.144 0.144The predicted RSE equals the published one in every LGA. The match confirms that Tables A.5 and B.5 to B.12 were read correctly, and that the DEFT of the report is the factor the formula expects. It is not a forecast, because the yields were measured in the same round.
The second check uses the fact that the sample size grows with the inverse square of the target. An LGA that reached an RSE of \(\alpha_0\) with \(n_0\) households needs \(n_0 (\alpha_0 / 0.10)^2\) for 10%, if nothing else changes. The published RSE alone then gives the requirement.
inputs |>
mutate(lga, selected, rse_2019 = mcpr_rse,
rule = round(selected / 25 * (rse_2019 / 0.10)^2), .keep = "none") |>
left_join(select(requirements, lga, eas), by = "lga")
#> lga selected rse_2019 rule eas
#> 1 Banjul 1000 0.087 30 34
#> 2 Kanifing 1150 0.098 44 45
#> 3 Brikama 1250 0.059 17 18
#> 4 Mansakonko 675 0.142 54 55
#> 5 Kerewan 800 0.092 27 28
#> 6 Kuntaur 651 0.115 34 35
#> 7 Janjanbureh 696 0.127 45 45
#> 8 Basse 763 0.144 63 63The rule and n_multi() agree to one EA in every LGA but Banjul, where the floor of 800 women binds instead of mCPR. The table also shows that the 2019-20 round was not sized for 10% everywhere. Brikama reached 5.9% with 1,250 households, and Basse 14.4% with 763. The 2019-20 allocation was a compromise between the LGAs and the national estimate, which Chapter 10 takes up.
8.5 Virtual survey
The plan promises an RSE of 10% in every LGA. The virtual survey checks that promise by drawing the design many times on the synthetic Gambia of Chapter 6, a population of households and women built on the frame and calibrated to the 2019-20 report. In the design, each LGA receives the EAs of its requirement, split between urban and rural in proportion to households, with at least two in each. The EAs are selected with probability proportional to size, and 25 households are taken in each. Chapters 10 and 11 explain these choices.
gmb_synthetic <- readRDS("data/gmb_synthetic.rds")
strata_n <- gmb_synthetic$clusters |>
summarise(N = sum(households), .by = c(lga, urban_rural)) |>
left_join(select(requirements, lga, eas), by = "lga") |>
mutate(n = pmax(2, round(eas * N / sum(N))), .by = lga) |>
select(lga, urban_rural, n)
quota_design <- sampling_design("Each LGA at its requirement") |>
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")virtual_survey() selects the sample 1,000 times. In each replicate it drops households and women at the response rates of 2019-20, estimates mCPR in every LGA as the survey would, and computes the standard error the survey would report.
response <- mutate(inputs, lga, household = completed, person = women_rr,
.keep = "none")
virtual <- virtual_survey(quota_design, gmb_synthetic, response, reps = 1000,
seed = 6)
planned <- targets |>
filter(name == "mcpr") |>
select(-cv, -min_respondents) |>
left_join(mutate(requirements, lga, n = 25 * eas,
.keep = "none"), by = "lga") |>
prec_multi(domains = "lga")
virtual |>
left_join(select(planned$detail, lga, planned = .cv), by = "lga") |>
left_join(select(inputs, lga, deft_2019 = mcpr_deft), by = "lga") |>
select(lga, planned, estimated_rse, true_rse, deft_2019, deft) |>
mutate(across(where(is.numeric), \(x) round(x, 3)))
#> # A tibble: 9 × 6
#> lga planned estimated_rse true_rse deft_2019 deft
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Banjul 0.094 0.106 0.098 1.02 1.14
#> 2 Kanifing 0.099 0.09 0.094 1.25 1.13
#> 3 Brikama 0.098 0.115 0.116 1.09 1.28
#> 4 Mansakonko 0.099 0.092 0.072 1.57 1.46
#> 5 Kerewan 0.098 0.103 0.098 1.49 1.56
#> 6 Kuntaur 0.099 0.112 0.102 1.53 1.73
#> 7 Janjanbureh 0.1 0.082 0.099 1.87 1.54
#> 8 Basse 0.1 0.096 0.078 1.64 1.57
#> 9 National NA 0.065 0.066 NA 3.01planned is the RSE the plan promises, just under 10% after the rounding up to whole EAs. estimated_rse is the average RSE the survey would report, and true_rse the spread of the estimates around the true value of the synthetic population. deft is the average DEFT the survey would report, beside the DEFT of 2019-20 that the plan used. With 1,000 replicates, the true RSE is known to about 2% of its value.
reported <- attr(virtual, "replicates") |>
filter(.domain != "National") |>
mutate(rse = se / est, lga = factor(.domain, levels = rev(inputs$lga)))
ggplot(reported, aes(rse, lga)) +
geom_boxplot(outlier.size = 0.4, fill = "grey90") +
geom_vline(xintercept = 0.10, linetype = "dashed") +
geom_point(aes(true_rse, factor(lga, levels = rev(inputs$lga))),
data = filter(virtual, lga != "National"),
color = "#1f5f99", size = 2.5) +
labs(x = "Reported RSE", y = NULL) +
theme_minimal(base_size = 11)
The reported RSE follows the DEFT. Where the synthetic Gambia has a larger DEFT than the 2019-20 report, the survey reports more than the 10% the plan promised. Brikama was sized with the DEFT of 1.09 it had in 2019-20. On the synthetic Gambia its DEFT averages 1.28, and its reported RSE comes out at 11.5%. Where the synthetic DEFT is smaller, the survey reports less. Janjanbureh was sized with a DEFT of 1.87, its synthetic DEFT averages 1.54, and it reports 8.2%. Across the LGAs, the reported RSE runs from 8.2% to 11.5%.
Each 2019-20 DEFT is an estimate from 26 to 50 clusters, and the plan inherits its error. Chapter 6 shows that Brikama’s published DEFT sits in the lower tail of what the 2019-20 design gives on the synthetic Gambia, and Janjanbureh’s in the upper tail. A planner cannot tell which LGAs drew a low DEFT and which a high one. Chapter 9 replaces the eight DEFTs by a model with fewer parameters, estimated on all 281 clusters at once.
The true RSE adds a second finding. In Mansakonko and Basse it is about a fifth below the reported one, 7.8% against 9.6% in Basse. In Janjanbureh it is above. The reported standard error treats the clusters as drawn with replacement, as DHS sampling errors do. The true variance of a systematic draw on a sorted frame departs from that formula, in either direction and by an amount that differs from one LGA to the next. Chapter 11 explains why. Across the LGAs, the intervals cover the true value in 89% to 99% of the replicates.
Nationally, the reported and the true RSE agree, at 6.6%. The national DEFT is 3.01, far above that of any LGA. Each LGA received the sample its own target needs, whatever its size, so a household of Brikama stands for many more households than one of Mansakonko. Chapter 10 measures that cost and shares the sample in a way that reduces it.
8.6 How the other surveys state the target
The same function serves all four programs. Only the measure and its inputs change.
The MICS manual sizes on a relative margin of error at \(z = 2\), a 95.45% interval (Khan and Hancioglu 2019). n_prop() takes rmoe with alpha = 2 * pnorm(-2). With the inputs the Zimbabwe MICS of 2019 used for underweight, it gives the national requirement of that round (Chapter 26).
n_prop(0.11, rmoe = 0.12, alpha = 2 * pnorm(-2), deff = 1.4,
resp_rate = 0.95, eligible_per_unit = 0.16 * 4.2)$n
#> [1] 4928.673The Rwanda labor force survey sizes each district so that an unemployment ratio of 6% has a yearly CV of 12% (National Institute of Statistics of Rwanda 2024). Its design effect comes from an intraclass correlation and the people a cluster contributes in a year (Chapter 9). With them, n_prop() returns the 789 household interviews of the methodology (Chapter 27).
b <- 12 * 2.364 * 1.8
n_prop(0.06, cv = 0.12, deff = design_effect(icc = 0.01085, take = b),
resp_rate = 0.90, eligible_per_unit = 2.364)$n
#> [1] 789.1142The Malawi IHS judges its district poverty rates by an absolute margin of 10 points (Chapter 28). Under an absolute target, poverty near 50% is the most expensive and the cities, near 8%, are the cheapest.
sapply(c(city = 0.08, district = 0.50, phalombe = 0.83),
\(p) n_prop(p, moe = 0.10)$n) |>
round()
#> city district phalombe
#> 28 96 54A target on a mean, such as household consumption, needs the variance of the variable instead of \(P(1 - P)\), and n_mean() takes it. A target on a change between rounds, or on a difference between two groups, is a question of power, which Chapter 24 treats.
8.7 What to record
The sample design report states the target, the indicators and their sources, and the requirement of each domain. For the Gambia, this chapter adds the following paragraph and table to the report that Chapter 14 assembles.
The sample is sized so that the use of a modern contraceptive method among currently married women has a relative standard error of at most 10% in each LGA, as the DHS manual recommends. Full vaccination among children aged 12 to 23 months is held to the same target, and every LGA must yield at least 800 completed interviews with women. Levels, design effects, response rates and eligible persons per household are those of the 2019-20 GDHS (Tables A.5 and B.5 to B.12). mCPR sets the requirement in every LGA except Banjul, where the floor of 800 women binds. The eight LGAs need 323 EAs of 25 households, 8,075 households in all.
requirements |>
left_join(select(inputs, lga, mcpr, mcpr_deft), by = "lga") |>
mutate(LGA = lga, mCPR = mcpr, DEFT = mcpr_deft,
Households = round(households), EAs = eas, Binding = binding,
.keep = "none") |>
knitr::kable()| LGA | mCPR | DEFT | Households | EAs | Binding |
|---|---|---|---|---|---|
| Banjul | 0.217 | 1.016 | 844 | 34 | women |
| Kanifing | 0.159 | 1.246 | 1106 | 45 | mcpr |
| Brikama | 0.197 | 1.086 | 432 | 18 | mcpr |
| Mansakonko | 0.144 | 1.571 | 1357 | 55 | mcpr |
| Kerewan | 0.208 | 1.494 | 679 | 28 | mcpr |
| Kuntaur | 0.141 | 1.533 | 857 | 35 | mcpr |
| Janjanbureh | 0.182 | 1.867 | 1123 | 45 | mcpr |
| Basse | 0.078 | 1.645 | 1572 | 63 | mcpr |
8.8 Exercises
- Table B.2 gives the national mCPR as \(R = 0.171\) on \(N = 8{,}083\) married women, with a DEFT of 1.576. Compute the standard error and the RSE from these three numbers, and compare them with the published 0.007 and 0.039.
- Restate the 10% RSE target as a margin of error at 95% confidence for Basse and for Brikama. Which LGA receives the tighter target in percentage points?
- Size the eight LGAs for a margin of error of 4 points on both indicators, keeping the floor of 800 women. Which indicator binds now, and why does Banjul need so many households?
- Kuntaur reached an RSE of 11.5% with 651 selected households. Use the inverse-square rule to find the EAs it needs for 10%, and compare with
n_multi().
- \(\mathrm{SE} = 1.576 \sqrt{0.171 \times 0.829 / 8083} = 0.0066\), and \(0.0066 / 0.171 = 0.039\). Both match the report after rounding.
- \(1.96 \times 0.10 \times 0.078 = 0.015\) for Basse and \(1.96 \times 0.10 \times 0.197 = 0.039\) for Brikama. Basse’s target is tighter, 1.5 points against 3.9.
- Replace
cv = 0.10bymoe = 0.04in both rows oftargets. Vaccination binds in every LGA but Mansakonko. Under an absolute target a proportion near 85% is no longer cheap, and vaccination counts only the children aged 12 to 23 months. Banjul has 0.09 of them per completed household, and needs about 300 EAs. - \(651 / 25 \times (0.115 / 0.10)^2 = 34.4\), so 35 EAs, the number
n_multi()gives.