The boot.sample component returned by the bootstrap functions has been restructured. For every
bootstrap replicate it now reports the row id of each selected unit in the original sample
(row.id) and the bootstrap weight used to compute the bootstrap statistic (bootstrap.weight).
The within-stratum index previously returned as ID is replaced by row.id, which identifies a
unit in the original sample and can therefore be used to attach any variable of the sample.
The values of the study variable are returned as bootstrap.sample for the methods that resample
units and as study.variable for the bootstrap weight methods, where the original values are kept
and only the weights change.
In boot.weights.stsrs, and in boot.twostage under a stratified design, the columns of
boot.sample were returned as character strings. They are now returned with their own type, so
that the bootstrap weights can be used directly in computations.
New function boot.replicates() returns the bootstrap replicate weights as a matrix, with one row
per unit of the original sample and one column per bootstrap replicate. The rows follow the order
of the original sample, so the bootstrap variance of any estimator is obtained by computing the
estimator with each column of weights. This allows bootstrap variances to be estimated for, among others,
a vector of study variables, a ratio, a calibrated estimator, and estimates within sub-groups
(domains), and reproduces the bootstrap statistics of the package exactly.
It applies to the direct, pseudo-population and bootstrap weight methods, and to the method of
Rao and Wu (1988) under simple random sampling;
under a stratified design that method is reproduced directly from boot.sample and
rescale.factor, and under the two-stage design of boot.twostage() the study variable
can be reproduced from the rescaled values stored in boot.sample, but the rescaling
cannot be reconstructed for an arbitrary new variable.
The names of the columns of data are no longer fixed. The study variable, the strata, the
clusters and the first-stage inclusion probabilities are identified through the arguments
study.variable, stratum, cluster and Pi1. The defaults for study.variable and cluster
match the column names used previously, while stratum and Pi1 default to NULL; a stratified
design is therefore specified by passing stratum the name of the stratum column.
The bootstrap functions return sample.size, the number of sampled units in each stratum.
direct.boot.stsrs and boot.twostage also return rescale.factor, the rescaling factor applied
to the study variable by the method of Rao and Wu (1988). For direct.boot.stsrs, row.id and
rescale.factor allow the bootstrap to be reproduced for another study variable.
Under the two-stage design of boot.twostage(), the study variable can be
reproduced from the rescaled values stored in boot.sample, but the rescaling cannot be
reconstructed for an arbitrary new variable.
The bootstrap functions now perform additional input validation and provide informative error
messages for invalid arguments. These checks include a non-integer or non-positive number of
replicates (R, R.pop, R.samp), first-stage inclusion probabilities Pi1 outside (0, 1] or
not constant within a cluster, a population.size that does not match the number of strata or is
smaller than the sampled size, and missing values in the study variable, the clusters or the strata.
direct.boot.stsrs returned incorrect results under stratified simple random sampling. The
rescaled values were taken over the whole sample rather than within the stratum being resampled,
so the values of one stratum were combined with the survey weights of another. Results under
simple random sampling were not affected.
pseudopop.boot.stsrs stopped with an error when the population mean was requested under
stratified simple random sampling.
boot.twostage returned an incorrect bootstrap mean for the method of Rao and Wu (1988) under a
stratified design. The bootstrap variance was not affected.
The method of Chauvet (2007) now runs under conditional Poisson sampling in boot.twostage.
For the method of Chauvet (2007), boot.twostage now computes the second-stage inclusion
probability of the bootstrap sample from the pseudo-population, under both simple random sampling
and conditional Poisson sampling.
direct.boot.stsrs is more than 20 times faster. The bootstrap indices within a stratum are now
drawn in a single call rather than one unit at a time.