pd.pvalues: Computes the p-values of the unrooted Phylogenetic Diversity...

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

View source: R/PhyloMeasures.R

Description

Calculates the p-values of the unrooted phylogenetic diversity (PD) measure for sets of tips on a phylogeny. The p-values can be calculated under two different null models which maintain species richness.

Usage

1
2
pd.pvalues(tree, matrix, null.model="uniform", 
           abundance.weights, reps=1000, seed)

Arguments

tree

A phylo tree object

matrix

A matrix with binary (0/1) values, where each row represents a tip set. Each column name in the matrix must match a tip label on the input tree. If not all values in the matrix are binary, we consider two cases; if the matrix contains only non-negative values, all values are coerced to binary ones and a warning message is printed. If the matrix contains at least one negative value, the function throws an error.

null.model

A character vector (string) that defines which null model is used for computing the p-values of the measure. There are two possible null models that can be used for computing the p-values: these are "uniform" and "sequential". Both 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.

  • "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 model (which is 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 option "sequential" is 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 the other null model 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 the other null model is selected.

Value

A vector which stores the computed PD p-values. The i-th entry in this vector stores the PD p-value of the i-th row in the input matrix.

Author(s)

Constantinos Tsirogiannis (tsirogiannis.c@gmail.com)

References

Faith, D.P. 1992. Conservation evaluation and phylogenetic diversity. Biological Conservation 61: 1-10.

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 D. Cheliotis. 2012. Efficient computation of popular phylogenetic tree measures. Algorithms in Bioinformatics, LNCS 7534: 30-43.

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

See Also

pd.moments

Examples

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

#Create 100 random communities with 50 families each
comm = matrix(0,nrow = 100,ncol = length(bird.families$tip.label))
for(i in 1:nrow(comm)) {comm[i,sample(1:ncol(comm),50)] = 1}
colnames(comm) = bird.families$tip.label

#Calculate p-values under the uniform model
pd.pvalues(bird.families,comm, reps=1000)

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

#Use query function to calculate standardized versions under the sequential model
pd.pvalues(bird.families,comm,null.model="sequential",
           abundance.weights=weights, reps=1000)

Example output

  [1] 0.25374625 0.50349650 0.62137862 0.32967033 0.67332667 0.54445554
  [7] 0.18681319 0.04395604 0.47552448 0.38661339 0.44455544 0.32467532
 [13] 0.34065934 0.63736264 0.09690310 0.45854146 0.18781219 0.58141858
 [19] 0.59540460 0.74225774 0.94005994 0.73926074 0.21978022 0.47252747
 [25] 0.65734266 0.54745255 0.18181818 0.49850150 0.87712288 0.11888112
 [31] 0.99900100 0.02797203 0.42657343 0.20079920 0.27072927 0.02497502
 [37] 0.48751249 0.71728272 0.05794206 0.72127872 0.17982018 0.61338661
 [43] 0.26973027 0.76323676 0.58641359 0.98201798 0.63336663 0.26473526
 [49] 0.23876124 0.80019980 0.22277722 0.19480519 0.72527473 0.72727273
 [55] 0.13486513 0.50849151 0.20079920 0.82317682 0.77122877 0.29470529
 [61] 0.22177822 0.09290709 0.38461538 0.07692308 0.87712288 0.32767233
 [67] 0.33566434 0.62137862 0.73026973 0.76323676 0.17782218 0.62137862
 [73] 0.06893107 0.15284715 0.25374625 0.05994006 0.75224775 0.02997003
 [79] 0.57842158 0.27772228 0.98201798 0.24475524 0.81918082 0.56343656
 [85] 0.90509491 0.58841159 0.99500500 0.91808192 0.26873127 0.27672328
 [91] 0.92107892 0.91908092 0.32567433 0.18681319 0.05794206 0.93906094
 [97] 0.30869131 0.27872128 0.39660340 0.21978022
  [1] 0.25974026 0.56643357 0.68831169 0.35064935 0.73026973 0.60939061
  [7] 0.19680320 0.04995005 0.52447552 0.41158841 0.47852148 0.34065934
 [13] 0.35864136 0.70029970 0.10089910 0.49650350 0.19780220 0.64335664
 [19] 0.66333666 0.79120879 0.96203796 0.79120879 0.22377622 0.51748252
 [25] 0.71528472 0.61238761 0.18981019 0.55944056 0.90609391 0.12287712
 [31] 0.99900100 0.03296703 0.46053946 0.20579421 0.28971029 0.03096903
 [37] 0.54445554 0.77722278 0.07092907 0.77922078 0.18181818 0.67532468
 [43] 0.28571429 0.81418581 0.65234765 0.98501499 0.69630370 0.27272727
 [49] 0.24175824 0.84215784 0.22777223 0.20279720 0.78221778 0.78421578
 [55] 0.13586414 0.56943057 0.20579421 0.85414585 0.81818182 0.31168831
 [61] 0.22577423 0.09890110 0.40359640 0.08491508 0.90509491 0.34765235
 [67] 0.35464535 0.69030969 0.78621379 0.81418581 0.17582418 0.68831169
 [73] 0.07892108 0.14485514 0.26073926 0.07192807 0.80719281 0.03496503
 [79] 0.63636364 0.29870130 0.98501499 0.24975025 0.85414585 0.62537463
 [85] 0.93706294 0.65334665 0.99600400 0.94905095 0.28471528 0.29670330
 [91] 0.95204795 0.95104895 0.34665335 0.19580420 0.07092907 0.96203796
 [97] 0.32467532 0.29870130 0.41958042 0.22377622

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