Allocate a two-phase (double) sample: a large cheap phase 1, then a subsample measured on the expensive variable. Minimizes cost for a target precision, or precision for a fixed budget.
Usage
n_twophase(frame, ...)
# Default S3 method
n_twophase(
frame,
...,
phase1_cost,
cv = NULL,
budget = NULL,
between = NULL,
mu = NULL,
N = Inf,
n_phase1 = NULL,
assurance = NULL,
phase1_deff = 1,
resp_rate = 1,
single_deff = 1,
single_resp_rate = 1,
single_cost = NULL,
fixed_cost = 0,
plan = NULL
)
# S3 method for class 'svyplan_prec'
n_twophase(frame, ..., cv = NULL, budget = NULL)Arguments
- frame
For the default method: a data frame with one row per phase-2 stratum, in the
n_alloc()column vocabulary (N,sd,mean,unit_cost,take_all) but on a narrower contract:sdis required wheren_alloc()also acceptsvar, and the cost andp/meanrules differ, so a table built for one may need adjusting before it is passed to the other. Columns:NStratum size (required). Only relative size matters, since the stratum weights are
N / sum(N).sdWithin-stratum standard deviation of the expensive variable (required).
meanStratum mean. Supply it to let the between-stratum component be derived, which is what makes stratifying worthwhile. Omit it, or pass
between = 0, when the strata are not expected to differ in level, as in nonresponse follow-up.unit_costIncremental phase-2 cost per unit. Default 1. Zero means the stratum is already measured, which with
take_all = TRUEis exactly a phase-1 respondent group.deffDesign effect of the phase-2 subsample in this stratum, default 1. This one applies to the residual variation that phase 2 has to measure, under the phase-2 field design. See Details for why it is not the same design effect as
phase1_deff.resp_rateExpected phase-2 completion rate in this stratum, in (0, 1], default 1. It divides the stratum's contribution to the variance, so a stratum that responds poorly is treated as carrying less information per issued unit.
take_allLogical.
TRUEcarries every unit phase 1 successfully classified into phase 2. On the issued-unit scalenuis measured on, that isnu = resp_rate, the phase-1 classification rate, and not 1. Among classified units the fraction is one. The two coincide only when phase 1 classifies everyone. DefaultFALSE.stratumOptional label.
For
svyplan_precobjects: a precision result fromprec_twophase().- ...
Additional arguments passed to methods. Unused arguments are rejected.
- phase1_cost
Cost per phase-1 unit (> 0). This is paid on every unit screened, whether or not it reaches phase 2.
- cv
Target coefficient of variation. Specify exactly one of
cvorbudget.- budget
Total budget. Specify exactly one of
cvorbudget.- between
Between-stratum variance component.
NULL(default) derives it from themeancolumn assum(W * (mean - ybar)^2), or uses 0 when nomeanis given. Supply it directly when you know the stratification gain but not the stratum means.- mu
Population mean, used to turn the variance into a coefficient of variation.
NULL(default) derives it frommeanwhen present. Required incvmode when nomeancolumn is supplied.- N
Population size for the phase-1 finite population correction.
Inf(default) applies none.- n_phase1
Fixed phase-1 sample size, or
NULL(default) to optimize it. Supply it when the screener has already run, when phase 1 is an existing survey or panel, or when its size is set by field capacity rather than by this design. The relative allocation across strata is unchanged, since it isS_h sqrt(d_2h / c_h)in every mode. What changes is the overall scale, which is then pinned by the budget left after paying for phase 1, or by what it takes to reachcvat that size. Because the optimizing choice ofn_phase1is the best member of this family, fixing it can only match or lose to leaving it free, and the gap is what a phase-1 size you did not choose is costing. Two ways it can fail. The budget may not reach phase 2 at all, once the screening and anytake_allstrata are paid for. And a targetcvmay sit below the floor that remains when phase 2 carries every classified unit through, which is the between-stratum componentd_1 A / r_1plus the phase-2 residual atnu_h = resp_rate. No amount of subsampling can beat it, because both parts are already paid for.- assurance
Probability in (0, 1), or
NULL(default). Planning at the expected respondent count leaves roughly half of all designs short. Supplying a level reports, alongside the expected design, the issued sizes for which the required respondents arrive with at least that probability, from the binomial distribution of respondents.The level is marginal, holding stratum by stratum. The chance that every stratum clears its target at once is the product over strata and so is lower, materially so with many strata: three strata at 0.95 give about 0.86 together. Raise the level if you need a familywise guarantee. It is also conditional on the phase-1 pool: the assured phase-2 issue is compared against what phase 1 supplies, and a stratum that needs more than its pool is reported in a warning, because the answer there is to enlarge phase 1 rather than to over-issue. Phase-1 composition is itself random unless phase 1 is a census, so the expected stratum shares behind that pool are not simultaneous lower bounds either.
- phase1_deff
Design effect of the phase-1 sample, default 1. It multiplies the between-stratum component, which is the part of the variance phase 1 is responsible for. Set it above 1 when phase 1 is clustered, as an area screener is.
- resp_rate
Expected phase-1 response, screening or successful classification rate, in (0, 1], default 1. It divides the between-stratum component and, because phase 2 can only draw from the units phase 1 actually classified, it also caps every subsampling fraction at
resp_rate. In a nonresponse follow-up frame leave it at 1: there the strata are response status, so classification succeeds for every unit and setting it again would count the same loss twice.- single_deff
Design effect of the single-phase comparator, default 1. It is a separate number from the stratum
deffcolumn because the comparator need not be fielded the same way as phase 2.- single_resp_rate
Expected response rate of the single-phase comparator, in (0, 1], default 1.
- single_cost
Cost per unit of the single-phase design that skips phase 1 and measures the expensive variable directly.
NULL(default) usessum(share * unit_cost), which is the right baseline whenunit_costis what measuring one unit costs. In a nonresponse follow-up design it is not: aunit_costof 0 there means "already measured", not "free", and the right baseline is the cost of one completed interview without any follow-up,phase1_cost / resp_rate. Supply it in that case.- fixed_cost
Fixed overhead, not depending on sample size. Default 0. In budget mode only
budget - fixed_costis allocatable.- plan
Optional
svyplan()object providing design defaults.
Value
A svyplan_twophase object with components:
nNamed numeric vector
c(n_phase1 = , n_phase2 = ), both continuous, counting units issued.n_phase2is the expected issue,sum(W_h * nu_h) * n_phase1.respondingThe same two quantities in expected respondents,
r_1 n_aandsum(r_{2h} W_h nu_h) n_a. Issued and responding are different quantities and neither is an effective sample size. There is no single effective size for a two-phase design, because the two variance components carry different design effects.cvCoefficient of variation achieved.
costTotal cost, including
fixed_cost.detailPer-stratum table:
stratum,N,share,sd,unit_cost,deff,resp_rate,nu(the subsampling fraction, as a share of the phase-1 units issued, and withresp_ratebelow 1 it is capped there, since phase 2 can only draw from the units phase 1 classified, and the fraction taken among those classified units isnu / resp_rate),n_issued,n_resp(its expected responding part), andtake_all, which isTRUEfor strata that were supplied pinned and for those the allocator truncated at the classification rate.single_phaseThe design that skips phase 1 and measures the expensive variable directly, as
c(n = , cv = , cost = ), plusreaches_target, andbetter,TRUEwhen that plainer design wins. Two-phase sampling is not always an improvement and this comparison is the check that says so. Incvmode a comparator that cannot reach the target from a frame of sizeNis capped there, reports the coefficient of variation a census of it would achieve, and never wins on cost alone.operationalThe whole-unit field design:
n(both phases), the per-stratumn_int, and thecostandcvit actually achieves. Budget mode floors and then buys back whole units in order of variance reduction per unit cost, so the integer design stays inside the budget, while cv mode rounds up. Both are bounded by the phase-2 pool, so a stratum whose expected phase-1 yield rounds below one unit is left unsampled with a warning, and the operationalcvis thenInf. Withassuranceset it also carriesassured,assured_phase1,poolandassured_cost.paramsValidated inputs, read back by
prec_twophase(). They include the design decisions a stratum table cannot express, so thatn_twophase(prec_twophase(fit))rebuilds this problem rather than a new unconstrained one: thetake_allset as supplied, a fixedn_phase1,assurance, and the comparator settings. There is nopredict()method for this class.
Details
One allocator covers the two designs that usually get separate
treatments. Double sampling for stratification subsamples every phase-2
stratum. Nonresponse follow-up carries the phase-1 respondents through
untouched and subsamples only the nonrespondents. Both are the same
problem with different strata marked take_all.
Write \(W_h\) for the stratum weight, \(S_h\) for the within-stratum standard deviation, \(c_h\) for the incremental phase-2 unit cost, \(c_a\) for the phase-1 unit cost, and \(\nu_h\) for the fraction of the phase-1 stratum carried into phase 2. Ignoring the finite population correction,
$$V = \frac{1}{n_a}\left[A + \sum_h \frac{W_h S_h^2}{\nu_h}\right], \qquad C = n_a\left[c_a + \sum_h c_h W_h \nu_h\right],$$
where \(A\) is the between-stratum component. Minimizing \(VC\), which is free of \(n_a\), gives
$$\nu_h = \frac{S_h}{\sqrt{c_h}} \sqrt{\frac{\tilde c_a}{\tilde A}}, \qquad \tilde A = A + \sum_{h \in P} W_h S_h^2, \qquad \tilde c_a = c_a + \sum_{h \in P} c_h W_h,$$
where \(P\) is the set of pinned strata. The shape is Neyman-like, \(\nu_h \propto S_h/\sqrt{c_h}\), but the overall scale is set by the between-stratum variance: weak stratification pushes every \(\nu_h\) up, toward keeping everything phase 1 found.
Any \(\nu_h\) above the cap is truncated there and the stratum joins
\(P\), which changes \(\tilde A\) and \(\tilde c_a\) and so the
remaining strata are re-solved. The cap is resp_rate, not 1: phase 2
can only subsample the units phase 1 succeeded in classifying, so a
stratum is "take-all" once it keeps all of those, not all of \(N_h\).
Strata are pinned one at a time in decreasing \(S_h/\sqrt{c_h}\),
because pinning lowers the multiplier and can bring others back below
the cap.
The finite population correction
With N set, the correction applies component by component and not to
the variance as a whole:
$$V = A\left(\frac{1}{n_a}-\frac{1}{N}\right) + \sum_h W_h S_h^2 \left\{\frac{1}{\nu_h n_a}-\frac{1}{N}\right\}.$$
Phase 1 estimates the stratum weights, so a phase-1 census makes the
between-stratum term vanish. The phase-2 terms vanish only when phase 2
also measures every unit it found. Scaling the whole variance by
\(1 - n_a/N\) would subtract \(1/(\nu_h N)\) in place of
\(1/N\) and so report a phase-1 census as a zero-variance design.
Note that with resp_rate below 1 a phase-1 census is not a complete
classification of the frame, and the residual it leaves is real rather
than an artifact.
Two design effects, not one
The variance has two components and each carries its own design effect,
$$V \approx \frac{1}{n_a}\left[d_1 A + \sum_h \frac{d_{2h} W_h S_h^2}{\nu_h}\right],$$
so the optimum becomes \(\nu_h \propto S_h\sqrt{d_{2h}/c_h}\) and \(\tilde A\) is built from \(d_1 A\) and the pinned strata's \(d_{2h} W_h S_h^2\). Inflating the combined variance by a single design effect instead is a different and wrong model.
The two are design effects for different variables. phase1_deff
applies to what phase 1 explains, the between-stratum contrast.
The deff column applies to what is left for phase 2 to measure, the
within-stratum residual. A clustered phase 1 raises the first. A
stratifier that absorbs geographic variation lowers the second.
They are not independent, and the trap runs in the direction that looks
attractive. A stratifier built purely from between-cluster structure
shrinks the residual and so lowers deff, but it drives the fitted
values toward constancy within clusters and so raises phase1_deff
toward the cluster size. Under a clustered phase 1 the first term can
then dominate and the design loses to a plain single-phase sample even
though the residual design effect looks favorable. When the
stratification explains little, the phase-2 residual is close to the
whole variance and the stratum deff should be close to single_deff.
Setting it well below with a weak stratifier assumes away the cost of
the design.
Response rates
All costs and sample sizes count units issued, so a cost quoted
per completed interview has to be converted before it is passed in:
with a contact cost and a completion cost, the issued-basis figure is
c_contact + resp_rate * c_complete.
Response enters each component separately, d_1 becoming d_1/r_1
and d_{2h} becoming d_{2h}/r_{2h}, so a phase-2 stratum that
responds poorly is subsampled differently rather than the whole design
being inflated by one factor. A response rate common to everything
scales the sample needed for a precision target but cancels from the
relative allocation. Phase- or stratum-specific rates change it.
This is an expected-information calculation and not a bias adjustment. Dividing by a response rate assumes response is ignorable within the strata you supplied, which is a substantive assumption about the strata, not a property of the arithmetic. No sample size removes nonresponse bias. Where that assumption is uncomfortable, modeling the nonresponse as a follow-up phase, as below, is the alternative the design itself offers.
Nonresponse follow-up is the two-stratum case: respondents with
unit_cost = 0 and take_all = TRUE, nonrespondents free, and no
between-stratum component. The optimum reduces to
\(\nu = \sqrt{c_1/(c_2\theta)}\) for a phase-1 response rate
\(\theta\), which is the standard result.
References
Fuller, W. A. (2009). Sampling Statistics, Sect. 3.3. Wiley.
Neyman, J. (1938). Contribution to the theory of sampling human populations. Journal of the American Statistical Association, 33(201), 101–116.
Saerndal, C.-E., Swensson, B., and Wretman, J. (1992). Model Assisted Survey Sampling, Sect. 15.4. Springer.
Valliant, R., Dever, J. A., and Kreuter, F. (2018). Practical Tools for Designing and Weighting Survey Samples, 2nd edition, Sect. 17.5.2. Springer.
See also
prec_twophase() for the inverse, n_alloc() for
single-phase stratified allocation, n_cluster() for the multistage
analogue.
Other sample size functions:
n_alloc(),
n_change(),
n_cluster(),
n_mean(),
n_multi(),
n_multi_cluster(),
n_panel(),
n_pooled(),
n_prop()
Examples
# Double sampling for stratification: a cheap screener splits the frame
# into four groups, the expensive measurement goes to a subsample.
frame <- data.frame(
stratum = c("A", "B", "C", "D"),
N = c(3500, 2500, 2500, 1500),
sd = c(12, 25, 8, 40),
mean = c(40, 70, 35, 90),
unit_cost = c(2, 5, 1, 9)
)
n_twophase(frame, phase1_cost = 1, budget = 50000)
#> Two-phase allocation (4 phase-2 strata)
#> field design: n_phase1 = 16924 | n_phase2 = 8094
#> cv = 0.0050, cost = 50000
#>
#> stratum share sd unit_cost nu n_int
#> A 0.350 12.00 2.00 0.4154 2462
#> B 0.250 25.00 5.00 0.5474 2316
#> C 0.250 8.00 1.00 0.3917 1659
#> D 0.150 40.00 9.00 0.6528 1657
#>
#> single-phase is better here: n = 14085 at cv 0.0046, so skip phase 1
#> # summary() for the continuous optimum and the comparator
# Weak stratification pushes the fractions up, and strata that reach 1
# are reported as take-all.
flat <- transform(frame, mean = c(55, 56, 55, 56))
n_twophase(flat, phase1_cost = 1, budget = 50000)
#> Two-phase allocation (4 phase-2 strata)
#> field design: n_phase1 = 11476 | n_phase2 = 10030
#> cv = 0.0037, cost = 50000
#>
#> stratum share sd unit_cost nu n_int take_all
#> A 0.350 12.00 2.00 0.8085 3250
#> B 0.250 25.00 5.00 1.0000 2869 *
#> C 0.250 8.00 1.00 0.7623 2190
#> D 0.150 40.00 9.00 1.0000 1721 *
#>
#> single-phase is better here: n = 14085 at cv 0.0033, so skip phase 1
#> # summary() for the continuous optimum and the comparator
# Nonresponse follow-up: respondents are already measured, so they cost
# nothing more and are all kept. Only the nonrespondents are subsampled.
theta <- 0.5
nrfu <- data.frame(
stratum = c("respondents", "nonrespondents"),
N = c(theta, 1 - theta),
sd = c(1, 1),
unit_cost = c(0, 200),
take_all = c(TRUE, FALSE)
)
# a unit_cost of 0 means "already measured", not "free", so the
# single-phase baseline has to be named: one completed interview
n_twophase(nrfu, phase1_cost = 50, budget = 100000, mu = 1,
single_cost = 50 / theta)
#> Two-phase allocation (2 phase-2 strata)
#> field design: n_phase1 = 828 | n_phase2 = 707
#> cv = 0.0382, cost = 1e+05
#>
#> stratum share sd unit_cost nu n_int take_all
#> respondents 0.500 1.00 0.00 1.0000 414 *
#> nonrespondents 0.500 1.00 200.00 0.7071 293
#>
#> single-phase is better here: n = 1000 at cv 0.0316, so skip phase 1
#> # summary() for the continuous optimum and the comparator