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,
eligibility_rate = 1,
eligible_per_unit = 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(). Every row is assessed at the size the result chose, the commonn, a domain's quota, or under natural domain sampling its expected yieldn * share. Rows with only a floor are dropped, since they have no precision to report.- ...
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(), so none can be callednameor start with a dot.- 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 among eligible ultimate units, in (0, 1]. Used for rows whose
resp_ratecolumn is absent orNA, and a non-missing row value overrides it. See the nonresponse section of svyplan-package for what the rate counts.- eligibility_rate
Default share of issued units in scope, in (0, 1]. Used for rows whose
eligibility_ratecolumn is absent orNA, and a non-missing row value overrides it. See the nonresponse section of svyplan-package.- eligible_per_unit
Default eligible units per sampled unit, a positive number that can exceed 1. Used for rows whose
eligible_per_unitcolumn is absent orNA. Proportion and mean rows. Seen_multi().- 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. The domains columns come first, so each
row can be joined back to its domain.
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).
2 * pnorm(-2)gives the multiplier of 2 that the DHS and MICS manuals use in place of 1.96.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.eligible_per_unitEligible units per sampled unit for the row's estimate, as in
prec_prop()andprec_mean(). Proportion and mean rows. The several-indicators mode ofprec_cluster()refuses it.
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.
A domain that takes most of its PSUs
A deff column carries the clustering of a design whose first stage is
treated as drawn with replacement, and N corrects only for the units.
Nothing here knows how many PSUs a domain holds. A small domain, such as
an island district of 16 enumeration areas, can then be given more PSUs
than it has, and a sample that takes most of them is assessed as if
they were a few among many. n_alloc() and prec_alloc() read N_psu
in the frame and, with fpc = "stage", apply the stage-by-stage
correction. They size and assess such a domain, as the prec_alloc()
examples show.
See also
n_multi() for the inverse, prec_cluster() for a multistage
cluster design over the same indicator table, prec_alloc() for a
stratified allocation over the whole population and its domains in one
call, 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