mntd.moments: Computes the moments of the Mean Nearest Taxon Distance...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/PhyloMeasures.R

Description

Calculates the mean and standard deviation of the Mean Nearest Taxon Distance (MNTD) for a tree and a vector of tip set sizes. The means and deviations can be calculated under three different null models which maintain species richness. Note: this function returns a result for the "uniform" and "frequency.by.richness" models only if the input tree is ultrametric.

Usage

1
2
mntd.moments(tree, sample.sizes, comp.expectation = TRUE, comp.deviation = TRUE, 
            null.model="uniform", abundance.weights, reps=1000, seed)

Arguments

tree

A phylo tree object

sample.sizes

A vector of non-negative integers specifying the tip set sizes for which to calculate moments

comp.expectation

Specifies whether the function should compute the mean (default = TRUE)

comp.deviation

Specifies whether the function should compute the standard deviation (default = TRUE)

null.model

A character vector (string) that defines which null model is used for computing the moments of the measure. There are three possible null models that can be used for computing the moments: these are "uniform", "frequency.by.richness", and "sequential". All these models maintain species richness. More specifically, the available models are defined as follows:

  • "uniform" considers samples with equal (uniform) probability among all possible tip samples of the same richness.

  • "frequency.by.richness" is an abundance-weighted model where species samples are chosen in a manner similar to the following process; first, each species is selected independently with probability proportional to its abundance. If the resulting sample consists of exactly the same number of elements as the input assemblage then it is used by the null model, otherwise it is tossed and the whole process is repeated.

  • "sequential" is an abundance-weighted null model where species samples are chosen based on the same method as R's sample function. Unlike the other two models (which are computed analytically), this model uses Monte-Carlo randomization.

This argument is optional, and its default value is set to "uniform".

abundance.weights

A vector of positive numeric values. These are the abundance weights that will be used if either of the options "frequency.by.richness" or "sequential" are selected. The names stored at the vector must match the names of the tips in the tree. This argument is redundant if the "uniform" model is selected.

reps

An integer that defines the number of Monte-Carlo random repetitions that will be performed when using the "sequential" model. This argument is redundant if any of the other two null models is selected.

seed

A positive integer that defines the random seed used in the Monte-Carlo randomizations of the "sequential" model. This argument is optional, and becomes redundant if any of the other two null models is selected.

Value

If both comp.expectation and comp.deviation are TRUE, the function returns a two-column matrix with one row per element in sample.sizes, where the first column stores the mean MNTD and the second column stores the standard deviation for this sample size. If only one of comp.expectation or comp.deviation are TRUE, the function returns a vector with the corresponding values instead.

Author(s)

Constantinos Tsirogiannis (tsirogiannis.c@gmail.com)

References

Tsirogiannis, C. and B. Sandel. 2015. PhyloMeasures: A package for computing phylogenetic biodiversity measures and their statistical moments. Ecography, doi: 10.1111/ecog.01814, 2015.

Tsirogiannis, C., B. Sandel and A. Kalvisa. 2014. New algorithms for computing phylogenetic biodiversity. Algorithms in Bioinformatics, LNCS 8701: 187-203.

Webb, C.O. 2000. Exploring the phylogenetic structure of ecological communities: An example for rain forest trees. The American Naturalist 156: 145-155.

See Also

mntd.query

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#Load phylogenetic tree of bird families from package "ape"
data(bird.families, package = "ape")

# Calculate mean and variance under the uniform model
mntd.moments(bird.families,1:100)

# Create random abundance weights
weights = runif(length(bird.families$tip.label))
names(weights) = bird.families$tip.label

# Calculate mean and variance under the sequential model
mntd.moments(bird.families,1:100,
             null.model="sequential", abundance.weights=weights, reps=1000)

PhyloMeasures documentation built on May 2, 2019, 6:17 a.m.