Skip to contents

Compute the sampling error (SE, MOE, CV) for multiple survey indicators given a sample size. This is the inverse of n_multi().

Usage

prec_multi(targets, ...)

# Default S3 method
prec_multi(
  targets,
  domains = NULL,
  stage_cost = NULL,
  budget = NULL,
  n_psu = NULL,
  joint = FALSE,
  prop_method = "wald",
  plan = NULL,
  ...
)

# S3 method for class 'svyplan_n'
prec_multi(targets, ...)

# S3 method for class 'svyplan_cluster'
prec_multi(targets, ...)

Arguments

targets

For the default method: a data frame where each row is one survey indicator, in the same format as n_multi() but with an additional n column giving the sample size. This lets you answer: "given this sample size, what precision do I get for each indicator?"

At minimum, each row needs:

  • p or var: what you are measuring (see n_multi()).

  • n: the sample size to evaluate.

See the Details section for the full column reference.

For svyplan_n or svyplan_cluster objects: a result from n_multi().

...

Additional arguments passed to methods.

domains

Character vector of column names in targets to treat as domain variables, or NULL (default) for no domains. All names must exist in targets. Domain columns are preserved in the result for round-trip conversion back to n_multi().

stage_cost

Numeric vector of per-stage costs. NULL (default) for simple mode; length 2 or 3 for multistage mode.

budget

Total budget. Does not affect precision calculations; preserved for round-trip conversion back to n_multi().

n_psu

Fixed stage-1 sample size. Does not affect precision calculations; preserved for round-trip conversion back to n_multi().

joint

Logical. Does not affect precision calculations; preserved for round-trip conversion back to n_multi().

prop_method

Proportion CI method for simple mode, one of "wald" (default), "wilson", or "logodds". This is passed to prec_prop() for proportion rows and ignored for mean rows and multistage mode. An optional prop_method column in targets overrides this default on a per-row basis.

plan

A svyplan() profile providing default design parameters.

Value

A svyplan_prec object with a $detail data frame containing per-indicator precision.

Details

Building the targets data frame

The targets data frame uses the same structure as n_multi(), with the addition of a required n column specifying the sample size to evaluate. A minimal example:

targets <- data.frame(
  name = c("stunting", "vaccination", "anemia"),
  p    = c(0.30, 0.70, 0.10),
  n    = c(400, 400, 400)
)

See n_multi() for a detailed guide on constructing indicator rows (choosing between p and var, setting per-row design effects, etc.).

Column reference

name

Indicator label (optional).

p

Expected proportion, in (0, 1). One of p or var per row (see n_multi()).

var

Population variance. One of p or var per row.

mu

Population mean. Required for CV output when var is specified, because CV = SE / mean.

n

Sample size to evaluate (required). In simple mode, one number per row. In multistage mode, this is the stage-1 (PSU) sample size; add psu_size and optionally ssu_size columns for the per-stage cluster sizes.

psu_size

Stage-2 sample size per PSU (multistage only). Required for 2+ stage designs in multistage mode.

ssu_size

Stage-3 sample size per SSU (3-stage only).

alpha

Significance level (default 0.05).

deff

Design effect multiplier (simple mode only, default 1).

N

Population size (simple mode only, default Inf).

prop_method

Proportion CI method: "wald" (default), "wilson", or "logodds". Only for rows with p in simple mode.

resp_rate

Expected response rate (default 1).

delta_psu, delta_ssu

Homogeneity measures (multistage).

rel_var

Unit relvariance. If omitted, derived from p or var/mu.

k_psu, k_ssu

Ratio parameters (multistage, default 1).

Domain columns are specified via the domains parameter.

In simple mode, prec_multi() delegates proportion rows to prec_prop() and mean rows to prec_mean(). Use prop_method or a targets$prop_method column to choose "wald", "wilson", or "logodds" for proportion rows.

See also

n_multi() for the inverse (compute n from precision targets), prec_prop(), prec_mean() for single-indicator precision.

Examples

# Simple mode: precision for three indicators at n = 400
targets <- data.frame(
  name = c("stunting", "vaccination", "anemia"),
  p    = c(0.30, 0.70, 0.10),
  n    = c(400, 400, 400)
)
prec_multi(targets)
#> Multi-indicator sampling precision
#>  name        .se        .moe       .cv       
#>  stunting    0.02291288 0.04490842 0.07637626
#>  vaccination 0.02291288 0.04490842 0.03273268
#>  anemia      0.01500000 0.02939946 0.15000000

# Wilson precision for a rare proportion
prec_multi(data.frame(p = 0.05, n = 400), prop_method = "wilson")
#> Multi-indicator sampling precision
#>  name .se        .moe      .cv      
#>  1    0.01106301 0.0216831 0.2212602