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)
Run the code above in your browser using DataLab