vsb: Variance estimator for spatially balanced samples

View source: R/vsb.R

vsbR Documentation

Variance estimator for spatially balanced samples

Description

Variance estimator of HT estimator of population total.

Usage

vsb(probs, ys, xs, k = 3L, type = "kdtree2", bucketSize = 40)

Arguments

probs

A vector of length n with inclusion probabilities.

ys

A vector of length n containing the target variable.

xs

An n by p matrix of (standardized) auxiliary variables.

k

The number of neighbours to construct the means around.

type

The method used in finding nearest neighbours. Must be one of "kdtree0", "kdtree1", "kdtree2", and "notree".

bucketSize

The maximum size of the terminal nodes in the k-d-trees.

Details

If k = 0L, the variance estimate is constructed by using all units that have the minimum distance.

If k > 0L, the variance estimate is constructed by using the k closest units. If multiple units are located on the border, all are used.

Value

The variance estimate.

k-d-trees

The types "kdtree" creates k-d-trees with terminal node bucket sizes according to bucketSize.

  • "kdtree0" creates a k-d-tree using a median split on alternating variables.

  • "kdtree1" creates a k-d-tree using a median split on the largest range.

  • "kdtree2" creates a k-d-tree using a sliding-midpoint split.

  • "notree" does a naive search for the nearest neighbour.

References

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

See Also

Other measure: sb()

Examples

## Not run: 
set.seed(12345);
N = 1000;
n = 100;
prob = rep(n/N, N);
x = matrix(runif(N * 2), ncol = 2);
y = runif(N);
s = lpm2(prob, x);
vsb(prob[s], y[s], x[s, ]);
vsb(prob[s], y[s], x[s, ], 0L);

## End(Not run)


BalancedSampling documentation built on May 29, 2024, 10:25 a.m.