Skip to contents

Compute aggregate precision for a stratum allocation.

Usage

prec_alloc(x, ...)

# Default S3 method
prec_alloc(
  x,
  n,
  domains = NULL,
  alpha = 0.05,
  deff = 1,
  resp_rate = 1,
  unit_cost = NULL,
  plan = NULL,
  ...
)

# S3 method for class 'svyplan_n'
prec_alloc(x, ...)

Arguments

x

For the default method: a stratum-level data frame in the same format as the frame argument to n_alloc() (one row per stratum, with at least N and sd or var columns; see n_alloc() for the full column reference). For svyplan_n objects: an allocation result from n_alloc().

...

Additional arguments passed to methods.

n

Stratum sample sizes, length nrow(x) (default method only).

domains

Character vector of column names in x to treat as domain identifiers, or NULL (default) for no domains.

alpha

Significance level, default 0.05.

deff

Design effect multiplier (> 0).

resp_rate

Expected response rate, in (0, 1]. Default 1.

unit_cost

Optional scalar or length-nrow(x) vector of per-stratum unit costs, overriding x$cost.

plan

Optional svyplan() object providing design defaults.

Value

A svyplan_prec object with type = "alloc".

See also

Examples

frame <- data.frame(
  N    = c(4000, 3000, 3000),
  sd   = c(10, 15, 8),
  mean = c(50, 60, 55)
)
res <- n_alloc(frame, n = 600)
prec_alloc(res)
#> Sampling precision for alloc
#> n = 221 n = 248 n = 133
#> se = 0.4305, moe = 0.8438, cv = 0.0079