Skip to contents

Compute the sampling error (SE, MOE, CV) for a given S-stage cluster sample allocation (S >= 2). This is the inverse of n_cluster().

Usage

# S3 method for class 'data.frame'
prec_cluster(
  x,
  ...,
  domains = NULL,
  stage_cost = NULL,
  resp_rate = 1,
  eligibility_rate = 1,
  eligible_per_unit = 1,
  N = NULL,
  fpc = c("auto", "none", "stage"),
  plan = NULL
)

prec_cluster(x = NULL, ...)

# Default S3 method
prec_cluster(
  x = NULL,
  ...,
  n = NULL,
  icc = NULL,
  unit_relvar = NULL,
  var_ratio = NULL,
  resp_rate = 1,
  eligibility_rate = 1,
  eligible_per_unit = 1,
  N = NULL,
  fpc = c("auto", "none", "stage"),
  stage_cost = NULL,
  plan = NULL
)

# S3 method for class 'svyplan_cluster'
prec_cluster(x, ...)

Arguments

x

First argument used for S3 dispatch. Supply a numeric vector of per-stage sample sizes (same as n), a data frame of indicators (one row per indicator carrying stage sizes n_1, take_2, ..., take_S and homogeneities icc_1, ..., icc_{S-1}), a svyplan_cluster allocation from n_cluster(), or a svyplan() profile. Leave NULL when supplying n by name.

...

Additional arguments passed to methods. Unused arguments are rejected.

domains

Optional character vector naming domain columns in x (data frame method).

stage_cost

Optional per-stage costs (length stages), recorded on the result so a later round trip to n_cluster() can re-solve the design. Costs do not enter the precision calculation.

resp_rate

Expected response rate(s) in (0, 1], default 1. A scalar applies to the final stage (ultimate units) with earlier stages set to 1. A vector of length stages supplies stage-1 through stage-S rates. Its names, if given, place each rate, as in n_cluster().

eligibility_rate

Share of issued final-stage units in scope, in (0, 1]. Default 1.

eligible_per_unit

Eligible units per final-stage unit, a positive number, default 1. For the data.frame method, an eligible_per_unit column sets it per row with NA falling back to this scalar.

N

Optional numeric vector of length stages giving aggregate population counts from stage 1 to stage S (outermost to innermost). Its names, if given, place each count, as in n_cluster().

fpc

Which finite population correction the variance carries. "auto" (default) applies stage-by-stage correction ("stage") whenever N (or population columns) is supplied, and "none" otherwise. "stage" requires population counts. Supply population counts only with "auto" or "stage".

plan

Optional svyplan() object providing design defaults.

n

Numeric vector of per-stage sample sizes of length S >= 2 (outermost stage 1 to innermost stage S). Optional unique names are preserved. Optional when passed as x in the default method.

icc

Numeric vector of stage homogeneities of length stages - 1, or a svyplan_varcomp object.

unit_relvar

Unit relvariance, default 1. Required beside a svyplan_varcomp backed out of a design effect and refused beside one estimated from data. See n_cluster().

var_ratio

Ratio of stage component unit variance to the analysis variable's unit variance, default 1. A scalar supplies stage 1 and derives deeper ratios via k_s = k_{s-1} * (1 - icc_{s-1}). In a vector, an NA after the first entry is derived the same way. Refused when icc is a svyplan_varcomp.

Value

A svyplan_prec object with type = "cluster" and components $se, $moe, and $cv. In the single-indicator method, only $cv is computable ($se and $moe are NA). With an indicator data frame, per-indicator precision is in $detail (.se, .moe, .rmoe, .cv). $params stores the stage response rates as resp_rate_1, ..., resp_rate_{S-1} and resp_rate, the names the allocation frames use.

Details

For an \(S\)-stage design with gross stage sizes \(n_1, \dots, n_S\), effective stage response multipliers \(r_1, \dots, r_S\), stage variance components \(R_s = V k_s \delta_s\) (\(s < S\)) and \(R_S = V k_{S-1}(1 - \delta_{S-1})\), and per-parent population capacities \(M_1 = N_1\), \(M_s = N_s / N_{s-1}\) for \(1 < s < S\) and \(M_S = N e / N_{S-1}\), where \(e\) is eligibility_rate * eligible_per_unit (all infinite under fpc = "none"), $$CV = \sqrt{\sum_{s=1}^{S} \frac{R_s}{\prod_{j=1}^{s} n_j r_j} \left(1 - \frac{n_s r_s}{M_s}\right)}.$$

References

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

See also

n_cluster() for the inverse operation, varcomp() for estimating variance components, and prec_multi() for single-stage multi-indicator precision.

Other cluster design functions: n_cluster(), varcomp()

Examples

# Direct usage: 2-stage, 3-stage, and 4-stage
prec_cluster(c(50, 12), icc = 0.05)
#> Sampling precision for 2-stage cluster
#> stage_1 = 50 | stage_2 = 12 -> total n = 600
#> cv = 0.0508
prec_cluster(c(50, 12, 8), icc = c(0.01, 0.05))
#> Sampling precision for 3-stage cluster
#> stage_1 = 50 | stage_2 = 12 | stage_3 = 8 -> total n = 4800
#> cv = 0.0219
prec_cluster(c(15, 5, 4, 8), icc = c(0.01, 0.03, 0.06))
#> Sampling precision for 4-stage cluster
#> stage_1 = 15 | stage_2 = 5 | stage_3 = 4 | stage_4 = 8 -> total n = 2400
#> cv = 0.0404

# Round-trip from n_cluster
res <- n_cluster(c(500, 50), icc = 0.05, cv = 0.05)
prec_cluster(res)
#> Sampling precision for 2-stage cluster (continuous optimum)
#> stage_1 = 47.5681 | stage_2 = 13.78405 -> total n = 655.681
#> cv = 0.0500
prec_cluster(res$operational$n, icc = 0.05)
#> Sampling precision for 2-stage cluster
#> stage_1 = 52 | stage_2 = 12 -> total n = 624
#> cv = 0.0498

# Stage finite population correction (auto-enabled when N is supplied)
prec_cluster(c(12, 20), icc = 0.05, N = c(16, 2400))
#> Sampling precision for 2-stage cluster
#> stage_1 = 12 | stage_2 = 20 -> total n = 240
#> corrected by stage for N = c(16, 2400)
#> cv = 0.0669

# Several indicators under one 2-stage allocation
indicators <- data.frame(
  name   = c("stunting", "anemia"),
  p      = c(0.30, 0.10),
  n_1    = c(60, 60),
  take_2 = c(12, 12),
  icc_1  = c(0.02, 0.05)
)
prec_cluster(indicators)
#> Multi-indicator sampling precision
#> 
#>  name     .se        .moe       .rmoe     .cv       
#>  stunting 0.01886355 0.03697187 0.1232396 0.06287848
#>  anemia   0.01391941 0.02728154 0.2728154 0.13919411