compressIndices(indices, n=nrow(indices)) uncompressIndices(x)
m
by B, vector of indices for
resampling, containing values from 1 to
n
(or 0 to
n
);
usually
m
=
n
;
"compressIndices"
.
size
argument to bootstrap samplers then the number
of rows of
indices
does not match the number of original observations,
and you should specify
n
as the latter.
"compressIndices"
, with additional components
indices
matrix.
n
.
uncompressIndices
returns an ordinary matrix of indices (the original
indices, except sorted by column, with any zeroes at the end).
All information about the order of the indices is lost in compression.
Each column of indices is converted to frequencies, and the information
about frequencies is stored in
m+n
bits, where
m
is the number of
rows of
indices
, with frequencies represented by the number of 1s
between 0's. The information is then stored in 32-bit unsigned integers.
If
m==n
the compressed indices require about 1/16 the space of the
original indices.
There are subscript, print, and cbind methods for
"compressIndices"
objects.
Subscripting columns returns another
"compressIndices"
object;
subscripting rows returns an ordinary matrix or vector.
The compressed indices may be stored as a "compressedIndices" component
of a
"bootstrap"
object, by setting
save.indices=2
when calling
.
extracts indices from a
"bootstrap"
object,
first looking for the original indices, then for
compressed indices (which it uncompresses).
indices <- samp.bootstrap(n = 100, B = 1000) cindices <- compressIndices(indices) indices2 <- uncompressIndices(cindices) all.equal(indices2, apply(indices, 2, sort)) # The same object.size(indices) # 400184 object.size(cindices) # 28386