# Extraction of MEM eigenvectors given distances among sampling locations

### Description

Extract MEM eigenvectors given a distance matrix among sampling locations of genetic material. This matrix could be Euclidean or otherwise. If truncation and/or transformation parameters are provided these operations occur. Truncation implies that distances that exceed a threshold amount are assigned to 4 * threshold. Minimum spanning tree truncation is the recommended default. Transformation performs an exponential or gaussian transformation of the distance matrix after truncation.

### Usage

1 |

### Arguments

`locD` |
A symmetric distance matrix giving the distances (typically Euclidean) among the sampling locations of genetic material (e.g. of genotyped individuals or populations). |

`truncation` |
See details (EXPERIMENTAL) |

`transformation` |
Can be character "exponential" or "gaussian" or NULL for no transformation (EXPERIMENTAL) |

### Details

If sampling locations are in longitude/latitude and are far apart, be sure to
supply the geodesic distance as `locD`

. (Note that `mgQuick`

implements
geodesic distances using the `longlat=TRUE`

parameter when provided with sampling coordinates)

`truncation`

1. Can be numeric from 0 to 1 specifying the
proportion of the maximum distance in locD to truncate
following this a spanning tree is used to further
truncate as in PCNM (aka dbMEM or classical MEM)

2. Can be NULL (default) indicating only the minimum spanning tree (MST) truncation where
links that exceed the longest link in the MST (dMST) are replaced with 4 * dMST

3. Can be FALSE indicating that nothing is done to the distance matrix which is only suitable when locD is non-euclidean (i.e. will have negative eigenvectors

### Value

A list

`$valuesMEM`

gives the eigenvalues all MEM eigenvectors

`$vectorsMEM`

gives the MEM eigenvectors in columns

### Author(s)

Pedro Peres-Neto (peres-neto.pedro@uqam.ca)

Paul Galpern (pgalpern@ucalgary.ca)

### References

Legendre, P., and Legendre L. 2012. Numerical Ecology, 3rd. ed. Elsevier, Amsterdam.

### Examples

1 2 3 4 5 6 7 8 | ```
## Prepare the radial data for analysis
radialData <- read.csv(system.file("extdata/radial.csv", package="memgene"))
radialXY <- radialData[, 1:2]
## Find MEM eigenvectors given sampling locations
## by first finding the Euclidean distance matrix
radialEuclid <- dist(radialXY)
radialMEM <- mgMEM(radialEuclid)
``` |