Produce bootstrap replicate weights that are appropriate for Poisson sampling, and therefore approximately correct for sequential Poisson sampling.
sps_repweights(w, replicates = 1000L, tau = min_tau(1e-04), dist = NULL)min_tau(tol)
sps_repweights()
returns a matrix of bootstrap replicate weights
with replicates
columns (one for each replicate) and length(w)
rows
(one for each unit in the sample), with the value of tau
as an attribute.
min_tau()
returns a function that takes a vector of bootstrap adjustments
and returns the smallest value for \(\tau\) such that the rescaled
adjustments are greater than or equal to tol
.
A numeric vector of design (inverse probability) weights for a (sequential) Poisson sample.
A positive integer that gives the number of bootstrap replicates (1,000 by default). Non-integers are truncated towards 0.
A number greater than or equal to 1 that gives the rescale factor for the bootstrap weights. Setting to 1 does not rescale the weights. This can also be a function that takes a vector of bootstrap adjustments and returns a number larger than 1. The default automatically picks the smallest feasible rescale factor (up to a small tolerance).
A function that produces random deviates with mean 0 and
standard deviation 1, such as rnorm()
. The default uses the
pseudo-population method from section 4.1 of Beaumont and Patak (2012); see
details.
A non-negative number, strictly less than 1, that gives the
tolerance for determining the minimum feasible value of tau
.
Replicate weights are constructed using the generalized bootstrap method by Beaumont and Patak (2012). Their method takes a vector of design weights \(w\), finds a vector of adjustments \(a\) for each bootstrap replicate, and calculates the replicate weights as \(a w\).
There are two ways to calculate the adjustments \(a\). The default
pseudo-population method randomly rounds \(w\) for each replicate to
produce a collection of integer weights \(w'\) that are used to generate a
random vector \(b\) from the binomial distribution. The vector of
adjustments is then \(a = 1 + b - w' / w\). Specifying a
deviates-generating function for dist
uses this function to produce a
random vector \(d\) that is then used to make an adjustment \(a = 1 + d
\sqrt{1 - 1 / w}\).
The adjustments can be rescaled by a value \(\tau \geq 1\) to prevent negative replicate weights. With this rescaling, the adjustment becomes \((a + \tau - 1) / \tau\). If \(\tau > 1\) then the resulting bootstrap variance estimator should be multiplied by \(\tau^2\).
Beaumont, J.-F. and Patak, Z. (2012). On the Generalized Bootstrap for Sample Surveys with Special Attention to Poisson Sampling. International Statistical Review, 80(1): 127-148.
Ohlsson, E. (1998). Sequential Poisson Sampling. Journal of Official Statistics, 14(2): 149-162.
Rosén, B. (1997). On sampling with probability proportional to size. Journal of Statistical Planning and Inference, 62(2): 159-191.
sps()
for drawing a sequential Poisson sample.
bootstrapFP()
(with method = "wGeneralised"
) in the bootstrapFP
package for calculating the variance of Horvitz-Thompson estimators using
the generalized bootstrap and make_gen_boot_factors()
in the svrep
package.
# Make a population with units of different size
x <- c(1:10, 100)
# Draw a sequential Poisson sample
(samp <- sps(x, 5))
# Make some bootstrap replicates
dist <- list(
pseudo_population = NULL,
standard_normal = rnorm,
exponential = \(x) rexp(x) - 1,
uniform = \(x) runif(x, -sqrt(3), sqrt(3))
)
lapply(dist, sps_repweights, w = weights(samp), replicates = 5, tau = 2)
Run the code above in your browser using DataLab