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,
eligibility_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, eligibility_rate = 1)
# S3 method for class 'svyplan_cluster'
effective_n(
x,
...,
n = NULL,
resp_rate = NULL,
eligibility_rate = NULL,
weights = NULL,
strata = NULL
)
# S3 method for class 'svyplan_prec'
effective_n(
x,
...,
n = NULL,
resp_rate = NULL,
eligibility_rate = NULL,
weights = NULL,
strata = NULL
)
# S3 method for class 'svyplan_varcomp'
effective_n(
x,
...,
n = NULL,
resp_rate = 1,
eligibility_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,
eligibility_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, since 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. A published DEFT is squared first. See
varcomp()for that and for removing the published survey's weighting loss.- resp_rate
Expected response rate among eligible units, 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. An override re-evaluates the plan at that rate, so the take that responds and with it the clustering factor follow. On an allocation or a cluster plan it is the ultimate-unit rate, one value or one per stratum, and PSU and SSU response stay the plan's. See the nonresponse section of svyplan-package for what the rate counts.- eligibility_rate
Share of issued units in scope, in (0, 1]. Default 1. It nets
ndown withresp_rate. Whenxis a plan, its own value is used unless you override it here. An override re-evaluates the plan, so on an allocation the population weights and the population variance follow it too.- 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. The total is netted by every stage's response rate and byeligible_per_unit, so the result counts eligible respondents, as thecvdoes.effective_n(svyplan_prec): Use the total and design features of aprec_cluster()result, or the stratum counts of aprec_alloc()result as for an allocation.prec_alloc(x, n = x$detail$n_int)gives the whole stratum counts. On a cluster frame it keeps the plan's takes. 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. Each stratum's response, eligibility and PSU response rates, from the arguments or the frame, net its own count down, so the result is the population variance over the plan's variance without FPC. A scalarnrescales the continuous allocation and keeps its stratum shares. To evaluate the whole stratum counts, passprec_alloc(x, n = x$detail$n_int)asx. An allocation from stratum sizes alone reads its whole counts throughout, as its design effect does.
See also
design_effect() for the design effect itself.
Other design input functions:
design_df(),
design_effect(),
svyplan()
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