Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Find.Optim.Stat

Calculate the best score according to a given evaluation method


Description

Find.Optim.Stat is an internal biomod2 function to find the threshold to convert continuous values into binary ones leading to the best score for a given evaluation metric.

Usage

Find.Optim.Stat(Stat='TSS',
                  Fit,
                  Obs,
                  Nb.thresh.test = 100,
                  Fixed.thresh = NULL)

Arguments

Stat

either 'ROC', TSS', 'KAPPA', 'ACCURACY', 'BIAS', 'POD', 'FAR', 'POFD', 'SR', 'CSI', 'ETS', 'HK', 'HSS', 'OR' or 'ORSS'

Fit

vector of fitted values (continuous)

Obs

vector of observed values (binary)

Nb.thresh.test

integer, the numer of thresholds tested over the range of fitted value

Fixed.thresh

integer, if not NULL, the only threshold value tested

Details

Please refer to BIOMOD_Modeling to get more information about this metrics. If you give a Fixed.thresh, no optimisation will be done. Only the score for this threshold will be returned.

Value

A 1 row x 4 column matrix :

  • best.iter: the best score obtained for chosen statistic

  • cutoff: the associated cut-off used for transform fitted vector into binary

  • sensibility: the sensibility with this threshold

  • specificity: the specificity with this threshold

Author(s)

Damien Georges

See Also

Examples

a <- sample(c(0,1),100, replace=TRUE)

  ##' random drawing
  b <- runif(100,min=0,max=1000)
  Find.Optim.Stat(Stat='TSS',
                  Fit=b,
                  Obs=a)

  ##' biased drawing
  BiasedDrawing <- function(x, m1=300, sd1=200, m2=700, sd2=200){
    return(ifelse(x<0.5, rnorm(1,m1,sd1), rnorm(1,m2,sd2)))
  }

  c <- sapply(a,BiasedDrawing)

  Find.Optim.Stat(Stat='TSS',
                  Fit=c,
                  Obs=a,
                  Nb.thresh.test = 100)

biomod2

Ensemble Platform for Species Distribution Modeling

v3.4.6
GPL-2
Authors
Wilfried Thuiller [aut, cre], Damien Georges [aut, cre], Robin Engler [aut], Frank Breiner [aut]
Initial release
2020-02-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.