vsb | R Documentation |
Variance estimator of HT estimator of population total.
vsb(probs, ys, xs, k = 3L, type = "kdtree2", bucketSize = 40)
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 |
bucketSize |
The maximum size of the terminal nodes in the k-d-trees. |
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.
The variance estimate.
The type
s "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.
Grafström, A., & Schelin, L. (2014). How to select representative samples. Scandinavian Journal of Statistics, 41(2), 277-290.
Other measure:
sb()
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.