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(indicators, ...)
# Default S3 method
prec_multi(
indicators,
...,
domains = NULL,
prop_method = c("wald", "wilson", "logodds", "beta"),
resp_rate = 1,
plan = NULL
)
# S3 method for class 'svyplan_n'
prec_multi(indicators, ...)
# S3 method for class 'svyplan_cluster'
prec_multi(indicators, ...)Arguments
- indicators
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:
p,var, or the ratio quartetr,cv_num,cv_denandcomponent_cor: what you are measuring (seen_multi()). Exactly one estimand per row.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
indicatorsto treat as domain variables, orNULL(default) for no domains. All names must exist inindicators. Domain columns are preserved in the result for round-trip conversion back ton_multi().- prop_method
Proportion CI method, one of
"wald"(default),"wilson","logodds", or"beta". This is passed toprec_prop()for proportion rows and ignored for mean rows. An optionalprop_methodcolumn inindicatorsoverrides this default on a per-row basis.- resp_rate
Default expected response rate at the ultimate unit, in (0, 1]. Used for rows whose
resp_ratecolumn is absent orNA, and a non-missing row value overrides it.- plan
A
svyplan()profile providing default design parameters.
Value
A svyplan_prec object with a $detail data frame containing
per-indicator precision: .se, .moe, .rmoe, and .cv. .rmoe
is .moe as a fraction of the row's own estimand, p for a
proportion, abs(mu) for a mean and abs(r) for a ratio, and NA for
a row carrying none of them.
Details
Building the indicators data frame
The indicators 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:
indicators <- 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
p,varorrper row.muPopulation mean. Required for CV output when
varis specified, because CV = SE / mean.rAnticipated ratio of two totals, marking a ratio row. It requires
cv_num,cv_denandcomponent_coralongside it, and nounit_relvar, which the moments derive. Seeprec_ratio().cv_num,cv_denCoefficients of variation of a ratio row's numerator and denominator, strictly positive.
component_corCorrelation between a ratio row's numerator and denominator across units, in [-1, 1].
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","logodds", or"beta". Only for rows withp.dfDegrees of freedom of the variance estimator, typically sampled PSUs minus strata, and available from
design_df(). It switches that row's interval quantile from normal to t, under every proportion method and on mean rows alike.NA(the default) applies no adjustment.resp_rateExpected response rate at the ultimate unit (default 1). A cluster design spends a rate at stage 1 too, and
prec_cluster()names that columnresp_rate_psu.
Domain columns are specified via the domains parameter.
prec_multi() delegates proportion rows to prec_prop(), mean rows to
prec_mean() and ratio rows to prec_ratio(). Use prop_method or a
indicators$prop_method column to choose "wald", "wilson",
"logodds" or "beta" for proportion rows. It is ignored elsewhere.
See also
n_multi() for the inverse, prec_cluster() for a multistage
cluster design over the same indicator table, and prec_prop() and
prec_mean() for single-indicator precision.
Other multi-indicator functions:
n_multi()
Examples
# Simple mode: precision for three indicators at n = 400
indicators <- data.frame(
name = c("stunting", "vaccination", "anemia"),
p = c(0.30, 0.70, 0.10),
n = c(400, 400, 400)
)
prec_multi(indicators)
#> Multi-indicator sampling precision
#>
#> name .se .moe .rmoe .cv
#> stunting 0.02291288 0.04490842 0.14969472 0.07637626
#> vaccination 0.02291288 0.04490842 0.06415488 0.03273268
#> anemia 0.01500000 0.02939946 0.29399460 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 .rmoe .cv
#> 1 0.01089725 0.0216831 0.4336621 0.2179449