Sample size for the average of several occasions of a repeated survey
Source:R/n_pooled.R
n_pooled.RdCompute the sample size per occasion required to estimate the average of
several occasions of a repeated survey, the equal-weight mean of the
occasion estimates, with a specified margin of error or coefficient of
variation, given how far the occasions overlap. An annual average built
from quarterly rounds is the ordinary case, and that average is what
"pooled" names here. This is the inverse of prec_pooled().
Usage
n_pooled(var = NULL, ...)
# Default S3 method
n_pooled(
var = NULL,
occasions,
...,
sd = NULL,
p = NULL,
r = NULL,
cv_num = NULL,
cv_den = NULL,
component_cor = NULL,
mu = NULL,
moe = NULL,
cv = NULL,
rmoe = NULL,
alpha = 0.05,
N = Inf,
deff = 1,
resp_rate = 1,
eligibility_rate = 1,
overlap = 0,
overlap_cor = NULL,
cor_decay = NULL,
overlap_draw = c("fixed", "independent"),
df = NULL,
plan = NULL
)
# S3 method for class 'svyplan_prec'
n_pooled(var, ..., moe = NULL, cv = NULL, rmoe = NULL)Arguments
- var
For the default method: the population variance \(S^2\) on one occasion, taken to be the same on each. Estimate from a pilot study, a previous round, or published data. Supply this,
porr. Forsvyplan_precobjects: a precision result fromprec_pooled().- ...
Additional arguments passed to methods. Unused arguments are rejected.
- occasions
Number of occasions entering the average, at least 2.
- sd
Population standard deviation on one occasion, an alternative spelling of
var. Supply exactly one ofvarorsd.- p
The proportion being averaged, as an alternative to
var. The occasion variance is then \(Np(1-p)/(N-1)\), the same finite population variancen_prop()uses, andmuis determined and must not be supplied.- r
The ratio of totals being averaged,
mean(y) / mean(x)as inn_ratio(), taken to be the same on each occasion, as an alternative tovarandp.muis thenrand must not be supplied. See the section on a ratio of totals.- cv_num
Coefficient of variation of the ratio's numerator variable. Used with
ronly.- cv_den
Coefficient of variation of the ratio's denominator variable. Used with
ronly.- component_cor
Correlation between the ratio's numerator and denominator on one unit, in \([-1, 1]\). Used with
ronly. It is notoverlap_cor, which correlates the occasions.- mu
The level being averaged, on the
varscale. Required whencvorrmoeis specified, both being defined against it. Determined bypon the proportion scale.- moe
Desired margin of error on the pooled estimate, the half-width of its confidence interval. Specify exactly one of
moe,cv, orrmoe.- cv
Target standard error relative to the level. Requires
mu. Specify exactly one ofmoe,cv, orrmoe.- rmoe
Target margin of error relative to the level. It is
moe / abs(mu)and requiresmu. Specify exactly one ofmoe,cv, orrmoe.- alpha
Significance level, default 0.05.
- N
Population size.
Inf(default) means no finite population correction.- deff
Design effect multiplier (> 0), applied to the variance of the pooled estimate rather than to any one occasion.
- resp_rate
Expected response rate among eligible units, in (0, 1]. Default 1 (no adjustment). Each occasion's size is inflated by
1 / resp_rate. It is a single round's response, not attrition across a panel. See the nonresponse section of svyplan-package for what the rate counts and what this adjustment does and does not claim.- eligibility_rate
Share of issued units in scope, such as dwellings found occupied, in (0, 1]. Default 1. It applies to every occasion, and with a finite
Nthe population in scope isN * eligibility_rate. See the nonresponse section of svyplan-package.- overlap
Fraction of one occasion's responding sample carried into a later one, in \([0, 1]\). One number, meaning the same overlap at every lag, or one per lag. A
design_overlap()result is accepted directly atresp_rate = 1. Seeprec_pooled()on why not below it.0(default) makes the occasions independent.- overlap_cor
Correlation between two occasions among the units they share, in \([0, 1]\). One number for every lag, or one per lag. Default 0, which makes overlap irrelevant. Supply this or
cor_decay, not both. For a ratio it is the correlation of the ratio's linearized variable.- cor_decay
Correlation at lag \(m\) taken as \(\rho^m\), an alternative to stating
overlap_corlag by lag.- overlap_draw
How the shared units are drawn,
"fixed"(default) for a fixed count drawn with the rest of each occasion's sample, or"independent"for a retained panel topped up on each occasion by a fresh sample drawn independently of it from the whole frame. The second is defined for two occasions, or for more when no lag overlaps. Seeprec_pooled().- df
Degrees of freedom of the variance estimator the planned design will have, available from
design_df(). It switches the interval quantile from normal to t.NULL(default) applies no adjustment.- plan
Optional
svyplan()object providing design defaults.
Value
A svyplan_n object with type = "pooled":
nRequired size per occasion, continuous and gross. It already carries
deffand the1 / (resp_rate * eligibility_rate)inflation, so it counts the units to release on each occasion, not the completed interviews.$nandas.double()keep the unrounded value, which is what makes the round trip throughprec_pooled()exact, whereasprint()rounds up. This is not a count of distinct frame units:overlapis measured among respondents, so it says how often a respondent is measured again and leaves the issued sample's own overlap unstated. At full response the two coincide and the series consumes fewer thanoccasions * ndistinct units. Below it, how many is a question this function has not been told enough to answer.se,moe,cv,rmoePrecision the design achieves at that size, the same values
prec_pooled()reports for the same inputs.cvandrmoeareNAunless the level is known and non-zero.paramsThe validated inputs, including whichever of
moe,cv, orrmoewas the target,overlapandoverlap_coras resolved vectors of one entry per lag, theoverlap_basisthey were resolved under, and adesign_overlap()object asoverlap_rotation. A ratio keepsr, its three moments and itsunit_relvar,varthen being the variance of its linearized variable.
Details
A required size must fit the finite frame at each positive-overlap lag,
(2 - overlap[lag]) * n * resp_rate <= N, and at each lag of a
design_overlap() object that shares no unit, as prec_pooled()
describes, where the rotation and bare readings are compared. A target violating a
pairwise bound is rejected, as is a size producing an invalid covariance
matrix. The whole size ceiling(n) that print() and as.integer()
report must meet the same conditions, and a target whose continuous size
meets them but whose whole size does not is refused, since no whole size
then reaches it.
See prec_pooled() for these necessary feasibility conditions.
The pooled variance is \(deff\{A/(n r) + B\}\) in the gross size per
occasion, with \(r\) the response rate times the eligibility rate,
\(N\) the population in scope, N * eligibility_rate, \(T\) the
number of occasions and, under overlap_draw = "fixed",
$$A = \frac{S^2}{T^2}\Big[T + 2\sum_{m=1}^{T-1}(T-m)\rho_m o_m\Big], \qquad B = -\frac{S^2}{NT^2}\Big[T + 2\sum_{m=1}^{T-1}(T-m)\rho_m c_m\Big],$$
where \(c_m = 1\{o_m > 0\}\) for a bare overlap
and \(c_m = 1\) at every lag of a design_overlap() object, whose lags
that share no unit keep the population term of two disjoint samples.
Under overlap_draw = "independent" the population terms in \(B\)
carry the factors prec_pooled() describes for independent draws
instead. In both cases the target inverts in closed form,
$$n = \frac{deff\,A}{r\,(se^2 - deff\,B)}.$$
\(B \le 0\) always under the nonnegative correlation contract, since its bracket is positive, so the divisor cannot vanish and no target is out of reach for want of precision however much the occasions overlap. Overlap raises the size a target needs, but it does not put a floor under the precision. The size can still exceed \(N\), which is the ordinary boundary and is reported as unattainable there as everywhere else.
A ratio of totals
A ratio \(R = \bar Y / \bar X\) enters through its
linearized variable \(z = (y - Rx)/\bar X\),
whose variance is \(R^2 L\), with \(L\) the unit relative variance
n_ratio() reports. That variance takes the place of var here and is
what params$var records, and overlap_cor and cor_decay describe the
correlation of \(z\) between occasions. A ratio whose level moves
between occasions is outside the model, as a moving mean is.
What is sized is the equal-weight average of the occasion ratios. A ratio of the pooled totals, \(\sum_t \hat Y_t / \sum_t \hat X_t\), is a different estimator even at one level. To first order its error is \(\sum_t w_t(\hat R_t - R)\), with \(w_t\) the occasion's share of the denominator total, so it has the variance computed here only when the denominator totals are equal across occasions. Otherwise its variance differs, and over independent occasions it is larger, equal weights being the ones that minimize it there. Over two independent occasions whose denominator totals stand 1 to 3, it is 25 percent larger than the equal-weight average's. Sizing an annual rate defined on pooled totals with this function treats the denominator totals as equal, which is close for a stable population and is an approximation to state where it is not.
Sizing for a pooled estimate or for a change
The mean number of visits per distinct unit, which design_overlap()
reports for a window, measures burden and is not the variance multiplier
of a pooled average. That multiplier follows from the overlap at every
lag. Under "2-2-2" over four quarters with overlap_cor = 1 and no
finite population correction it is 15/8, against 16/9 visits per unit,
since a unit interviewed twice carries twice the weight.
The two arms pull in opposite directions against one design lever, and
which arm gains depends on the sign of the covariance the overlap
induces. Above a sampling fraction of \(o_m > n/N\), the
ordinary case and the only one without a finite population correction,
overlap improves a change and raises the size a pooled target needs.
Below it the occasions share fewer units than chance would give them and
the directions reverse. prec_pooled() works the boundary. The level at
a single occasion is unaffected either way. A design serving a pooled
target and a change target is sized by taking the larger of n_pooled()
and n_change(), since neither dominates.
See also
prec_pooled() for the inverse (compute precision from a size)
and for what the covariance assumes, n_change() for the other arm of
the trade-off, design_overlap() for the overlap a rotation schedule
gives, n_mean() and n_prop() for a single occasion.
Other repeated survey functions:
design_overlap(),
design_rotation(),
design_schedule(),
n_change(),
n_panel(),
prec_change(),
prec_panel(),
prec_pooled()
Examples
# Four independent quarterly rounds averaged into an annual figure
n_pooled(var = 100, moe = 1, occasions = 4)
#> Sample size for pooled estimate (mean scale)
#> n = 97 per occasion, 4 occasions (var = 100, deff = 1)
#> No between-occasion covariance (overlap x overlap_cor = 0)
#> se = 0.5102, moe = 1
# The same target from a rotating panel needs more per occasion
n_pooled(var = 100, moe = 1, occasions = 4, overlap = 0.75,
cor_decay = 0.8)
#> Sample size for pooled estimate (mean scale)
#> n = 248 per occasion, 4 occasions (var = 100, deff = 1)
#> overlap = 0.75, overlap_cor = 0.8 at lag 1, shared out to lag 3
#> se = 0.5102, moe = 1
# An annual average of a proportion, to within one point
n_pooled(p = 0.3, moe = 0.01, occasions = 12, overlap = 0.75,
cor_decay = 0.9)
#> Sample size for pooled estimate (proportion scale)
#> n = 4321 per occasion, 12 occasions (p = 0.3, deff = 1)
#> overlap = 0.75, overlap_cor = 0.9 at lag 1, shared out to lag 11
#> se = 0.005102, moe = 0.01, cv = 0.01701, rmoe = 0.03333
# An annual unemployment rate from four quarters, to a cv of 3 percent
n_pooled(r = 0.0615, cv_num = 4.9, cv_den = 0.73, component_cor = 0.15,
cv = 0.03, occasions = 4, overlap = 0.75, cor_decay = 0.8)
#> Sample size for pooled estimate (ratio of totals)
#> n = 16768 per occasion, 4 occasions (r = 0.0615, deff = 1)
#> overlap = 0.75, overlap_cor = 0.8 at lag 1, shared out to lag 3
#> se = 0.001845, moe = 0.003616, cv = 0.03, rmoe = 0.0588
# Relative target: the average to within 5 percent of itself
n_pooled(var = 100, mu = 20, rmoe = 0.05, occasions = 4)
#> Sample size for pooled estimate (mean scale)
#> n = 97 per occasion, 4 occasions (var = 100, mu = 20, deff = 1)
#> No between-occasion covariance (overlap x overlap_cor = 0)
#> se = 0.5102, moe = 1, cv = 0.02551, rmoe = 0.05
# With FPC, design effect, and response
n_pooled(var = 100, moe = 1, occasions = 4, N = 50000, deff = 1.5,
resp_rate = 0.8)
#> Sample size for pooled estimate (mean scale)
#> n = 180 per occasion (net: 144), 4 occasions (var = 100, deff = 1.50)
#> No between-occasion covariance (overlap x overlap_cor = 0)
#> se = 0.5102, moe = 1
# Two occasions on a small frame, a retained panel plus independent draws
n_pooled(var = 100, moe = 2.5, occasions = 2, N = 400, overlap = 0.5,
overlap_cor = 0.8, overlap_draw = "independent")
#> Sample size for pooled estimate (mean scale)
#> n = 41 per occasion, 2 occasions (var = 100, deff = 1)
#> overlap = 0.5, overlap_cor = 0.8 at lag 1, shared out to lag 1, independent draws
#> se = 1.276, moe = 2.5