design_variance: Design-based estimate of a total with its variance

View source: R/sampling.R

design_varianceR Documentation

Design-based estimate of a total with its variance

Description

Horvitz-Thompson estimate of the population total of y from a select_units() sample, with the variance estimator that matches the design: the local-mean estimator of Grafström and Schelin (2014) for spatially balanced samples (it needs no joint inclusion probabilities), the variance among replicate estimates for replicated systematic samples, and the simple-random-sampling formula for equal-probability simple random samples. A systematic sample drawn as a single replicate has no unbiased design-based variance estimator; the local-mean estimator is used as the customary approximation. The simple-random-sampling variance of the same sample is always reported as a reference.

Usage

design_variance(sample, y, neighbours = 3L)

Arguments

sample

A fieldopt_sample.

y

Column of the study variable (observed on the sampled units; other rows may be NA).

neighbours

Number of nearest sampled units in the neighbourhood of the local-mean estimator.

Details

The local-mean estimator averages over each sampled unit and its neighbours nearest sampled units (ties included), as BalancedSampling::vsb() does with its default k = 3. In the package's experiments (three frames, Gaussian fields at four spatial ranges) it is close to unbiased when the variable has no spatial structure and conservative when it is smooth; the replicate estimator is unbiased but has only -1 degrees of freedom, so intervals should use the t quantile with df (reported) rather than the normal one.

Value

A one-row tibble: total, variance, se, cv, variance_srs, n, N, variance_method and df (degrees of freedom of the variance estimate: -1 with r replicates, the number of sampled units minus the number of strata otherwise).

References

Grafström, A. and Schelin, L. (2014). How to select representative samples. Scandinavian Journal of Statistics, 41(2), 277–290.

Examples

set.seed(2)
frame <- data.frame(x = runif(80), y = runif(80))
frame$crop <- 10 + 20 * frame$x + rnorm(80)
s <- select_units(frame, n = 20)
design_variance(s, y = "crop")
r <- select_units(frame, n = 20, method = "systematic", replicates = 4)
design_variance(r, y = "crop")

fieldopt documentation built on Oct. 22, 2026, 1:07 a.m.