Compute the sample size per occasion required to estimate the change in a mean or a proportion between two occasions of the same population with a specified margin of error or coefficient of variation, given how far the two samples overlap.
Usage
n_change(var = NULL, ...)
# Default S3 method
n_change(
var = NULL,
...,
sd = NULL,
p = NULL,
change = NULL,
moe = NULL,
cv = NULL,
rmoe = NULL,
alpha = 0.05,
N = Inf,
deff = 1,
resp_rate = 1,
ratio = 1,
overlap = 0,
overlap_cor = 0,
df = NULL,
plan = NULL
)
# S3 method for class 'svyplan_prec'
n_change(var, ..., moe = NULL, cv = NULL, rmoe = NULL)Arguments
- var
For the default method: the population variance \(S^2\) on each occasion, one value for both or one per occasion. Estimate from a pilot study, a previous round, or published data. Supply this or
p, not both. Forsvyplan_precobjects: a precision result fromprec_change().- ...
Additional arguments passed to methods. Unused arguments are rejected.
- sd
Population standard deviation on each occasion, an alternative spelling of
var. Supply exactly one ofvarorsd.- p
The two occasion proportions,
c(p1, p2), as an alternative tovar. The occasion variances are then \(Np(1-p)/(N-1)\), the same finite population variancen_prop()uses, and the change is \(p_2 - p_1\), sochangeis determined and must not be supplied. Sizing for a change in a proportion is the ordinary case for a repeated household survey tracking an indicator.- change
Expected change, \(\mu_2 - \mu_1\), on the
varscale. It may be negative. Required whencvorrmoeis specified, both being defined against it. Determined bypon the proportion scale.- moe
Desired margin of error on the change, the half-width of its confidence interval, in the units the change is measured in. Specify exactly one of
moe,cv, orrmoe.- cv
Target standard error relative to the change, so
cv = 0.10asks for a standard error one tenth of the change being measured. Requireschange. Specify exactly one ofmoe,cv, orrmoe.- rmoe
Target margin of error relative to the change, so
rmoe = 0.25asks for a 95 percent interval whose half-width is a quarter of the change. It ismoe / abs(change)and requireschange. Specify exactly one ofmoe,cv, orrmoe.- alpha
Significance level, default 0.05.
- N
Population size.
Inf(default) means no finite population correction. One value covers both occasions; two are accepted only atoverlap = 0, where the occasions are independent and may legitimately be different populations. A positiveoverlaprequires a singleN, since units can only be shared by samples drawn from one population.- deff
Design effect multiplier (> 0), applied to the variance of the change rather than to either occasion separately. See Details.
- resp_rate
Expected response rate, 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.- ratio
Size of the first occasion relative to the second, so
ratio = 2sizes a large baseline against a smaller follow-up. Default 1, equal occasions, which returns a single size. Becauseoverlapis measured against the first occasion it cannot exceed1 / ratioonce the first occasion is the larger.- overlap
Fraction of the first occasion's responding sample carried into the second, in [0, 1].
0(default) drops the covariance entirely and reproduces the two-independent-samples size.1means every responding unit of the first occasion is measured again, which is a full panel when the occasions are the same size. A rotation pattern determines the issued figure,(D - 1) / Dbetween consecutive occasions of an in-for-Dschedule, anddesign_overlap()computes it at every lag. The two are the same number at full response only. Seeprec_change()on what a response rate below 1 does to this reading.- overlap_cor
Correlation between the two occasions among the overlapping units, in [0, 1]. Default 0, which makes overlap worthless: it is the product
overlap * overlap_corthat reduces the size, so a full panel of uncorrelated measurements saves nothing. On the proportion scale two Bernoulli marginals bound the correlation they can have, and a value above that bound is rejected.- df
Degrees of freedom of the variance estimator the planned design will have, typically sampled PSUs minus strata, and 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 = "change":
nRequired size per occasion, continuous and gross. It already carries
deffand the1 / resp_rateinflation, so it counts the units to release on each occasion, not the completed interviews. A single value whenratio = 1, otherwise one per occasion.$nandas.double()keep the unrounded value, which is what makes the round trip throughprec_change()exact;print()rounds up to the whole units you would field. A positive overlap means the occasions are not disjoint, so the number of distinct units sampled is less than the sum; the number of interviews is not, since a shared unit is interviewed on both occasions.se,moe,cv,rmoePrecision the design achieves at that size, the same values
prec_change()reports for the same inputs.cvandrmoeareNAunless the change is known.paramsThe validated inputs, including whichever of
moe,cv, orrmoewas the target. Dispersion is always stored asvar, a pair;pis kept as well when the proportion scale was used.
Details
The change variance is \(A/n_2 + B\) in the net second-occasion size, where
$$A = v_1/r + v_2 - 2\,\mathrm{overlap}\,\rho\sqrt{v_1v_2}, \qquad B = -\frac{v_1 + v_2 - 2\rho\sqrt{v_1v_2}}{N},$$
with \(r\) the ratio and \(\rho\) the overlap_cor. The finite
population terms collect into \(B\), a constant no sample size can
move, so the target inverts in closed form rather than by search. Both
coefficients are written above for a positive overlap; at
overlap = 0 the covariance is dropped entirely, so
\(A = v_1/r + v_2\) and \(B = -v_1/N_1 - v_2/N_2\), which is what
lets the two occasions come from different populations. See
prec_change() for the variance itself and for the piecewise statement.
Overlap and correlation only ever act together. At overlap_cor = 0 the
size is what two independent samples would need whatever the overlap, and
the two arguments are worth setting from the same evidence: a rotation
pattern fixes overlap, and a previous round of the same survey is what
identifies overlap_cor.
The design effect is that of the change, not of either occasion. A clustered design revisiting the same clusters has a smaller one than a design that reclusters between occasions, because the cluster effects partly cancel in the difference. Passing an occasion's design effect here therefore over-sizes a design that keeps its clusters.
When no size is enough, and when any size is
Two boundaries are worth knowing before reading a result. Full overlap with unit correlation at equal sizes and variances leaves the change with no sampling variance at all: the same units are measured twice, so no size is identified and the function says so rather than returning zero.
At a finite N with equal occasions and full response, the requirement
rises towards N but never past it, because two censuses of one
population measure the change exactly. Every target is attainable there,
and a demanding one simply returns a near-census. Unequal occasions or a
response rate below 1 remove that guarantee, since the size released is
then larger than the sample carrying the precision, and a target beyond
reach is reported as unattainable.
Sizing for a change, a level, or an average
Overlap improves a change and does nothing for the level at a single
occasion, which is a function of that occasion's size alone. A fresh
sample each round is not the reverse of this: it does nothing for the
level either, and the two designs give the same single-occasion
precision at the same size. What overlap does work against is an
estimate pooled across occasions, an annual average of quarterly rounds
say, because the covariance it induces is subtracted in a difference and
added in a sum. That holds while the covariance is positive, which needs
the overlap to exceed the sampling fraction when N is finite; see
prec_pooled() for the boundary. A design serving more than one of the
three is sized by
taking the largest of n_change(), n_pooled() and the corresponding
n_mean() or n_prop() requirement, since none dominates.
See also
prec_change() for the inverse (compute precision from a size),
n_mean() and n_prop() for a single occasion, power_mean() and
power_prop() to frame the same overlap as a hypothesis test.
Other sample size functions:
n_alloc(),
n_cluster(),
n_mean(),
n_multi(),
n_multi_cluster(),
n_panel(),
n_pooled(),
n_prop(),
n_twophase()
Examples
# Two independent occasions
n_change(var = 100, moe = 2)
#> Sample size for change (mean scale)
#> n = 193 per occasion (var = 100, 100, moe = 2, deff = 1)
#> No between-occasion covariance (overlap x overlap_cor = 0)
# A half-overlapping panel correlated 0.6 needs fewer units per occasion
n_change(var = 100, moe = 2, overlap = 0.5, overlap_cor = 0.6)
#> Sample size for change (mean scale)
#> n = 135 per occasion (var = 100, 100, moe = 2, deff = 1)
#> overlap = 0.5, overlap_cor = 0.6 (70.0% of the independent variance)
# A 6-point rise in a proportion, resolved to within 2 points
n_change(p = c(0.30, 0.36), moe = 0.02)
#> Sample size for change (proportion scale)
#> n = 4230 per occasion (p = 0.3 to 0.36, moe = 0.02, deff = 1)
#> No between-occasion covariance (overlap x overlap_cor = 0)
# The same target under a consecutive-month CPS-style overlap of 0.75
n_change(p = c(0.30, 0.36), moe = 0.02, overlap = 0.75, overlap_cor = 0.5)
#> Sample size for change (proportion scale)
#> n = 2646 per occasion (p = 0.3 to 0.36, moe = 0.02, deff = 1)
#> overlap = 0.75, overlap_cor = 0.5 (62.5% of the independent variance)
# Relative target: resolve the change to within a quarter of itself
n_change(var = 100, change = 5, rmoe = 0.25)
#> Sample size for change (mean scale)
#> n = 492 per occasion (var = 100, 100, change = 5, rmoe = 0.250, deff = 1)
#> No between-occasion covariance (overlap x overlap_cor = 0)
# A large baseline against a smaller follow-up
n_change(var = 100, moe = 2, ratio = 2)
#> Sample size for change (mean scale)
#> n = 289 then 145 (var = 100, 100, moe = 2, deff = 1)
#> No between-occasion covariance (overlap x overlap_cor = 0)
# With FPC, design effect, and response
n_change(var = 100, moe = 2, N = 20000, deff = 1.5, resp_rate = 0.8)
#> Sample size for change (mean scale)
#> n = 356 per occasion (net: 285) (var = 100, 100, moe = 2, deff = 1.50, resp_rate = 0.80)
#> No between-occasion covariance (overlap x overlap_cor = 0)