This function calculates the degree of overlap between the predictions of two models, using niche comparison metrics such as Schoener's D, Hellinger distance and Warren's I.

1 | ```
modOverlap(pred1, pred2, na.rm = TRUE)
``` |

`pred1` |
numeric vector of the predictions of a generalized linear model (values between 0 and 1). |

`pred2` |
numeric vector of the predictions of another generalized linear model; must be of the same length and in the same order as |

`na.rm` |
logical value indicating whether |

See Warren et al. (2008).

This function returns a list of 3 metrics:

`SchoenerD` |
Schoener's (1968) D statistic for niche overlap, varying between 0 (no overlap) and 1 (identical niches). |

`WarrenI` |
the I index of Warren et al. (2008), based on Hellinger distance (below) but re-formulated to also vary between 0 (no overlap) and 1 (identical niches). |

`HellingerDist` |
Hellinger distance (as in van der Vaart 1998, p. 211) between probability distributions, varying between 0 and 2. |

A function providing similar measures, `niche.overlap`

, is available in package phyloclim, but it requires complex and software-specific input data formats.

A. Marcia Barbosa

Schoener T.W. (1968) Anolis lizards of Bimini: resource partitioning in a complex fauna. Ecology 49: 704-726

van der Vaart A.W. (1998) Asymptotic statistics. Cambridge Univ. Press, Cambridge (UK)

Warren D.L., Glor R.E. & Turelli M. (2008) Environmental niche equivalency versus conservatism: quantitative approaches to niche evolution. Evolution, 62: 2868-83 (and further ERRATUM)

`fuzSim`

; `niche.overlap`

in package phyloclim

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
# get an environmental favourability model for a rotifer species:
data(rotif.env)
names(rotif.env)
fav_current <- multGLM(rotif.env, sp.cols = 18, var.cols = 5:17, step = TRUE,
FDR = TRUE, trim = TRUE, P = FALSE, Fav = TRUE) $ predictions
# imagine you have a model prediction for this species in a future time
# (here we will create one by randomly jittering the current predictions)
fav_imag <- jitter(fav_current, amount = 0.2)
fav_imag[fav_imag < 0] <- 0
fav_imag[fav_imag > 1] <- 1
# calculate niche overlap between current and imaginary future predictions:
modOverlap(fav_current, fav_imag)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.