Benchmark

Benchmark(
    method,
    targets,
    sizes,
    area,
    size,
    group=None,
    target='target',
    direct_weight=None,
)

Adjust estimates so each group’s size-weighted mean equals its target.

Parameters

Name Type Description Default
method Literal['ratio', 'raking'] “ratio” scales a group’s estimates by target / weighted mean; “raking” shifts them by target - weighted mean. required
targets float | pl.DataFrame A number benchmarks all areas together; a frame has one row per group. required
sizes pl.DataFrame One row per area: the area key, its population size and, with grouped targets, its group. Sizes are normalised within each group. required
area str Column of area keys in sizes. required
size str Column of population sizes in sizes. required
group str | None Column of groups in sizes and targets; needed with a frame of targets. None
target str Column of target values in targets. 'target'
direct_weight str | None Column in sizes: each area’s weight in its group’s direct estimate, when the targets are direct estimates from the same survey. The bootstrap then re-estimates them in each replicate; without it they are known totals. None