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
frameargument ton_alloc()(one row per stratum, with at leastNandsdorvarcolumns; seen_alloc()for the full column reference). Forsvyplan_nobjects: an allocation result fromn_alloc().- ...
Additional arguments passed to methods.
- n
Stratum sample sizes, length
nrow(x)(default method only).- domains
Character vector of column names in
xto treat as domain identifiers, orNULL(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, overridingx$cost.- plan
Optional
svyplan()object providing design defaults.
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