Optimal.Similarity: Optimal scale parameter to transform a distance matrix into a...

View source: R/Optimal.Similarity.R

Optimal.SimilarityR Documentation

Optimal scale parameter to transform a distance matrix into a similarity matrix

Description

Calculates the scale parameter u that maximizes the variance of the similarity matrix exp(-u*DistanceMatrix).

Usage

Optimal.Similarity(Distance, CheckArguments = TRUE)

Arguments

Distance

A distance matrix, i.e. a square matrix with zeros on its diagonal or a dist object.

CheckArguments

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

Details

The similarity matrix used by Dqz) can be optimized following Marcon et al. (2014) such that the variance of similarities between pairs of species is maximized. See the example.

Value

A list:

u

The optimal scale u.

Matrix

The optimal similarity matrix Z.

References

Marcon, E., Zhang, Z. and Herault, B. (2014). The decomposition of similarity-based diversity and its bias correction. HAL hal-00989454(version 3).

See Also

Dqz

Examples

# Load Paracou data (number of trees per species in two 1-ha plot of a tropical forest)
data(Paracou618)
# Prepare the similarity matrix. The square root of Paracou618.dist is euclidean.
optimal <- Optimal.Similarity(sqrt(Paracou618.dist))
# Optimal scale
optimal$u
# Calculate diversity of order 2
bcDqz(Paracou618.MC$Ns, 2, optimal$Matrix)

entropart documentation built on Sept. 11, 2024, 6:20 p.m.