mgVarPart {memgene} | R Documentation |
Variation partitioning of the genetic distance matrix
Description
This function performs a variation partitioning of the genetic distance matrix
using the supplied MEM eigenvectors and spatial coordinates. Randomization tests
are conducted to determine the significance of the [a] fraction representing
the MEM eigenvectors, the [c] fraction representing the spatial coordinates and
the [abc] fraction representing the spatial genetic variation. It is called
by mgLandscape
.
Usage
mgVarPart(genD, vectorsMEM, coords, perm=1000)
Arguments
genD |
A symmetrical distance matrix giving the genetic distances among individual genotypes or populations |
vectorsMEM |
A matrix giving a set of any number of MEM eigenvectors |
coords |
A two column |
perm |
The number of permutations to use when testing the significance of the [a], [c] and [abc] fractions. |
Details
See mgLandscape
for explanation of the fractions.
Author(s)
Pedro Peres-Neto (peres-neto.pedro@uqam.ca)
Paul Galpern (pgalpern@ucalgary.ca)
Examples
## Not run:
## Prepare the radial data for analysis
radialData <- read.csv(system.file("extdata/radial.csv", package="memgene"))
radialGen <- radialData[, -c(1,2)]
radialXY <- radialData[, 1:2]
if (require(adegenet)) {
radialDM <- codomToPropShared(radialGen)
} else {
stop("adegenent package required to produce genetic distance matrix in example.")
}
## Find MEM eigenvectors given sampling locations
## by first finding the Euclidean distance matrix
radialEuclid <- dist(radialXY)
radialMEM <- mgMEM(radialEuclid)
## Forward select significant MEM eigenvectors using RDA
## Positive MEM eigenvectors (positive spatial autocorrelation) first
radialPositive <- mgForward(radialDM,
radialMEM$vectorsMEM[ , radialMEM$valuesMEM > 0])
## Negative MEM eigenvectors (negative spatial autocorrelation) second
radialNegative <- mgForward(radialDM,
radialMEM$vectorsMEM[ , radialMEM$valuesMEM < 0])
## Summarize the selected MEM eigenvectors
allSelected <- cbind(radialMEM$vectorsMEM[, radialMEM$valuesMEM > 0][
, na.omit(radialPositive$selectedMEM)],
radialMEM$vectorsMEM[, radialMEM$valuesMEM < 0][
, na.omit(radialNegative$selectedMEM)])
## Use the selected MEM eigenvectors and coordinates in
## variation partitioning
radialVarPart <- mgVarPart(radialDM, allSelected, radialXY)
## End(Not run)