fuzzyOverlay {fuzzySim} | R Documentation |
Logical and set operations are useful for comparative distribution modelling, to assess consensus or mismatches between the predictions of different models, and to quantify differences between models obtained for different time periods. Fuzzy set theory (Zadeh 1965, Barbosa & Real 2012) allows performing such operations without converting the predictions from continuous to binary, with the inherent application of arbitrary thresholds and over-simplification of model predictions. The result is a continuous numerical value quantifying the intersection, union, sum, or other operation among model predictions, whether binary or continuous.
fuzzyOverlay(data, overlay.cols = 1:ncol(data), op = "intersection", na.rm = FALSE, round.digits = 2)
data |
matrix or data frame containing the model predictions to compare. |
overlay.cols |
vector of the names or index numbers of the columns to compare. The default is all columns in |
op |
character value indicating the operation to perform between the prediction columns in |
na.rm |
logical value indicating if |
round.digits |
integer value indicating the number of decimal places to be used if op = "maintenance". The default is 2. |
If your predictions are probabilities, "prob_and" (probabilistic 'and') gives the probability of all species in data
occurring simultaneously by multiplying all probabilities; and "prob_or" (probabilistic 'or') gives the probability of any of them occurring at each site. These can be quite restrictive, though; probabilistic "and" can give particularly irrealistically small values.
If you have (or convert your probabilities to) favourability predictions, which can be used directly with fuzzy logic (Real et al. 2006; see Fav
function), you can use "fuzzy_and" or "intersection" to get the favourability for all species co-occurring at each site, and "fuzzy_or" or "union" to get favourability for any of them to occur at each site (Barbosa & Real 2012).
This function returns a vector, with length equal to the number of rows in data
, containing the row-wise result of the operation performed.
A. Marcia Barbosa
Barbosa A.M. & Real R. (2012) Applying fuzzy logic to comparative distribution modelling: a case study with two sympatric amphibians. The Scientific World Journal, 2012, Article ID 428206
Real R., Barbosa A.M. & Vargas J.M. (2006) Obtaining environmental favourability functions from logistic regression. Environmental and Ecological Statistics 13: 237-245.
Zadeh, L.A. (1965) Fuzzy sets. Information and Control, 8: 338-353
fuzSim
, modOverlap
and fuzzyRangeChange
for overall (not row-wise) comparisons among model predictions.
data(rotif.env) names(rotif.env) # get model predictions for 3 of the species in rotif.env: mods <- multGLM(rotif.env, sp.cols = 18:20, var.cols = 5:17, id.col = 1, step = TRUE, FDR = TRUE, trim = TRUE) preds <- mods$predictions[ , c("Abrigh_F", "Afissa_F", "Apriod_F")] # calculate intersection and union among those predictions: preds$intersect <- fuzzyOverlay(preds, op = "intersection") preds$union <- fuzzyOverlay(preds, op = "union") head(preds) # imagine you have a model prediction for species 'Abrigh' in a future time # (here we will create one by randomly jittering the current predictions) preds$Abrigh_imag <- jitter(preds[ , "Abrigh_F"], amount = 0.2) preds$Abrigh_imag[preds$Abrigh_imag < 0] <- 0 preds$Abrigh_imag[preds$Abrigh_imag > 1] <- 1 # you can calculate row-wise prediction changes from Abrigh to Abrigh_imag: preds$Abrigh_exp <- fuzzyOverlay(preds, overlay.cols = c("Abrigh_F", "Abrigh_imag"), op = "expansion") preds$Abrigh_contr <- fuzzyOverlay(preds, overlay.cols = c("Abrigh_F", "Abrigh_imag"), op = "contraction") preds$Abrigh_chg <- fuzzyOverlay(preds, overlay.cols = c("Abrigh_F", "Abrigh_imag"), op = "change") preds$Abrigh_maint <- fuzzyOverlay(preds, overlay.cols = c("Abrigh_F", "Abrigh_imag"), op = "maintenance") head(preds)