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:
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
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; 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 p or abs(mu), and NA for a
row carrying neither.
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
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","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).
prec_multi_cluster()spends its rate at stage 1 and names the columnresp_rate_psu.
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
indicators$prop_method column to choose "wald", "wilson",
"logodds" or "beta" 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.
Other precision functions:
prec_alloc(),
prec_change(),
prec_cluster(),
prec_mean(),
prec_multi_cluster(),
prec_panel(),
prec_pooled(),
prec_prop(),
prec_twophase()
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