R/sperrorest_resampling.R
represampling_factor_bootstrap.Rd
represampling_factor_bootstrap
resamples partitions defined by
a factor variable. This can be used for nonoverlapping block bootstraps
and similar.
represampling_factor_bootstrap( data, fac, repetition = 1, nboot = 1, seed1 = NULL, oob = FALSE )
data 


fac  defines a grouping or partitioning of the samples in 
repetition  numeric vector: crossvalidation repetitions to be
generated. Note that this is not the number of repetitions, but the indices
of these repetitions. E.g., use 
nboot  number of bootstrap replications used for generating the
bootstrap training sample ( 
seed1 

oob  if 
nboot
refers to the number of groups (as defined by the factors)
to be drawn with replacement from the set of groups. I.e., if fac
is a
factor variable, nboot
would normally not be greater than nlevels(fac)
,
nlevels(fac)
being the default as per nboot = 1
.
data(ecuador) # a dummy example for demonstration, performing bootstrap # at the level of an arbitrary factor variable: parti < represampling_factor_bootstrap(ecuador, factor(floor(ecuador$dem / 100)), oob = TRUE ) # plot(parti,ecuador) # using the factor bootstrap for a nonoverlapping block bootstrap # (see also represampling_tile_bootstrap): fac < partition_tiles(ecuador, return_factor = TRUE, repetition = c(1:3), dsplit = 500, min_n = 200, rotation = "random", offset = "random" ) parti < represampling_factor_bootstrap(ecuador, fac, oob = TRUE, repetition = c(1:3) ) # plot(parti, ecuador)