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,
prop_method = c("wald", "wilson", "logodds"),
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 additionalncolumn 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:
porvar: what you are measuring (seen_multi()).n: the sample size to evaluate.
See the Details section for the full column reference.
For
svyplan_nobjects: a result fromn_multi().- ...
Additional arguments passed to methods. Unused arguments are rejected.
- domains
Character vector of column names in
targetsto treat as domain variables, orNULL(default) for no domains. All names must exist intargets. Domain columns are preserved in the result for round-trip conversion back ton_multi().- prop_method
Proportion CI method, one of
"wald"(default),"wilson", or"logodds". This is passed toprec_prop()for proportion rows and ignored for mean rows. An optionalprop_methodcolumn intargetsoverrides this default on a per-row basis.- plan
A
svyplan()profile providing default design parameters.
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
nameIndicator label (optional).
pExpected proportion, in (0, 1). One of
porvarper row (seen_multi()).varPopulation variance. One of
porvarper row.muPopulation mean. Required for CV output when
varis specified, because CV = SE / mean.nSample size to evaluate (required), with one value per indicator row.
alphaSignificance level (default 0.05).
deffDesign effect multiplier (default 1).
NPopulation size (default
Inf).prop_methodProportion CI method:
"wald"(default),"wilson", or"logodds". Only for rows withp.resp_rateExpected response rate (default 1).
Domain columns are specified via the domains parameter.
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, prec_multi_cluster() for
multistage cluster designs, and prec_prop() and 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