Computes performance metrics for a single fitted model, including standard
yardstick metrics (ROC AUC, accuracy, sensitivity, specificity, F1-score, Kappa),
as well as TSS (True Skill Statistic) and Boyce index. Designed as a helper function
for evaluating models produced by h3sdm_fit_model
or h3sdm_fit_models
.
Usage
h3sdm_eval_metrics(
fitted_model,
presence_data = NULL,
truth_col = "presence",
pred_col = ".pred_1"
)
Arguments
- fitted_model
A fitted model object, typically the result of
h3sdm_fit_model()
.- presence_data
Optional. An
sf
object or tibble containing presence locations to compute the Boyce index.- truth_col
Character. Name of the column with true presence/absence values (default
"presence"
).- pred_col
Character. Name of the column with predicted probabilities (default
".pred_1"
).
Value
A tibble with one row per metric, including:
- .metric
Metric name (e.g., "roc_auc", "tss", "boyce").
- .estimator
Estimator type (usually "binary").
- mean
Metric value.
- std_err
Standard error (NA for TSS and Boyce).
- conf_low
Lower 95% confidence interval (NA for TSS and Boyce).
- conf_high
Upper 95% confidence interval (NA for TSS and Boyce).