overlap.Rd
This function calculates a useful measure of similarity between distributions known as the Bhattacharyya coefficient in statistics and simply the fidelity or overlap in quantum and statistical mechanics. It is roughly speaking the ratio of the intersection area to the average individual area, but it is a direct comparison between the density functions and does not require an arbitrary quantile to be specified. When applied to ctmm
objects, this function returns the overlap of the two Gaussian distributions. When applied to aligned UD
objects with corresponding movement models, this function returns the overlap of their (autocorrelated) kernel density estimates.
overlap(object,method="Bhattacharyya",level=0.95,debias=TRUE,...)
A list
of ctmm
fit or aligned UD
objects to compare.
Can be "Bhattacharyya"
or "Encounter"
(see Details below).
The confidence level desired for the output.
Approximate debiasing of the overlap.
Not currently used.
The default method="Bhattacharyya"
estimates the standard overlap measure \(\int\int \sqrt{p(x,y) \, q(x,y)} \, dx \, dy\) between the distributions \(p(x,y)\) and \(q(x,y)\),
while method="encounter"
estimates the non-standard measure \(\frac{\int\int p(x,y) \, q(x,y) \, dx \, dy}{\sqrt{\int\int p(x',y')^2 \, dx' dy' \int\int q(x'',y'')^2 \, dx'' dy''}}\),
which has a numerator proportional to the uncorrelated encounter probability.
Both measures lie between 0 and 1, where 0 indicates no shared support and 1 indicates identical distributions.
An object with slots DOF
, containing the effective sample sizes, and CI
containing a table of confidence intervals on the overlap estimates. A value of 1
implies that the two distributions are identical, while a value of 0
implies that the two distributions share no area in common.
K. Winner, M. J. Noonan, C. H. Fleming, K. Olson, T. Mueller, D. Sheldon, J. M. Calabrese. ``Statistical inference for home range overlap'', Methods in Ecology and Evolution, 9:7, 1679-1691 (2018) doi:10.1111/2041-210X.13027 .
In ctmm
v0.5.2, direct support for telemetry
objects was dropped and the CTMM
argument was depreciated for UD
objects, simplifying usage.
Uncertainties in the model fits are propagated into the overlap estimate under the approximation that the Bhattacharyya distance is a chi-square random variable. Debiasing makes further approximations noted in Winner & Noonan et al (2018).
# \donttest{
# Load package and data
library(ctmm)
data(buffalo)
# fit models for first two buffalo
GUESS <- lapply(buffalo[1:2], function(b) ctmm.guess(b,interactive=FALSE) )
# using ctmm.fit here for speed, but you should almost always use ctmm.select
FITS <- lapply(1:2, function(i) ctmm.fit(buffalo[[i]],GUESS[[i]]) )
names(FITS) <- names(buffalo[1:2])
# Gaussian overlap between these two buffalo
overlap(FITS)
#> $DOF
#> Cilla Gabs
#> Cilla Inf 0.001020658
#> Gabs 0.001020658 Inf
#>
#> $CI
#> , , low
#>
#> Cilla Gabs
#> Cilla 1.0000000 0.8984638
#> Gabs 0.8984638 1.0000000
#>
#> , , est
#>
#> Cilla Gabs
#> Cilla 1.0000000 0.9987807
#> Gabs 0.9987807 1.0000000
#>
#> , , high
#>
#> Cilla Gabs
#> Cilla 1 1
#> Gabs 1 1
#>
#>
#> attr(,"class")
#> [1] "overlap"
# AKDE overlap between these two buffalo
# create aligned UDs
UDS <- akde(buffalo[1:2],FITS)
#> Default grid size of 3 minutes chosen for bandwidth(...,fast=TRUE).
#> Default grid size of 2 minutes chosen for bandwidth(...,fast=TRUE).
# evaluate overlap
overlap(UDS)
#> $DOF
#> Cilla Gabs
#> Cilla Inf 0.01208218
#> Gabs 0.01208218 Inf
#>
#> $CI
#> , , low
#>
#> Cilla Gabs
#> Cilla 1.0000000 0.8957925
#> Gabs 0.8957925 1.0000000
#>
#> , , est
#>
#> Cilla Gabs
#> Cilla 1.0000000 0.9958112
#> Gabs 0.9958112 1.0000000
#>
#> , , high
#>
#> Cilla Gabs
#> Cilla 1 1
#> Gabs 1 1
#>
#>
#> attr(,"class")
#> [1] "overlap"
# }