Skip to contents

Compute optimal per-stage sample sizes for a multistage cluster design, minimizing cost for a given precision or minimizing variance for a given budget.

Usage

n_cluster(stage_cost = NULL, ...)

# Default S3 method
n_cluster(
  stage_cost = NULL,
  ...,
  icc = NULL,
  unit_relvar = 1,
  var_ratio = 1,
  cv = NULL,
  budget = NULL,
  n_psu = NULL,
  n_per_psu = NULL,
  n_per_ssu = NULL,
  resp_rate_psu = 1,
  resp_rate_ssu = 1,
  resp_rate = 1,
  fixed_cost = 0,
  plan = NULL
)

# S3 method for class 'svyplan_prec'
n_cluster(stage_cost, ..., cv = NULL, budget = NULL)

Arguments

stage_cost

For the default method: numeric vector of per-stage costs. Length determines the number of stages (2 or 3). Named vectors are accepted with stage names cost_psu, cost_ssu, cost_tsu (cost_tsu aliases cost_ssu in 2-stage). For svyplan_prec objects: a precision result from prec_cluster().

...

Additional arguments passed to methods. Unused arguments are rejected.

icc

Numeric vector of homogeneity measures (length = stages - 1), or a svyplan_varcomp object. The ICC quantifies how similar units within the same cluster are: 0 means no similarity (clusters are as variable as the whole population), 1 means perfect similarity (all units in a cluster are identical). Typical values in household surveys range from 0.01 to 0.10. Higher icc means more clusters are needed for the same precision. Use varcomp() to estimate icc from a previous survey or pilot data.

unit_relvar

Unit relvariance (default 1). For most applications, the default of 1 is appropriate. Non-unit values arise when working with variance components from varcomp() that separate the total variance into stage-specific pieces.

var_ratio

Ratio of the stage components' unit variance to the analysis variable's, default 1. A scalar names var_ratio_psu and, for a three-stage design, derives var_ratio_ssu = var_ratio_psu * (1 - icc_psu), the identity the variance decomposition imposes; supply a length-2 vector only to override it, which is meaningful when the two stages' ratios come from different decompositions. See design_effect() for the identity and why the design effect would not reduce to var_ratio_psu without it. The default of 1 is appropriate for most designs.

cv

Target coefficient of variation (relative standard error). For example, cv = 0.05 means the standard error of the estimate should be at most 5 percent of the estimate itself. Specify exactly one of cv or budget.

budget

Total budget. Specify exactly one of cv or budget.

n_psu

Fixed number of PSUs (stage-1 sample size). NULL (default) means optimize. For 2-stage, at most one of n_psu or n_per_psu may be specified. For 3-stage, up to two of n_psu, n_per_psu, n_per_ssu may be fixed.

n_per_psu

Fixed cluster size (stage-2 sample size per PSU). NULL (default) means optimize. This is the typical MICS/DHS parameterization where the number of households per cluster is fixed.

n_per_ssu

Fixed SSU take size (stage-3 sample size per SSU). NULL (default) means optimize. Only valid for 3-stage designs.

resp_rate_psu

Expected PSU-level response rate, in (0, 1]. Default 1 (no adjustment). It is the share of selected clusters that can be worked at all, and the stage-1 sample size is inflated by 1 / resp_rate_psu to cover the loss. Nonresponse among the ultimate units inside a cluster is a different quantity that acts at a different stage; the plain resp_rate carries that meaning elsewhere in the package.

resp_rate_ssu

Expected SSU-level response rate, in (0, 1]. Three-stage designs only; default 1. It is the share of selected second-stage units, typically households, that can be interviewed at all. A 2-stage design has no such stage, since the units inside a PSU are the ultimate ones, and supplying it there is an error.

resp_rate

Expected ultimate-unit response rate, in (0, 1]. Default 1. It is the share of selected final-stage units, typically persons, that respond. This is the plain resp_rate the rest of the package uses.

fixed_cost

Fixed overhead cost (C0). Default 0. The total cost model becomes C = C0 + c1*n_psu + c2*n_psu*n_per_psu [+ c3*n_psu*n_per_psu*n_per_ssu]. In budget mode, only budget - fixed_cost is available for variable costs. In CV mode, fixed_cost is added to the variable cost.

plan

Optional svyplan() object providing design defaults (including stage_cost, icc, unit_relvar, var_ratio, resp_rate_psu, fixed_cost).

Value

A svyplan_cluster object with components:

n

Named numeric vector of continuous per-stage sample sizes (e.g. c(n_psu = 84.1, n_per_psu = 13.8)), the mathematical optimum.

stages

Number of stages (2 or 3).

total_n

Continuous total sample size (prod(n)).

cv

Coefficient of variation of the continuous optimum.

cost

Cost of the continuous optimum.

operational

The whole-unit field design, found by a discrete search: n (named integer stage sizes), total_n, cost, and cv, all recomputed from the integer design. In budget mode its cost never exceeds the budget, whereas in cv mode it meets the target at the lowest cost among the designs searched. as.integer() returns operational$n, and as.double() returns the continuous n.

params

List of input parameters.

Details

Getting started

A typical 2-stage household survey workflow:

  1. Decide what you know. You need the cost per cluster visit (stage_cost[1], e.g. travel + logistics) and the cost per interview (stage_cost[2]), plus an estimate of within-cluster homogeneity (icc). Estimate icc from a pilot or previous survey with varcomp(), or use a plausible range (0.01–0.10 for most household indicators).

  2. Choose a mode. If you have a target precision, set cv. If you have a fixed budget, set budget. Never set both.

  3. Fix stages or let the optimizer decide. In MICS/DHS-style designs, the number of households per cluster is fixed by fieldwork logistics (e.g. n_per_psu = 20). The optimizer then solves for how many clusters (n_psu) to visit. If no stage is fixed, both are optimized jointly.

How it works

Stage count is determined by length(stage_cost):

  • 2-stage (e.g. clusters then households): stage_cost has 2 elements, icc is a scalar.

  • 3-stage (e.g. districts, clusters, households): stage_cost has 3 elements, icc is length 2.

Two solving modes:

  • CV mode: minimize total cost subject to achieving the target CV.

  • Budget mode: minimize the CV (maximize precision) within the available budget.

Fixing stage sizes

One or more stage sizes can be fixed, leaving the remaining stage(s) to be optimized or derived from the constraint. For 2-stage designs, at most one stage may be fixed. For 3-stage designs, up to two stages may be fixed. The remaining free stage is derived from the budget or CV constraint.

If icc is a svyplan_varcomp object, icc, unit_relvar, and var_ratio are extracted automatically.

Boundary icc values

Boundary and near-boundary homogeneity values are not supported by the analytical optimum used here. When icc is near 0, most variability is within PSUs, so the closed-form optimum collapses toward taking many units in very few PSUs. When icc is near 1, most variability is between PSUs, so the optimum collapses toward taking very few units in many PSUs. In both cases the analytical allocation becomes degenerate, so n_cluster() rejects values numerically too close to 0 or 1.

Nonresponse acts at whichever stage it happens

A cluster design can lose units at more than one stage, and the losses are not interchangeable, so each has its own argument named for the stage it acts on. Writing the three-stage CV out with realized takes shows why:

$$cv^2 = \frac{V k_1 \delta_1}{a\,r_{psu}} + \frac{V k_2 (1 + \delta_2 (q r - 1))}{a\,r_{psu}\, m\,r_{ssu}\, q\,r}$$

resp_rate_psu divides both terms, so losing whole PSUs is a pure sample-size loss. resp_rate_ssu divides only the second. resp_rate divides the second and enters the \(\delta_2\) bracket, because it shrinks the realized final-stage take and so changes the clustering penalty itself. None is recoverable from the others.

It follows that the later-stage rates move the cost-optimal design while the PSU rate does not. For two stages the optimal take becomes $$b^* = \sqrt{\frac{C_1 (1 - \mathrm{icc})}{C_2\,\mathrm{icc}\,r}},$$ with r the ultimate-unit rate; resp_rate_psu is absent because it scales cost without moving that trade-off. Sizes and costs stay gross: $n counts units to issue and $cost pays for them, while the variance reads what they realize.

This is a deterministic expected-take approximation. It substitutes the expected realized stage counts into the planning variance and assumes response is noninformative for it. Below one expected respondent per unit the substitution stops describing the design, and that is an error naming the approximation rather than the design.

These functions assume sampling fractions are negligible at each stage (equivalent to sampling with replacement). No finite population correction is applied. This is standard for multistage planning when cluster populations are large relative to the sample.

References

Valliant, R., Dever, J. A., and Kreuter, F. (2018). Practical Tools for Designing and Weighting Survey Samples (2nd ed.). Springer. Ch. 9.

See also

prec_cluster() for the inverse, varcomp() for estimating variance components, n_multi_cluster() for several indicators at once, and n_alloc() for a stratified multistage allocation.

Other sample size functions: n_alloc(), n_change(), n_mean(), n_multi(), n_multi_cluster(), n_panel(), n_pooled(), n_prop(), n_twophase()

Examples

# 2-stage, budget mode
n_cluster(stage_cost = c(500, 50), icc = 0.05, budget = 100000)
#> Optimal 2-stage allocation
#> field design: n_psu = 80 | n_per_psu = 15 -> total n = 1200
#> cv = 0.0376, cost = 100000
#> continuous optimum: n_psu = 84.08997 | n_per_psu = 13.78405 (cv = 0.0376, cost = 100000)
#> design df = 79

# 2-stage, CV mode
n_cluster(stage_cost = c(500, 50), icc = 0.05, cv = 0.05)
#> Optimal 2-stage allocation
#> field design: n_psu = 52 | n_per_psu = 12 -> total n = 624
#> cv = 0.0498, cost = 57200
#> continuous optimum: n_psu = 47.5681 | n_per_psu = 13.78405 (cv = 0.0500, cost = 56568)
#> design df = 51

# 2-stage, fixed n_psu
n_cluster(stage_cost = c(500, 50), icc = 0.05, budget = 100000, n_psu = 40)
#> Optimal 2-stage allocation
#> field design: n_psu = 40 | n_per_psu = 40 -> total n = 1600
#> cv = 0.0429, cost = 100000
#> continuous optimum: n_psu = 40 | n_per_psu = 40 (cv = 0.0429, cost = 100000)
#> design df = 39

# 2-stage, fixed n_per_psu (MICS/DHS style: 20 households per cluster)
n_cluster(stage_cost = c(500, 50), icc = 0.05, budget = 100000, n_per_psu = 20)
#> Optimal 2-stage allocation
#> field design: n_psu = 66 | n_per_psu = 20 -> total n = 1320
#> cv = 0.0384, cost = 99000
#> continuous optimum: n_psu = 66.66667 | n_per_psu = 20 (cv = 0.0382, cost = 100000)
#> design df = 65

# 3-stage
n_cluster(stage_cost = c(500, 100, 50), icc = c(0.01, 0.05), cv = 0.05)
#> Optimal 3-stage allocation
#> field design: n_psu = 20 | n_per_psu = 6 | n_per_ssu = 5 -> total n = 600
#> cv = 0.0498, cost = 52000
#> continuous optimum: n_psu = 20.24698 | n_per_psu = 4.974937 | n_per_ssu = 6.164414 (cv = 0.0500, cost = 51243)
#> design df = 19

# 3-stage, fixed n_psu + n_per_ssu (solve for n_per_psu)
n_cluster(
  stage_cost = c(500, 100, 50), icc = c(0.01, 0.05),
  budget = 500000, n_psu = 50, n_per_ssu = 8
)
#> Optimal 3-stage allocation
#> field design: n_psu = 50 | n_per_psu = 19 | n_per_ssu = 8 -> total n = 7600
#> cv = 0.0194, cost = 500000
#> continuous optimum: n_psu = 50 | n_per_psu = 19 | n_per_ssu = 8 (cv = 0.0194, cost = 500000)
#> design df = 49

# With fixed overhead cost
n_cluster(stage_cost = c(500, 50), icc = 0.05, budget = 100000, fixed_cost = 5000)
#> Optimal 2-stage allocation
#> field design: n_psu = 76 | n_per_psu = 15 -> total n = 1140
#> cv = 0.0386, cost = 100000 (fixed: 5000)
#> continuous optimum: n_psu = 79.88547 | n_per_psu = 13.78405 (cv = 0.0386, cost = 100000)
#> design df = 75