diss.dist: Calculate a distance matrix based on relative dissimilarity

View source: R/distances.r

diss.distR Documentation

Calculate a distance matrix based on relative dissimilarity

Description

diss.dist uses the same discrete dissimilarity matrix utilized by the index of association (see ia for details). By default, it returns a distance reflecting the number of allelic differences between two individuals. When percent = TRUE, it returns a ratio of the number of observed differences by the number of possible differences. Eg. two individuals who share half of the same alleles will have a distance of 0.5. This function can analyze distances for any marker system.

Usage

diss.dist(x, percent = FALSE, mat = FALSE)

Arguments

x

a genind object.

percent

logical. Should the distance be represented as a percent? If set to FALSE (default), the distance will be reflected as the number of alleles differing between to individuals. When set to TRUE, These will be divided by the ploidy multiplied by the number of loci.

mat

logical. Return a matrix object. Default set to FALSE, returning a dist object. TRUE returns a matrix object.

Details

The distance calculated here is quite simple and goes by many names, depending on its application. The most familiar name might be the Hamming distance, or the number of differences between two strings.

Value

Pairwise distances between individuals present in the genind object.

Note

When percent = TRUE, this is exactly the same as provesti.dist, except that it performs better for large numbers of individuals (n > 125) at the cost of available memory.

Author(s)

Zhian N. Kamvar

See Also

prevosti.dist, bitwise.dist (for SNP data)

Examples


# A simple example. Let's analyze the mean distance among populations of A.
# euteiches.

data(Aeut)
mean(diss.dist(popsub(Aeut, 1)))
## Not run: 
mean(diss.dist(popsub(Aeut, 2)))
mean(diss.dist(Aeut))

## End(Not run)

poppr documentation built on May 29, 2024, 5:54 a.m.