Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The bioThreat function below takes two vectors of favourability values at different localities for, respectively, a stronger and a weaker species (e.g., a superior vs. an inferior competitor, or an invasive predator vs. an unadapted native prey), and calculates the level of threat that the former may potentially pose to the latter in each locality, building on theory by Richerson & Lum (1980), later developed by Acevedo et al. (2010, 2012) and further studies (e.g., Romero et al. 2014, Muñoz et al. 2015, Chamorro et al. 2019). It depends on the FavClass function (also shown below) for classifying favourability values into low, intermediate or high (Muñoz & Real 2016). For more details, see the help files of these functions in package fuzzySim >= 2.2.

``` favClass = 0, fav = 0, breaks <= 1 ) fclass <- rep(NA, length(fav)) b1 <- breaks[1] b2 <- breaks[2] for (f in 1:length(fav)) { if (is.na(fav[f])) next if (fav[f] < b1) fclass[f] = b1 & fav[f] < b2) fclass[f] = b2) fclass[f] <- 3 } if (character) { fclass[!is.na(fclass) & fclass == 1] <- "low" fclass[!is.na(fclass) & fclass == 2] <- "intermediate" fclass[!is.na(fclass) & fclass == 3] <- "high" } else fclass <- as.integer(fclass) return(fclass) }} ```

``` bioThreat <- function(strong_F, weak_F, character = FALSE, ...) { stopifnot(length(strong_F) == length(weak_F)) strong_F <- favClass(strong_F, ...) weak_F <- favClass(weak_F, ...) threat <- rep(NA, length(strong_F)) threat[strong_F == 3 & weak_F <= 2] <- 4 threat[strong_F == 2 & weak_F == 2] <- 3 threat[strong_F <= 2 & weak_F == 3] <- 2 threat[strong_F == 3 & weak_F == 3] <- 1 threat[strong_F == 1 | weak_F == 1] <- 0 if (character) { threat[!is.na(threat) & threat == 4] <- "red" threat[!is.na(threat) & threat == 3] <- "orange" threat[!is.na(threat) & threat == 2] <- "yellow" threat[!is.na(threat) & threat == 1] <- "green" threat[!is.na(threat) & threat == 0] <- "white" } else threat <- as.integer(threat) return(threat) } ```

To try it out, just copy, paste and run the code of both the above functions in your R session (or install and load package fuzzySim >= 2.2, currently available on R-Forge), and run it it for two favourability vectors for, respectively, a stronger and a weaker competitor species:

``` threat <- bioThreat(Fav_strong, Fav_weak) threat_colour <- bioThreat(Fav_strong, Fav_weak, character = TRUE) ```

You can then map the threat values to see where your stronger competitor is most and least threatening for your weaker one.

References

Acevedo P., Ward A.I., Real R. & Smith G.C. (2010) Assessing biogeographical relationships of ecologically related species using favourability functions: a case study on British deer. Diversity and Distributions, 16: 515-528

Acevedo P., Jiménez-Valverde A., Melo-Ferreira J., Real R. & Alves, P.C. (2012) Parapatric species and the implications for climate change studies: a case study on hares in Europe. Global Change Biology, 18: 1509-1519

Chamorro D., Muñoz A.R., Martínez-Freiría F. & Real R. (2019) Using the fuzzy logic in the distribution modelling of competitive interactions. Poster, IBS Malaga 2019 – 9th Biennial Conference of the International Biogeography Society: https://www.researchgate.net/publication/329352324_Using_the_fuzzy_logic_in_the_distribution_modelling_of_competitive_interactions

Muñoz A.R. & Real R. (2006) Assessing the potential range expansion of the exotic monk parakeet in Spain. Diversity and Distributions, 12: 656-665

Muñoz A.R., Real R. & Márquez A.L. (2015) Interacciones a escala nacional entre rapaces rupicolas en base a modelos de distribucion espacial. Los casos del buitre leonado, alimoche y aguila perdicera. Informe técnico, Universidad de Málaga & Fundación EDP: https://www.edpr.com/sites/default/files/portal.edpr/documents/edpr_2015_edpr-spain_interacciones-entre-rapaces-rupicolas_sp1.pdf

Richerson P.J. & Lum K. (1980) Patterns of plant species diversity in California: relation to weather and topography. American Naturalist, 116:504-536

Romero D., Báez J.C., Ferri-Yáñez F., Bellido J. & Real R. (2014) Modelling favourability for invasive species encroachment to identify areas of native species vulnerability. ScientificWorldJournal, 2014: 519710