Description Usage Arguments Value Note Author(s) References See Also Examples

The `optiThresh`

function calculates optimal thresholds for a number of model evaluation measures (see `threshMeasures`

). Optimization is given for each measure, and/or for all measures according to particular criteria (e.g. Jimenez-Valverde & Lobo 2007, Nenzen & Araujo 2011). Results are given numerically and in plots.

1 2 3 4 | ```
optiThresh(model = NULL, obs = NULL, pred = NULL, interval = 0.01,
measures = modEvAmethods("threshMeasures"),
optimize = modEvAmethods("optiThresh"), simplif = FALSE,
plot = TRUE, sep.plots = FALSE, xlab = "Threshold", ...)
``` |

`model` |
a model object of class "glm". |

`obs` |
a vector of observed presences (1) and absences (0) or another binary response variable. This argument is ignored if |

`pred` |
a vector with the corresponding predicted values of presence probability, habitat suitability, environmental favourability or alike. This argument is ignored if |

`interval` |
numeric value between 0 and 1 indicating the interval between the thresholds at which to calculate the evaluation measures. Defaults to 0.01. |

`measures` |
character vector indicating the names of the model evaluation measures for which to calculate optimal thresholds. The default is using all measures available in |

`optimize` |
character vector indicating the threshold optimization criteria to use; "each" calculates the optimal threshold for each model evaluation measure, while the remaining options optimize all measures according to the specified criterion. The default is using all criteria available in |

`simplif` |
logical, whether to calculate a faster simplified version. Used internally in other functions. |

`plot` |
logical, whether to plot the values of each evaluation measure at all thresholds. |

`sep.plots` |
logical. If |

`xlab` |
character vector indicating the label of the x axis. |

`...` |
additional arguments to pass to |

This function returns a list with the following components:

`all.thresholds` |
a data frame with the values of all analysed measures at all analysed thresholds. |

`optimals.each` |
if "each" is among the threshold criteria specified in |

`optimals.criteria` |
a data frame with the values of measure at the threshold that maximizes each of the criteria specified in |

Some measures cannot be calculated for thresholds at which there are zeros in the confusion matrix, hence the eventual 'NaN' or 'Inf' in results. Also, optimization may be deceiving for some measures; use `plot = TRUE`

and inspect the plot(s).

A. Marcia Barbosa

Jimenez-Valverde A. & Lobo J.M. (2007) Threshold criteria for conversion of probability of species presence to either-or presence-absence. Acta Oecologica 31: 361-369.

Nenzen H.K. & Araujo M.B. (2011) Choice of threshold alters projections of species range shifts under climate change. Ecological Modelling 222: 3346-3354.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
# load sample models:
data(rotif.mods)
# choose a particular model to play with:
mod <- rotif.mods$models[[1]]
optiThresh(model = mod)
# change some of the parameters:
optiThresh(model = mod, pch = 20, measures = c("CCR", "Sensitivity",
"Specificity", "UPR", "OPR", "kappa", "TSS"), ylim = c(0, 1))
# you can also use optiThresh with vectors of observed and predicted values
# instead of with a model object:
optiThresh(obs = mod$y, pred = mod$fitted.values, pch = ".")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.