View source: R/select_models.R
| select_models | R Documentation |
This function selects the best models according to user-defined criteria, evaluating statistical significance (partial ROC), predictive ability (omission rates), and model complexity (AIC).
select_models(calibration_results = NULL, candidate_models = NULL, data = NULL,
algorithm = NULL, compute_proc = FALSE,
addsamplestobackground = TRUE, weights = NULL,
remove_concave = FALSE, omission_rate = NULL,
allow_tolerance = TRUE, tolerance = 0.01,
significance = 0.05, delta_aic = 2, parallel = FALSE,
ncores = NULL, progress_bar = FALSE,verbose = TRUE)
calibration_results |
an object of class |
candidate_models |
(data.frame) a summary of the evaluation metrics for each
candidate model. Required only if |
data |
an object of class |
algorithm |
(character) model algorithm, either "glm" or "maxnet". The
default, NULL, uses the one defined as part of |
compute_proc |
(logical) whether to compute partial ROC tests for the selected models. This is required when partial ROC is not calculated for all candidate models during calibration. Default is FALSE. |
addsamplestobackground |
(logical) whether to add to the background any
presence sample that is not already there. Required only if |
weights |
(numeric) a numeric vector specifying weights for the
occurrence records. Required only if |
remove_concave |
(logical) whether to remove candidate models presenting concave curves. Default is FALSE. |
omission_rate |
(numeric) the maximum omission rate a candidate model
can have to be considered as a potentially selected model. The default, NULL,
uses the value provided as part of |
allow_tolerance |
(logical) whether to allow selection of models with
minimum values of omission rates even if their omission rate surpasses the
|
tolerance |
(numeric) The value added to the minimum omission rate if it
exceeds the |
significance |
(numeric) the significance level to select models based on the partial ROC (pROC). Default is 0.05. See Details. |
delta_aic |
(numeric) the value of delta AIC used as a threshold to select models. Default is 2. |
parallel |
(logical) whether to calculate the PROC of the candidate models in parallel. Default is FALSE. |
ncores |
(numeric) number of cores to use for parallel processing.
Default is NULL and uses available cores - 1. This is only applicable if
|
progress_bar |
(logical) whether to display a progress bar during processing. Default is TRUE. |
verbose |
(logical) whether to display messages during processing. Default is TRUE. |
Partial ROC is calculated following Peterson et al. (2008).
If calibration_results is provided, it returns a new calibration_results with the new selected models and summary. If calibration_results is NULL, it returns a list containing the following elements:
selected_models: data frame with the ID and the summary of evaluation metrics for the selected models.
summary: A list containing the delta AIC values for model selection, and the ID values of models that failed to fit, had concave curves, non-significant pROC values, omission rates above the threshold, delta AIC values above the threshold, and the selected models.
# Import example of calibration results (output of calibration function)
## GLM
data(calib_results_glm, package = "kuenm2")
#Select new best models based on another value of omission rate
new_best_model <- select_models(calibration_results = calib_results_glm,
algorithm = "glm", compute_proc = TRUE,
omission_rate = 10) # Omission error of 10
# Compare with best models selected previously
calib_results_glm$summary$Selected # Model 86 selected
new_best_model$summary$Selected # Models 64, 73 and 86 selected
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.