Learn R Programming

BalancedSampling (version 2.0.6)

vsb: 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)

Value

The variance estimate.

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.

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.

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.

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

Run this code
if (FALSE) {
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);
}

Run the code above in your browser using DataLab