Skip to contents

Because the strata are sampled independently the variance is a weighted sum of WITHIN-stratum variances only. ybar_st equals the sample mean only under proportional allocation, so the unweighted mean is returned alongside for contrast. h holds one-based labels.

Usage

Stratmean(y, h, Nh, level = 0.95)

Arguments

y

Observations.

h

One-based stratum label of each observation.

Nh

Population size of each stratum, length L.

level

Confidence level.

Value

List with estimate, se, ci_lower, ci_upper, stratum_mean, stratum_var, nh, Wh, unweighted_mean, N, n, L.

Details

Formula: W_h = N_h/N, ybar_st = sum_h W_h ybar_h, V(ybar_st) = sum_h W_h^2 (1 - f_h) s_h^2 / n_h, f_h = n_h/N_h

References

Cochran (1977), Sampling Techniques, 3rd edition, Section 5.3, Theorem 5.3: V(ybar_st) = sum W_h^2 S_h^2 (1 - f_h)/n_h, the cross terms vanishing because the strata are drawn independently. Chapter 5 read from the scanned original. Cross-checked against the reference implementation in the CRAN package samplingbook 1.2.4, whose stratamean forms sum(Meanh\*wh) and sum(Varh\*wh^2).

Examples

y <- c(10, 12, 11, 30, 32, 31, 29)
h <- c(1, 1, 1, 2, 2, 2, 2)
Stratmean(y, h, Nh = c(600, 400))[c("estimate", "se", "unweighted_mean")]
#> $estimate
#> [1] 18.8
#> 
#> $se
#> [1] 0.430581
#> 
#> $unweighted_mean
#> [1] 22.14286
#>