Skip to contents

Calculate AUC, TSS, and RMSE for given density predictions and validation data

Usage

evaluation_metrics(x, x.idx, y, y.idx, count.flag = FALSE)

Arguments

x

object of class sf; SDM predictions

x.idx

name or index of column in x with prediction values

y

object of class sf; validation data

y.idx

name or index of column in y with validation data. This validation data column must have at least two unique values, e.g. 0 and 1

count.flag

logical; TRUE indicates that the data in column y.idx is count data, while FALSE indicates that the data is presence/absence. See details for differences in data processing based on this flag.

Value

A numeric vector with AUC, TSS and RMSE values, respectively. If count.flag == FALSE, the RMSE value will be NA

Details

If count.flag == TRUE, then eSDM::model_abundance(x, x.idx, FALSE) will be run to calculate predicted abundance and thus calculate RMSE. Note that this assumes the data in column x.idx of x are density values.

If count.flag == FALSE, then all of the values in column y.idx of y must be 0 or 1.

All rows of x with a value of NA in column x.idx and all rows of y with a value of NA in column y.idx are removed before calculating metrics

Examples

evaluation_metrics(preds.1, 2, validation.data, "sight")
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> [1] 0.3333333 0.2000000        NA

evaluation_metrics(preds.1, "Density2", validation.data, "count", TRUE)
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> [1]   0.3333333   0.2000000 404.3105603