part_random | R Documentation |
This function provides different conventional (randomized, non-spatial) partitioning methods based on cross validation folds (kfold, rep_kfold, and loocv), as well as bootstrap (boot)
part_random(data, pr_ab, method = NULL)
data |
data.frame. Database with presences, presence-absence, or pseudo-absence, records for a given species |
pr_ab |
character. Column name of "data" with presences, presence-absence, or pseudo-absence. Presences must be represented by 1 and absences by 0 |
method |
character. Vector with data partitioning method to be used. Usage part=c(method= 'kfold', folds='5'). Methods include:
|
A tibble object with information used in the 'data' argument and additional columns named .part containing the partition groups. The rep_kfold and boot method will return as many ".part" columns as replicated defined. For the rest of the methods, a single .part column is returned. For kfold, rep_kfold, and loocv partition methods, groups are defined by integers. In contrast, for boot method, the partition groups are defined by the characters 'train' and 'test'.
Fielding, A. H., & Bell, J. F. (1997). A review of methods for the assessment of prediction errors in conservation presence/absence models. Environmental Conservation, 24(1), 38-49. https://doi.org/10.1017/S0376892997000088
part_sblock
, part_senv
, sample_pseudoabs
, sample_background
## Not run:
data("abies")
abies$partition <- NULL
abies <- tibble(abies)
# K-fold method
abies2 <- part_random(
data = abies,
pr_ab = "pr_ab",
method = c(method = "kfold", folds = 10)
)
abies2
# Repeated K-fold method
abies2 <- part_random(
data = abies,
pr_ab = "pr_ab",
method = c(method = "rep_kfold", folds = 10, replicates = 10)
)
abies2
# Leave-one-out cross-validation (loocv) method
abies2 <- part_random(
data = abies,
pr_ab = "pr_ab",
method = c(method = "loocv")
)
abies2
# Bootstrap method
abies2 <- part_random(
data = abies,
pr_ab = "pr_ab",
method = c(method = "boot", replicates = 50, proportion = 0.7)
)
abies2
abies2$.part1 %>% table() # Note that for this method .partX columns have train and test words.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.