fun_similarity: Functional similarity

View source: R/fun_similarity.R

fun_similarityR Documentation

Functional similarity

Description

Transform a distance matrix into a similarity matrix \insertCiteLeinster2012divent. Similarity between two species is defined either by a negative exponential function of their distance or by the complement to 1 of their normalized distance (such that the most distant species are 1 apart).

Usage

fun_similarity(distances, exponential = TRUE, rate = 1, check_arguments = TRUE)

Arguments

distances

a distance matrix or an object of class stats::dist.

exponential

If TRUE, similarity is e^{-r \delta}, where r is argument rate. If FALSE, it is 1 - \delta / \max(\delta).

rate

the decay rate of the exponential similarity.

check_arguments

if TRUE, the function arguments are verified. Should be set to FALSE to save time when the arguments have been checked elsewhere.

Value

A similarity matrix.

References

\insertAllCited

Examples

# Similarity between Paracou 6 species
hist(fun_similarity(paracou_6_fundist))


divent documentation built on April 3, 2025, 7:40 p.m.