Skip to contents

Each sampled unit contributes its design weight to the cell it falls in, so a cell total estimates the population count. With unit weights the totals are exactly the ordinary contingency counts.

Usage

Wfrep(y, weights = NULL, cells = NULL)

Arguments

y

Category labels, compared as character.

weights

Optional design weights; equal weights if NULL.

cells

Optional vector of levels in reporting order; defaults to the sorted distinct labels of y.

Value

List with estimate (largest cell total), levels, freq, prop, sumw, n, k, method.

Details

Formula: f_k = sum over i in cell k of w_i; p_k = f_k / sum(f).

References

Lohr, S. L. (2010). Sampling: Design and Analysis, 2nd ed. Brooks/Cole, section 7.2.

Examples

Wfrep(c(1, 1, 2, 3, 3, 3))
#> $estimate
#> [1] 3
#> 
#> $levels
#> [1] "1" "2" "3"
#> 
#> $freq
#> [1] 2 1 3
#> 
#> $prop
#> [1] 0.3333333 0.1666667 0.5000000
#> 
#> $sumw
#> [1] 6
#> 
#> $n
#> [1] 6
#> 
#> $k
#> [1] 3
#> 
#> $method
#> [1] "weighted cell frequencies, f_k = sum_{i in k} w_i [Lohr 2010]"
#>