R/sperrorest_resampling.R
represampling_disc_bootstrap.Rdrepresampling_disc_bootstrap performs a spatial block
bootstrap by resampling at the level of rectangular partitions or 'tiles'
generated by partition_tiles.
represampling_disc_bootstrap(
data,
coords = c("x", "y"),
nboot,
repetition = 1,
seed1 = NULL,
oob = FALSE,
...
)data.frame containing at least the columns specified by
coords
vector of length 2 defining the variables in data that
contain the x and y coordinates of sample locations.
number of bootstrap samples; you may specify different values
for the training sample (nboot[1]) and for the test sample (nboot[2]).
numeric vector: cross-validation repetitions to be
generated. Note that this is not the number of repetitions, but the indices
of these repetitions. E.g., use repetition = c(1:100) to obtain (the
'first') 100 repetitions, and repetition = c(101:200) to obtain a
different set of 100 repetitions.
seed1+i is the random seed that will be used by set.seed in
repetition i (i in repetition) to initialize the random number
generator before sampling from the data set.
logical (default FALSE): if TRUE, use the out-of-bag sample as
the test sample (the complement of the nboot[1] test set discs, minus the
buffer area as specified in the ... arguments to partition_disc); if
FALSE, draw a second bootstrap sample of size nboot independently to
obtain a test sample (sets of overlapping discs drawn with replacement).
additional arguments to be passed to partition_disc; note that a
buffer argument has not effect if oob=FALSE; see example below
Performs nboot out of nrow(data) resampling of circular discs. This
is an overlapping spatial block bootstrap where the blocks are circular.
data(ecuador)
# Overlapping disc bootstrap:
parti <- represampling_disc_bootstrap(ecuador,
radius = 200, nboot = 20,
oob = FALSE
)
# plot(parti, ecuador)
# Note that a 'buffer' argument would make no difference because boostrap
# sets of discs are drawn independently for the training and test sample.
#
# Overlapping disc bootstrap for training sample, out-of-bag sample as test
# sample:
parti <- represampling_disc_bootstrap(ecuador,
radius = 200, buffer = 200,
nboot = 10, oob = TRUE
)
# plot(parti,ecuador)