Skip to contents

Achieved precision for a two-phase design you already have, the inverse of n_twophase().

Usage

prec_twophase(frame, ...)

# Default S3 method
prec_twophase(
  frame,
  ...,
  n_phase1,
  phase1_cost = 1,
  between = NULL,
  mu = NULL,
  N = Inf,
  alpha = 0.05,
  phase1_deff = 1,
  resp_rate = 1,
  fixed_cost = 0,
  plan = NULL
)

# S3 method for class 'svyplan_twophase'
prec_twophase(frame, ...)

Arguments

frame

For the default method: the phase-2 stratum frame described in n_twophase(), with an extra nu column giving the subsampling fraction actually used in each stratum. For svyplan_twophase objects: a result from n_twophase().

...

Additional arguments passed to methods. Unused arguments are rejected.

n_phase1

Phase-1 sample size, counted as units issued. nu is a share of that same base, so with phase-1 nonresponse the largest usable nu is resp_rate rather than 1.

phase1_cost, between, mu, N, phase1_deff, resp_rate, fixed_cost, plan

As in n_twophase(). The per-stratum phase-2 design effect and response rate travel in the frame's deff and resp_rate columns, as they do there.

alpha

Significance level for the reported margin of error. The default is 0.05. A two-phase design is sized against a cv, but the half-width it achieves follows from the standard error either way, so $moe is reported alongside $cv.

Value

A svyplan_prec object with type = "twophase", carrying $se, $moe, $rmoe, $cv, and the per-stratum table in $detail. $moe is the alpha-level half-width z * $se, and $rmoe states it as a fraction of the population mean the design estimates.

The print shows both phase sizes as evaluated. A fit is read back at its continuous optimum, as the print says, so $cv is the fit's $cv. The whole design the fit fields, and the cv it achieves, are the fit's $operational$n and $operational$cv.

See also

n_twophase() for the inverse.

Other two-phase design functions: n_twophase()

Examples

frame <- data.frame(
  stratum   = c("A", "B"),
  N         = c(6000, 4000),
  sd        = c(12, 25),
  mean      = c(40, 70),
  unit_cost = c(2, 5),
  nu        = c(0.4, 0.6)
)
prec_twophase(frame, n_phase1 = 2000, phase1_cost = 1)
#> Sampling precision for two-phase
#> n_phase1 = 2000 | n_phase2 = 960
#> se = 0.6514, moe = 1.2767, cv = 0.0125, rmoe = 0.0246

# Round trip from n_twophase, then the whole design it fields
res <- n_twophase(frame[names(frame) != "nu"], cv = 0.02, phase1_cost = 1)
prec_twophase(res)
#> Sampling precision for two-phase (continuous optimum)
#> n_phase1 = 641.9034 | n_phase2 = 417.6868
#> se = 1.0400, moe = 2.0384, cv = 0.0200, rmoe = 0.0392
res$operational
#> $n
#> n_phase1 n_phase2 
#>      642      417 
#> 
#> $n_int
#> [1] 221 196
#> 
#> $cost
#> [1] 2064
#> 
#> $cv
#> [1] 0.01999651
#> 
#> $status
#> [1] "optimal"
#> 
#> $search
#> $search$status
#> [1] "optimal"
#> 
#> $search$solves
#> [1] 36
#> 
#> $search$max_solves
#> [1] 2000
#> 
#> $search$limit
#> NULL
#> 
#> $search$bound
#> [1] NA
#> 
#> $search$gap
#> [1] NA
#> 
#> 

# Ten units in two strata of five, all of the phase-1 sample measured:
# an SRS of 4, whose variance S2 * (1/4 - 1/10) needs the exact 'between'
small <- data.frame(N = c(5, 5), sd = c(2, 2), mean = c(10, 20),
                    nu = c(1, 1))
S2 <- (sum(4 * small$sd^2) + sum(5 * (small$mean - 15)^2)) / 9
prec_twophase(small, n_phase1 = 4, N = 10)$se^2
#> [1] 4.35
prec_twophase(small, n_phase1 = 4, N = 10,
              between = S2 - sum(0.5 * small$sd^2))$se^2
#> [1] 4.7
S2 * (1 / 4 - 1 / 10)
#> [1] 4.7