Convert a planned sample size into the simple-random-sample size that
would give the same precision, n * resp_rate / deff. This is the
mirror of design_effect() and takes the same arguments.
Usage
effective_n(x = NULL, ...)
# Default S3 method
effective_n(
x = NULL,
...,
n = NULL,
deff = NULL,
resp_rate = 1,
icc = NULL,
n_per_psu = NULL,
n_per_ssu = NULL,
var_ratio = 1,
weights = NULL,
strata = NULL
)
# S3 method for class 'svyplan_deff'
effective_n(x, ..., n = NULL, resp_rate = 1)
# S3 method for class 'svyplan_cluster'
effective_n(x, ..., n = NULL, resp_rate = NULL, weights = NULL, strata = NULL)
# S3 method for class 'svyplan_prec'
effective_n(x, ..., n = NULL, resp_rate = NULL, weights = NULL, strata = NULL)
# S3 method for class 'svyplan_varcomp'
effective_n(
x,
...,
n = NULL,
resp_rate = 1,
n_per_psu = NULL,
n_per_ssu = NULL,
weights = NULL,
strata = NULL
)
# S3 method for class 'svyplan_n'
effective_n(x, ..., n = NULL, resp_rate = NULL, weights = NULL)Arguments
- x
A
svyplan_defffromdesign_effect(), an_cluster()orprec_cluster()allocation, avarcomp()estimate, ann_alloc()allocation, orNULL(default) to build the design effect from the component arguments. An_prop()orn_mean()result is not one of these: its design effect is thedeffyou supplied rather than something to be derived, so pass the two directly aseffective_n(n = x$n, deff = x$params$deff).- ...
Additional arguments passed to methods. Unused arguments are rejected.
- n
Gross planned sample size, counted as units issued. Required unless it can be derived from
weights,strata$n, orx.- deff
Design effect to apply directly, instead of building one from components.
- resp_rate
Expected response rate, in (0, 1]. Default 1. It nets
ndown to the units the design expects to analyze before the design effect is applied. Whenxis a plan, its own rate is used unless you override it here.- icc, n_per_psu, n_per_ssu, var_ratio, weights, strata
Design components, with the same meaning as in
design_effect().
Value
A numeric scalar: the effective sample size,
n * resp_rate / deff. It is not rounded, and it can exceed n when
the design effect is below 1 (a stratification gain, for instance).
Details
The design effect is built exactly as in design_effect(), from
whichever of the clustering, weighting, and stratification components
you supply. n is the gross planned sample size; it is taken from the
arguments when it can be (the length of weights, the total of
strata$n, or the total of the plan you pass as x), and must be given
explicitly otherwise.
Sizes are counted as units issued, so nonresponse has to be taken
off before the design effect is applied: a design that issues n and
analyzes n * resp_rate of them carries the information of
n * resp_rate / deff simple random draws. This is the identity the
allocation and precision functions plan on, and the one reported in the
n_eff column of an n_alloc() table. Passing a plan as x picks up
the response rate it was built with, so effective_n(plan) and that
column agree; supply resp_rate yourself when you pass a bare n that
has not already been netted down.
The design effect it divides by is a without-FPC planning quantity, so
for an n_alloc() result the effective size inherits that scale: it
answers how many simple random draws carry the same information under
the planning model, not how many the finite-population variance from
prec_alloc() would imply once sampling fractions are material. A
generalized allocation has no single design effect and is refused here
for the same reason it is in design_effect().
effective_n() is a planning tool. To compute the effective sample size
realized by collected data, use survey::svymean(..., deff = TRUE) with
the actual weights, strata, and clusters.
Methods (by class)
effective_n(default): Build the design effect from planning components.effective_n(svyplan_deff): Apply a design effect already built bydesign_effect().effective_n(svyplan_cluster): Use the total sample size and design features of an_cluster()orprec_cluster()allocation.effective_n(svyplan_prec): Use the total and design features of aprec_cluster()result. Othersvyplan_prectypes carry thedeffyou supplied rather than one to be derived, and are rejected.effective_n(svyplan_varcomp): Use the design features of avarcomp()estimate.nand the stage takes are your design choice.effective_n(svyplan_n): Use the total and design features of ann_alloc()allocation, dividing by the allocation's own variance ratio. The frame needsmeanalongsideNandsd, since without the stratum means the population variance that ratio divides by is not identified.
See also
design_effect() for the design effect itself.
Examples
# From a design effect you already built
effective_n(design_effect(icc = 0.05, n_per_psu = 25), n = 1200)
#> [1] 545.4545
# Straight from the components
effective_n(n = 1200, icc = 0.05, n_per_psu = 25)
#> [1] 545.4545
# From planned weights, where n is the number of units
effective_n(weights = rep(c(1, 4), c(300, 100)))
#> [1] 257.8947
# From a planned allocation
effective_n(strata = data.frame(N = c(50000, 120000), n = c(600, 400)))
#> [1] 719.5021
# From an optimized cluster plan
effective_n(n_cluster(stage_cost = c(500, 50), icc = 0.05, cv = 0.05))
#> [1] 400