pd.moments: Computes the moments of the Phylogenetic Diversity measure

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

View source: R/PhyloMeasures.R

Description

Calculates the mean and standard deviation of the unrooted Phylogenetic Diversity (PD) 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.

Usage

1
2
pd.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 PD 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

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 A. Kalvisa. 2014. New algorithms for computing phylogenetic biodiversity. Algorithms in Bioinformatics, LNCS 8701: 187-203.

See Also

pd.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
pd.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
pd.moments(bird.families,1:100,
           null.model="sequential", abundance.weights=weights, reps=1000)

Example output

             [,1]      [,2]
  [1,]    0.00000  0.000000
  [2,]   46.15466  8.365603
  [3,]   69.23199  8.976934
  [4,]   90.52932 10.162989
  [5,]  110.93665 11.373723
  [6,]  130.72145 12.481239
  [7,]  150.01745 13.470576
  [8,]  168.91044 14.352139
  [9,]  187.46224 15.139697
 [10,]  205.71984 15.845776
 [11,]  223.71996 16.481111
 [12,]  241.49181 17.054849
 [13,]  259.05901 17.574811
 [14,]  276.44089 18.047694
 [15,]  293.65349 18.479238
 [16,]  310.71030 18.874357
 [17,]  327.62279 19.237259
 [18,]  344.40081 19.571545
 [19,]  361.05296 19.880302
 [20,]  377.58677 20.166175
 [21,]  394.00893 20.431441
 [22,]  410.32541 20.678059
 [23,]  426.54160 20.907728
 [24,]  442.66238 21.121917
 [25,]  458.69217 21.321911
 [26,]  474.63506 21.508831
 [27,]  490.49479 21.683662
 [28,]  506.27482 21.847276
 [29,]  521.97835 22.000441
 [30,]  537.60835 22.143844
 [31,]  553.16760 22.278096
 [32,]  568.65870 22.403747
 [33,]  584.08407 22.521287
 [34,]  599.44599 22.631163
 [35,]  614.74658 22.733776
 [36,]  629.98788 22.829490
 [37,]  645.17177 22.918636
 [38,]  660.30004 23.001515
 [39,]  675.37439 23.078402
 [40,]  690.39642 23.149546
 [41,]  705.36766 23.215176
 [42,]  720.28954 23.275501
 [43,]  735.16343 23.330713
 [44,]  749.99063 23.380985
 [45,]  764.77240 23.426478
 [46,]  779.50990 23.467338
 [47,]  794.20426 23.503698
 [48,]  808.85657 23.535679
 [49,]  823.46785 23.563392
 [50,]  838.03908 23.586938
 [51,]  852.57120 23.606408
 [52,]  867.06512 23.621885
 [53,]  881.52170 23.633443
 [54,]  895.94177 23.641148
 [55,]  910.32612 23.645061
 [56,]  924.67552 23.645233
 [57,]  938.99070 23.641711
 [58,]  953.27237 23.634536
 [59,]  967.52120 23.623741
 [60,]  981.73786 23.609357
 [61,]  995.92296 23.591407
 [62,] 1010.07712 23.569910
 [63,] 1024.20092 23.544880
 [64,] 1038.29493 23.516328
 [65,] 1052.35968 23.484258
 [66,] 1066.39571 23.448673
 [67,] 1080.40351 23.409569
 [68,] 1094.38358 23.366941
 [69,] 1108.33640 23.320777
 [70,] 1122.26241 23.271064
 [71,] 1136.16206 23.217784
 [72,] 1150.03578 23.160916
 [73,] 1163.88398 23.100435
 [74,] 1177.70706 23.036313
 [75,] 1191.50540 22.968519
 [76,] 1205.27939 22.897016
 [77,] 1219.02938 22.821768
 [78,] 1232.75572 22.742731
 [79,] 1246.45876 22.659861
 [80,] 1260.13883 22.573108
 [81,] 1273.79623 22.482419
 [82,] 1287.43129 22.387739
 [83,] 1301.04431 22.289006
 [84,] 1314.63556 22.186157
 [85,] 1328.20534 22.079124
 [86,] 1341.75392 21.967833
 [87,] 1355.28157 21.852207
 [88,] 1368.78854 21.732166
 [89,] 1382.27507 21.607622
 [90,] 1395.74142 21.478483
 [91,] 1409.18782 21.344652
 [92,] 1422.61449 21.206027
 [93,] 1436.02167 21.062498
 [94,] 1449.40955 20.913948
 [95,] 1462.77835 20.760255
 [96,] 1476.12828 20.601288
 [97,] 1489.45953 20.436908
 [98,] 1502.77229 20.266967
 [99,] 1516.06675 20.091308
[100,] 1529.34308 19.909763
            [,1]      [,2]
  [1,]    0.0000  0.000000
  [2,]   46.5248  8.441061
  [3,]   69.7219  9.162713
  [4,]   91.5800  9.852549
  [5,]  112.2474 11.000989
  [6,]  132.4469 12.073908
  [7,]  151.8816 13.214405
  [8,]  170.8513 14.082086
  [9,]  189.6788 14.789026
 [10,]  208.3888 15.287945
 [11,]  227.0591 15.634944
 [12,]  244.9380 16.103966
 [13,]  262.7925 16.631228
 [14,]  279.9706 17.212203
 [15,]  297.4786 17.719667
 [16,]  314.9479 18.323647
 [17,]  332.4513 18.735114
 [18,]  349.3545 19.519109
 [19,]  366.0141 19.375728
 [20,]  382.9146 19.567483
 [21,]  399.4685 19.512471
 [22,]  416.1492 19.734695
 [23,]  432.4285 20.142404
 [24,]  448.8806 20.183909
 [25,]  465.3058 20.491085
 [26,]  481.4815 20.271181
 [27,]  497.7472 20.461256
 [28,]  513.6073 20.579140
 [29,]  529.6861 20.528137
 [30,]  545.5695 20.626626
 [31,]  561.4643 20.778116
 [32,]  577.3125 20.868321
 [33,]  592.8872 20.986402
 [34,]  608.1730 21.189865
 [35,]  623.5239 21.342528
 [36,]  638.5976 21.437832
 [37,]  654.1649 21.604623
 [38,]  669.4939 21.796830
 [39,]  685.0537 21.908498
 [40,]  700.3838 22.043803
 [41,]  715.2331 21.945219
 [42,]  730.4239 21.976827
 [43,]  745.5445 21.960083
 [44,]  760.3171 22.010578
 [45,]  775.3747 22.004878
 [46,]  790.4979 21.816634
 [47,]  805.4386 21.742939
 [48,]  820.4272 21.595654
 [49,]  835.2692 21.514963
 [50,]  849.9911 21.415262
 [51,]  864.7800 21.344064
 [52,]  879.6209 21.139832
 [53,]  894.2871 21.266466
 [54,]  908.8015 21.044424
 [55,]  923.3952 21.310944
 [56,]  937.7293 21.311719
 [57,]  952.0582 20.936035
 [58,]  966.4842 20.824391
 [59,]  980.7285 20.674548
 [60,]  995.1395 20.477423
 [61,] 1009.2632 20.677301
 [62,] 1023.6515 20.672766
 [63,] 1037.7562 20.610809
 [64,] 1051.7443 20.576489
 [65,] 1065.8596 20.487672
 [66,] 1079.9352 20.315029
 [67,] 1093.8205 20.026836
 [68,] 1107.9430 19.965004
 [69,] 1121.9435 19.975948
 [70,] 1135.9368 20.205610
 [71,] 1149.9498 19.845123
 [72,] 1164.1097 19.715718
 [73,] 1178.0909 19.646226
 [74,] 1192.0387 19.366700
 [75,] 1205.8464 19.257146
 [76,] 1219.4137 19.228474
 [77,] 1232.9157 19.058546
 [78,] 1246.5409 19.073247
 [79,] 1260.1150 18.925576
 [80,] 1273.5087 18.934937
 [81,] 1287.3005 18.744103
 [82,] 1301.0317 18.564787
 [83,] 1314.6264 18.658633
 [84,] 1328.0889 18.429748
 [85,] 1341.3475 18.470134
 [86,] 1354.9274 18.032276
 [87,] 1368.5501 17.866729
 [88,] 1381.9396 17.654763
 [89,] 1395.4111 17.564165
 [90,] 1408.7217 17.346780
 [91,] 1421.9878 17.185758
 [92,] 1435.1547 17.021317
 [93,] 1448.3982 16.963284
 [94,] 1461.3683 16.955418
 [95,] 1474.5360 16.574079
 [96,] 1487.5709 16.364351
 [97,] 1500.7533 16.283490
 [98,] 1513.8080 15.882956
 [99,] 1526.8329 15.823590
[100,] 1539.9535 15.528493

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