Skip to contents

Evaluate achieved precision for every indicator and domain requirement under a stratum allocation, or check a fitted n_alloc_joint() plan.

Usage

prec_alloc_joint(frame, ...)

# Default S3 method
prec_alloc_joint(
  frame,
  n = NULL,
  measures = NULL,
  ...,
  targets = NULL,
  objective = NULL,
  budget = NULL,
  psu = NULL,
  certainty_cutoff = NULL,
  n_psu_per_zone = NULL,
  unit_cost = NULL,
  alpha = 0.05,
  deff = 1,
  resp_rate = 1,
  eligibility_rate = 1,
  eligible_per_unit = 1,
  df = NULL,
  min_n_stratum = NULL,
  fpc = c("unit", "stage", "none"),
  plan = NULL
)

# S3 method for class 'svyplan_alloc_joint'
prec_alloc_joint(frame, ...)

Arguments

frame

For the default method, a stratum-level data frame as in n_alloc_joint(). For svyplan_alloc_joint objects, an allocation from n_alloc_joint().

...

Additional arguments passed to methods. Unused arguments are rejected.

n

Numeric vector of stratum sample sizes (ultimate units) of length nrow(frame). Required with a raw frame. For a cluster frame, the supplied sizes must imply whole PSU counts at the specified takes. See Details for the defaults when passing an allocation.

measures

Long data frame of per-stratum indicator statistics, as in n_alloc_joint().

targets

Optional precision targets data frame, as in n_alloc_joint().

objective

Optional objective specification, as in n_alloc_joint().

budget

Optional budget used with objective to compute budget residual.

psu

Optional PSU register, as in n_alloc_joint().

certainty_cutoff

Optional certainty probability cutoff, as in n_alloc_joint().

n_psu_per_zone

Optional 1 or 2 PSUs per zone, as in n_alloc_joint().

unit_cost

Optional scalar or length-nrow(frame) per-unit cost.

alpha

Significance level, default 0.05.

deff

Default design effect multiplier (> 0).

resp_rate

Default expected response rate in (0, 1].

eligibility_rate

Default share of issued units in scope in (0, 1].

eligible_per_unit

Default eligible units per sampled unit (> 0). Available for designs without a PSU register. As in n_alloc_joint(), any of these four other than 1 is refused when every row a target or the objective uses takes the value from a measures or frame column, since the argument would be ignored.

df

Optional degrees of freedom for MOE and RMOE targets.

min_n_stratum

Optional minimum sample size per stratum.

fpc

Finite population correction ("unit", "stage", or "none"). Leave the default for a PSU register.

plan

Optional svyplan() object providing design defaults.

Value

A svyplan_prec object with type = "alloc_joint", per-constraint results in $detail, stratum bound checks in $bounds, and optional $objective, $objective_value, and $psu.

Details

  • For an element or cluster fit, prec_alloc_joint(fit) assesses the continuous design. Supply n = fit$detail$n_int to assess its whole counts. A free-take fit uses its stored whole takes with explicit n.

  • For a register fit, prec_alloc_joint(fit) assesses the stored whole field design, including its certainty split, remainder draw, and per-PSU takes. Supplying n, frame, psu, certainty_cutoff, or n_psu_per_zone reconstructs the assessment. A raw frame with psu needs explicit totals and a fixed take_2 in the frame.

Pass an assessment to predict.svyplan() to vary assumptions such as response, variance, or cost. Leave n out of the scenario grid to hold the allocation fixed. See vignette("joint-allocation") for worked designs.

See also

n_alloc_joint() to reoptimize an assessment, design_df() for the field design's degrees of freedom, and prec_alloc() for classic single-indicator allocation precision.

Other stratified design functions: merge_psus(), n_alloc(), n_alloc_joint(), prec_alloc(), strata_bound()

Examples

frame <- data.frame(
  stratum = c("North urban", "North rural", "South urban"),
  region = c("North", "North", "South"),
  N = c(1000, 1800, 1200)
)
measures <- data.frame(
  stratum = rep(frame$stratum, 2),
  name = rep(c("coverage", "income"), each = 3),
  p = c(0.5, 0.4, 0.6, NA, NA, NA),
  mean = c(NA, NA, NA, 50, 55, 60),
  sd = c(NA, NA, NA, 10, 12, 15)
)
targets <- data.frame(
  name = c("coverage", "income"),
  domain = c(".overall", "region"),
  level = c(NA, "North"),
  cv = c(0.06, NA),
  moe = c(NA, 3)
)
fit <- n_alloc_joint(frame, measures, targets = targets)
prec_alloc_joint(fit)
#> Joint allocation precision (2 constraints)
#> targets: all pass
#> showing 1 binding of 2
#> 
#>  constraint           .metric .target .achieved .pass
#>  coverage@.overall:cv cv      0.06    0.06      TRUE 
#> 
#> ... see $detail for all rows
prec_alloc_joint(fit, n = fit$detail$n_int)
#> Joint allocation precision (2 constraints)
#> targets: all pass

# Assess the fixed-take field design at two response rates
cluster <- data.frame(
  stratum = "A", N = 100000, N_1 = 100, take_2 = 10, cost_1 = 50, cost_2 = 1
)
measure <- data.frame(stratum = "A", name = "coverage", p = 0.5, icc_1 = 0.05)
goal <- data.frame(name = "coverage", cv = 0.08)
cluster_fit <- n_alloc_joint(cluster, measure, targets = goal)
assessment <- prec_alloc_joint(cluster_fit, n = cluster_fit$detail$n_int)
predict(assessment, data.frame(resp_rate = c(1, 0.8)))
#>   resp_rate   n cost .max_ratio .n_fail .feasible
#> 1       1.0 230 1380   0.991357       0      TRUE
#> 2       0.8 230 1380   1.069715       1     FALSE