Skip to contents

Divides total units across strata in proportion to each stratum's size times its weight, so with equal weights every stratum is sampled at the same fraction and each wave is a small stratified sample of the whole area. Fractions are settled by largest remainder, so the parts add up to total exactly. With available, no stratum is given more than it has left; what it cannot take goes to the others by the same rule.

Usage

sight_split_wave(strata, total, weights = NULL)

Arguments

strata

Data frame with stratum_id, N (units in the stratum), and optionally available (units not yet used).

total

Whole number of units for the wave.

weights

Weights by stratum, a vector named by stratum_id; strata not named weigh 1. Weight a species' range above 1 to fly more of it in every wave.

Value

A tibble of stratum_id and n.

Examples

strata <- data.frame(stratum_id = c(11, 12, 13), N = c(400, 250, 150))
sight_split_wave(strata, total = 60)
#> # A tibble: 3 × 2
#>   stratum_id     n
#>        <int> <int>
#> 1         11    30
#> 2         12    19
#> 3         13    11
sight_split_wave(strata, total = 60, weights = c("13" = 2))
#> # A tibble: 3 × 2
#>   stratum_id     n
#>        <int> <int>
#> 1         11    25
#> 2         12    16
#> 3         13    19