partition_disc
partitions the sample into training and tests set by
selecting circular test areas (possibly surrounded by an exclusion buffer)
and using the remaining samples as training samples (leave-one-disc-out
cross-validation). partition_loo
creates training and test sets for
leave-one-out cross-validation with (optional) buffer.
partition_disc(data, coords = c("x", "y"), radius, buffer = NULL, ndisc = nrow(data), seed1 = NULL, return_train = TRUE, prob = NULL, replace = FALSE, repetition = 1) partition_loo(data, ndisc = nrow(data), replace = FALSE, ...)
data |
|
---|---|
coords | vector of length 2 defining the variables in |
radius | radius of test area discs; performs leave-one-out resampling if radius <0. |
buffer | radius of additional 'neutral area' around test area discs that is excluded from training and test sets; defaults to 0, i.e. all samples are either in the test area or in the training area. |
ndisc | Number of discs to be randomly selected; each disc constitutes
a separate test set. Defaults to |
seed1 |
|
return_train | If |
prob | optional argument to sample. |
replace | optional argument to sample: sampling with or without replacement? |
repetition | see |
... | arguments to be passed to |
A represampling object.
Contains length(repetition)
resampling
objects.
Each of these contains ndisc
lists with indices of test and
(if return_train = TRUE
) training sets.
Test area discs are centered at (random) samples, not at general
random locations. Test area discs may (and likely will) overlap independently
of the value of replace
. replace
only controls the replacement
of the center point of discs when drawing center points from the samples.
radius < 0
does leave-one-out resampling with an optional buffer.
radius = 0
is similar except that samples with identical coordinates
would fall within the test area disc.
Brenning, A. 2005. Spatial prediction models for landslide hazards: review, comparison and evaluation. Natural Hazards and Earth System Sciences, 5(6): 853-862.
sperrorest, partition_cv, partition_kmeans
data(ecuador) parti <- partition_disc(ecuador, radius = 200, buffer = 200, ndisc = 5, repetition = 1:2) # plot(parti,ecuador) summary(parti)#> $`1` #> n.train n.test #> 635 718 6 #> 44 727 9 #> 263 723 24 #> 28 727 6 #> 129 708 17 #> #> $`2` #> n.train n.test #> 70 712 6 #> 594 708 13 #> 412 711 13 #> 250 729 5 #> 689 725 5 #># leave-one-out with buffer: parti.loo <- partition_loo(ecuador, buffer = 200) summary(parti)#> $`1` #> n.train n.test #> 635 718 6 #> 44 727 9 #> 263 723 24 #> 28 727 6 #> 129 708 17 #> #> $`2` #> n.train n.test #> 70 712 6 #> 594 708 13 #> 412 711 13 #> 250 729 5 #> 689 725 5 #>