View source: R/independent_evaluation.R
| independent_evaluation | R Documentation |
This function evaluates the selected models using independent data (i.e., data not used during model calibration). The function computes omission rate and pROC, and optionally assesses whether the environmental conditions in the independent data are analogous (i.e., within the range) to those in the calibration data.
independent_evaluation(fitted_models, new_data,
consensus = c("mean", "median"),
type = "cloglog", extrapolation_type = "E",
var_to_restrict = NULL, perform_mop = TRUE,
mop_type = "detailed",
calculate_distance = TRUE,
where_distance = "all",
return_predictions = TRUE,
return_binary = TRUE,
progress_bar = FALSE, ...)
fitted_models |
an object of class |
new_data |
a |
consensus |
(character) vector specifying the types of consensus to
use. Available options are |
type |
(character) the format of prediction values. For |
extrapolation_type |
(character) extrapolation type of model. Models can be transferred with three options: free extrapolation ('E'), extrapolation with clamping ('EC'), and no extrapolation ('NE'). Default = 'E'. See details. |
var_to_restrict |
(character) vector specifying which variables to clamp or
not extrapolate. Only applicable if extrapolation_type is "EC" or "NE".
Default is |
perform_mop |
(logical) whether to execute a Mobility-Oriented Parity
(MOP) analysis. This analysis assesses if the environmental conditions in the
|
mop_type |
(character) type of MOP analysis to be performed. Options
available are "basic", "simple" and "detailed". Default is 'simples'. See
|
calculate_distance |
(logical) whether to calculate distances (dissimilarities) between new_data and calibration data. Default is TRUE. |
where_distance |
(character) specifies which values in |
return_predictions |
(logical) whether to return continuous predictions
at the locations of independent records in |
return_binary |
(logical) whether to return binary predictions
at the locations of independent records in |
progress_bar |
(logical) whether to display a progress bar during mop processing. Default is FALSE. |
... |
additional arguments passed to |
A list containing the following elements:
evaluation: A data.frame with omission rate and pROC values for each
selected model and for the consensus.
mop_results: (Only if perform_mop = TRUE) An object of class
mop_results, with metrics of environmental similarity between calibration
and independent data.
predictions: (Only if return_predictions = TRUE) A list of
data.frames containing continuous and binary predictions at the independent
record locations, along with MOP distances, an indicator of whether
environmental conditions at each location fall within the calibration range,
and the identity of the variables that have lower and higher values than the
calibration range. If the fitted_models object includes categorical
variables, the returned data.frame will also contain columns indicating
which values in new_data were not present in the calibration data.
# Example with maxnet
# Import example of fitted_models (output of fit_selected())
data("fitted_model_maxnet", package = "kuenm2")
# Import independent records to evaluate the models
data("new_occ", package = "kuenm2")
# Import raster layers
var <- terra::rast(system.file("extdata", "Current_variables.tif",
package = "kuenm2"))
#Extract variables to occurrences
new_data <- extract_occurrence_variables(occ = new_occ, x = "x", y = "y",
raster_variables = var)
#Add some fake data beyond the limits of calibration ranges
fake_data <- data.frame("pr_bg" = c(1, 1, 1),
"x" = c(NA, NA, NA),
"y" = c(NA, NA, NA),
"bio_1" = c(10, 15, 23),
"bio_7" = c(12, 16, 20),
"bio_12" = c(2300, 2000, 1000),
"bio_15" = c(30, 40, 50),
"SoilType" = c(1, 1, 1))
new_data <- rbind(new_data, fake_data)
# Evaluate models with independent data
res_ind <- independent_evaluation(fitted_models = fitted_model_maxnet,
new_data = new_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.