R Under development (unstable) (2022-06-05 r82452) -- "Unsuffered Consequences" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "PhyloMeasures" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('PhyloMeasures') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("PhyloMeasures-package") > ### * PhyloMeasures-package > > flush(stderr()); flush(stdout()) > > ### Name: PhyloMeasures-package > ### Title: PhyloMeasures: Fast Computations of Phylogenetic Biodiversity > ### Measures > ### Aliases: PhyloMeasures-package PhyloMeasures > ### Keywords: phylogeny biodiversity distance > > ### ** Examples > > #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 > > #Use query function to calculate pd values for each community > pd.query(bird.families,comm) [1] 827.0 851.0 854.5 848.4 829.3 838.3 826.3 824.2 869.2 839.9 809.8 840.6 [13] 798.4 847.8 825.8 825.6 821.7 849.6 853.6 833.6 841.4 775.8 863.8 838.4 [25] 854.0 860.9 830.7 885.1 794.2 884.3 837.9 820.8 796.1 854.3 833.9 837.9 [37] 862.5 790.5 852.0 839.6 835.2 855.8 829.7 821.2 833.3 792.4 810.5 841.5 [49] 816.1 811.2 862.1 809.7 852.0 878.5 836.1 833.2 844.1 799.1 833.3 831.8 [61] 838.7 848.0 844.9 862.0 853.9 794.4 859.2 842.9 831.5 787.3 853.3 841.3 [73] 806.3 841.9 840.8 810.8 867.9 830.1 827.0 854.8 852.9 847.8 847.5 803.2 [85] 848.7 874.6 886.6 817.1 860.1 886.8 824.3 814.0 868.3 852.9 840.6 824.9 [97] 803.9 869.4 814.8 824.9 > > #Use query function to calculate standardised versions under the uniform model > pd.query(bird.families,comm,TRUE) [1] -0.468016587 0.549495731 0.697882945 0.439265230 -0.370504990 [6] 0.011062130 -0.497694029 -0.586726357 1.321109239 0.078896284 [11] -1.197233748 0.108573727 -1.680552099 0.413827422 -0.518892203 [16] -0.527371472 -0.692717224 0.490140846 0.659726233 -0.188200699 [21] 0.142490804 -2.638709532 1.092168968 0.015301764 0.676684771 [26] 0.969219563 -0.311150104 1.995211150 -1.858616755 1.961294073 [31] -0.005896409 -0.730873936 -1.778063696 0.689403675 -0.175481795 [36] -0.005896409 1.037053717 -2.015483237 0.591892078 0.066177380 [41] -0.120366545 0.752998195 -0.353546451 -0.713915397 -0.200919603 [46] -1.934930179 -1.167556305 0.146730439 -0.930136765 -1.137878863 [51] 1.020095179 -1.201473383 0.591892078 1.715395263 -0.082209833 [56] -0.205159238 0.256960940 -1.650874657 -0.200919603 -0.264514123 [61] 0.028020668 0.422306692 0.290878017 1.015855544 0.672445137 [66] -1.850137486 0.897145773 0.206085324 -0.277233027 -2.151151546 [71] 0.647007329 0.138251170 -1.345620961 0.163688977 0.117052996 [76] -1.154837402 1.265993989 -0.336587912 -0.468016587 0.710601848 [81] 0.630048790 0.413827422 0.401108518 -1.477049636 0.451984134 [86] 1.550049511 2.058805670 -0.887740418 0.935302485 2.067284939 [91] -0.582486723 -1.019169092 1.282952527 0.630048790 0.108573727 [96] -0.557048915 -1.447372193 1.329588509 -0.985252015 -0.557048915 > > # 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.query(bird.families,comm,TRUE,null.model="sequential", + abundance.weights=weights, reps=1000) [1] -0.6214065619 0.4597862556 0.6174602081 0.3426570337 -0.5177922502 [6] -0.1123449437 -0.6529413524 -0.7475457239 1.2796908088 -0.0402654225 [11] -1.3962614144 -0.0087306320 -1.9098280027 0.3156272132 -0.6754662028 [16] -0.6844761429 -0.8601699758 0.3967166745 0.5769154775 -0.3240785371 [21] 0.0273091286 -2.9279512391 1.0364224249 -0.1078399736 0.5949353577 [26] 0.9057782928 -0.4547226692 1.9959810504 -2.0990367458 1.9599412898 [31] -0.1303648240 -0.9007147064 -2.0134423144 0.6084502680 -0.3105636269 [36] -0.1303648240 0.9778578139 -2.2657206385 0.5048359563 -0.0537803327 [41] -0.2519990159 0.6760248191 -0.4997723699 -0.8826948261 -0.3375934473 [46] -2.1801262071 -1.3647266239 0.0318140987 -1.1124482998 -1.3331918334 [51] 0.9598379336 -1.4007663845 0.5048359563 1.6986530256 -0.2114542853 [56] -0.3420984174 0.1489433205 -1.8782932122 -0.3375934473 -0.4051679984 [61] -0.0943250634 0.3246371534 0.1849830811 0.9553329636 0.5904303877 [66] -2.0900268056 0.8291938015 0.0948836797 -0.4186829086 -2.4098796808 [71] 0.5634005672 0.0228041585 -1.5539353670 0.0498339789 0.0002793081 [76] -1.3512117137 1.2211261979 -0.4817524896 -0.6214065619 0.6309751183 [81] 0.5453806869 0.3156272132 0.3021123030 -1.6935894392 0.3561719439 [86] 1.5229591927 2.0635556015 -1.0673985991 0.8697385322 2.0725655416 [91] -0.7430407539 -1.2070526714 1.2391460782 0.5453806869 -0.0087306320 [96] -0.7160109334 -1.6620546487 1.2887007490 -1.1710129108 -0.7160109334 > > > > > cleanEx() > nameEx("cac.moments") > ### * cac.moments > > flush(stderr()); flush(stdout()) > > ### Name: cac.moments > ### Title: Computes the statistical moments of the Core Ancestor Cost > ### measure > ### Aliases: cac.moments > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > # Calculate first four raw moments under the uniform model > cac.moments(bird.families,0.75,1:100,k=4) [,1] [,2] [,3] [,4] [1,] 28.000000 0.0000000 0.0000000000 0.0000000 [2,] 4.922671 17.4958300 86.4318640603 1345.1334078 [3,] 3.287615 8.4753525 26.8145279255 404.3689659 [4,] 5.522785 9.6585328 38.4933240146 580.6604115 [5,] 4.481193 5.9940757 10.8022266495 231.6064183 [6,] 3.847867 4.8027689 2.0077503201 97.7444715 [7,] 3.372381 4.3171549 0.3515315856 52.9406359 [8,] 4.544204 3.4525238 -0.0468445006 60.9429892 [9,] 4.144528 3.2829382 -1.3434645119 35.8178270 [10,] 3.796442 3.1955407 -1.2015414384 27.5829547 [11,] 3.485927 3.0980594 -0.7597289926 24.5888459 [12,] 4.322764 2.5205736 -1.2883745819 17.5446075 [13,] 4.044579 2.5024402 -0.9110520168 16.3565711 [14,] 3.787997 2.4503004 -0.5636389032 16.0987607 [15,] 3.552009 2.3740287 -0.3309690016 15.9257944 [16,] 4.201884 2.0741412 -0.5007399413 10.3530690 [17,] 3.981654 2.0287195 -0.1971049895 10.5283358 [18,] 3.776673 1.9605808 0.0006847293 10.6847838 [19,] 3.586724 1.8807316 0.0919499149 10.7377542 [20,] 4.113662 1.7575827 0.0271964222 7.1151663 [21,] 3.930828 1.6932910 0.2306487872 7.2372215 [22,] 3.760297 1.6159716 0.3474719282 7.3293925 [23,] 3.601867 1.5332746 0.3829615974 7.3661438 [24,] 4.042531 1.5195875 0.3189355578 5.1415896 [25,] 3.886144 1.4472645 0.4638171115 5.1746337 [26,] 3.740166 1.3667652 0.5415221938 5.1947934 [27,] 3.604428 1.2835478 0.5567154792 5.1870559 [28,] 3.982188 1.3371410 0.4722355697 3.8792436 [29,] 3.845335 1.2625510 0.5818092601 3.8592943 [30,] 3.717544 1.1822004 0.6383516096 3.8327245 [31,] 3.598706 1.1002245 0.6456145305 3.7889299 [32,] 3.929278 1.1944552 0.5473802583 3.0537316 [33,] 3.807290 1.1203963 0.6332605253 3.0076921 [34,] 3.693366 1.0418894 0.6760384059 2.9555678 [35,] 3.587456 0.9622431 0.6788944945 2.8894372 [36,] 3.881770 1.0802299 0.5787885421 2.4995784 [37,] 3.771371 1.0079728 0.6469921017 2.4426230 [38,] 3.668278 0.9320944 0.6791809564 2.3780917 [39,] 3.572493 0.8553578 0.6782547636 2.3001632 [40,] 3.838337 0.9864159 0.5856632092 2.1145353 [41,] 3.737168 0.9164773 0.6396033123 2.0535759 [42,] 3.642718 0.8435360 0.6628260652 1.9833029 [43,] 3.555026 0.7699691 0.6581170367 1.8997607 [44,] 3.798072 0.9073176 0.5783731866 1.8352201 [45,] 3.704397 0.8398748 0.6202631443 1.7724200 [46,] 3.616978 0.7699603 0.6356485127 1.6990906 [47,] 3.535880 0.6996552 0.6272687503 1.6129490 [48,] 3.760339 0.8389230 0.5623038874 1.6222252 [49,] 3.672860 0.7740315 0.5938127763 1.5576048 [50,] 3.591262 0.7071587 0.6023763290 1.4820398 [51,] 3.515629 0.6401399 0.5906906647 1.3946740 [52,] 3.724692 0.7784154 0.5402028150 1.4508379 [53,] 3.642423 0.7161123 0.5627670204 1.3838997 [54,] 3.565725 0.6522896 0.5655277080 1.3064410 [55,] 3.494689 0.5885666 0.5511020188 1.2187297 [56,] 3.690819 0.7238266 0.5135725361 1.3053616 [57,] 3.613002 0.6641667 0.5285472496 1.2359249 [58,] 3.540490 0.6034160 0.5265522175 1.1571435 [59,] 3.473374 0.5429977 0.5100711257 1.0700763 [60,] 3.658506 0.6737977 0.4834406872 1.1757772 [61,] 3.584549 0.6168528 0.4921697736 1.1042781 [62,] 3.515661 0.5592019 0.4864895908 1.0251954 [63,] 3.451932 0.5020878 0.4686914450 0.9400484 [64,] 3.627599 0.6274164 0.4507304191 1.0558634 [65,] 3.557032 0.5732587 0.4545655417 0.9833463 [66,] 3.491320 0.5187211 0.4462746508 0.9053793 [67,] 3.430550 0.4648831 0.4279039096 0.8236392 [68,] 3.597982 0.5841044 0.4163948411 0.9421311 [69,] 3.530421 0.5327852 0.4166775747 0.8701000 [70,] 3.467519 0.4813402 0.4068201854 0.7948927 [71,] 3.409359 0.4307040 0.3885844815 0.7180854 [72,] 3.569548 0.5435312 0.3814329614 0.8331329 [73,] 3.504670 0.4950624 0.3794508219 0.7633584 [74,] 3.444269 0.4466394 0.3689934289 0.6925957 [75,] 3.388429 0.3990733 0.3515170543 0.6221167 [76,] 3.542189 0.5055402 0.3468608038 0.7289055 [77,] 3.479705 0.4598797 0.3437891529 0.6632314 [78,] 3.421534 0.4143487 0.3335657104 0.5984725 [79,] 3.367761 0.3696589 0.3173401542 0.5354521 [80,] 3.515778 0.4700798 0.3136724227 0.6304641 [81,] 3.455419 0.4271198 0.3105132063 0.5706262 [82,] 3.399226 0.3842859 0.3011707979 0.5131623 [83,] 3.347293 0.3422172 0.2865078886 0.4583641 [84,] 3.490166 0.4371382 0.2827996958 0.5393509 [85,] 3.431668 0.3966954 0.2803243282 0.4868124 [86,] 3.377209 0.3562943 0.2722751719 0.4375473 [87,] 3.326901 0.3165330 0.2592680759 0.3912916 [88,] 3.465171 0.4066843 0.2550686856 0.4572556 [89,] 3.408263 0.3684883 0.2537685940 0.4130593 [90,] 3.355296 0.3301829 0.2471516512 0.3724064 [91,] 3.306406 0.2923595 0.2356475832 0.3345111 [92,] 3.440569 0.3786145 0.2311456313 0.3857102 [93,] 3.384969 0.3422975 0.2311908635 0.3503490 [94,] 3.333249 0.3056734 0.2258441672 0.3181461 [95,] 3.285579 0.2693670 0.2154312958 0.2878842 [96,] 3.416072 0.3527065 0.2114657443 0.3258477 [97,] 3.361487 0.3177940 0.2126702626 0.2991570 [98,] 3.310771 0.2823605 0.2081138894 0.2746051 [99,] 3.264137 0.2471083 0.1981239884 0.2506893 [100,] 3.391309 0.3285723 0.1961438539 0.2781901 > > # 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 > cac.moments(bird.families,0.75,1:100,k=2, + null.model="sequential", abundance.weights=weights, reps=1000) [,1] [,2] [1,] 28.0000 0.0000000 [2,] 4.8006 4.1877938 [3,] 3.2405 2.9145814 [4,] 5.5026 3.1427902 [5,] 4.4467 2.4116312 [6,] 3.7894 2.1642254 [7,] 3.2865 1.9798959 [8,] 4.5461 1.7585384 [9,] 4.1183 1.7799279 [10,] 3.7562 1.7651735 [11,] 3.4166 1.7230128 [12,] 4.3064 1.5772212 [13,] 4.0023 1.5672208 [14,] 3.7412 1.5297394 [15,] 3.5069 1.5028776 [16,] 4.1670 1.3919657 [17,] 3.9613 1.3566771 [18,] 3.7446 1.3306169 [19,] 3.5346 1.2822586 [20,] 4.0399 1.2477078 [21,] 3.8396 1.2307016 [22,] 3.6973 1.1913950 [23,] 3.5559 1.1608414 [24,] 3.9702 1.1743982 [25,] 3.8303 1.1358795 [26,] 3.6926 1.1150913 [27,] 3.5636 1.0757008 [28,] 3.9383 1.0663490 [29,] 3.7889 1.0319359 [30,] 3.6432 1.0077049 [31,] 3.5205 0.9769873 [32,] 3.8454 1.0276940 [33,] 3.7090 0.9903837 [34,] 3.6065 0.9612865 [35,] 3.4774 0.9122946 [36,] 3.7573 0.9557511 [37,] 3.6495 0.9210907 [38,] 3.5601 0.8801549 [39,] 3.4554 0.8361639 [40,] 3.7121 0.9294232 [41,] 3.6049 0.8900102 [42,] 3.5205 0.8588407 [43,] 3.4370 0.8219773 [44,] 3.6661 0.9015729 [45,] 3.5701 0.8475342 [46,] 3.5058 0.8186676 [47,] 3.4275 0.7899226 [48,] 3.6384 0.8458492 [49,] 3.5793 0.8218984 [50,] 3.5068 0.7906826 [51,] 3.4353 0.7523762 [52,] 3.6366 0.8153068 [53,] 3.5512 0.7752674 [54,] 3.4734 0.7453106 [55,] 3.3959 0.7045208 [56,] 3.5966 0.7824581 [57,] 3.5264 0.7437178 [58,] 3.4585 0.7101211 [59,] 3.3864 0.6591126 [60,] 3.5680 0.7459306 [61,] 3.4923 0.7053284 [62,] 3.4273 0.6677354 [63,] 3.3693 0.6282374 [64,] 3.5271 0.7097460 [65,] 3.4578 0.6606176 [66,] 3.3901 0.6245655 [67,] 3.3444 0.5898785 [68,] 3.4974 0.6689250 [69,] 3.4241 0.6255562 [70,] 3.3690 0.5921061 [71,] 3.3151 0.5443697 [72,] 3.4736 0.6384283 [73,] 3.4139 0.6047996 [74,] 3.3490 0.5692654 [75,] 3.3020 0.5419499 [76,] 3.4439 0.6231943 [77,] 3.3839 0.5846303 [78,] 3.3285 0.5573584 [79,] 3.2718 0.5112594 [80,] 3.4159 0.5969032 [81,] 3.3576 0.5663418 [82,] 3.3074 0.5327561 [83,] 3.2546 0.4889764 [84,] 3.3873 0.5670364 [85,] 3.3342 0.5380705 [86,] 3.2864 0.5100149 [87,] 3.2459 0.4745402 [88,] 3.3750 0.5653624 [89,] 3.3222 0.5324384 [90,] 3.2749 0.4963127 [91,] 3.2280 0.4605520 [92,] 3.3467 0.5385342 [93,] 3.2974 0.5041700 [94,] 3.2521 0.4693995 [95,] 3.1976 0.4256235 [96,] 3.3210 0.5097635 [97,] 3.2628 0.4739206 [98,] 3.2191 0.4400214 [99,] 3.1716 0.3961444 [100,] 3.3050 0.4911784 > > > > cleanEx() > nameEx("cac.pvalues") > ### * cac.pvalues > > flush(stderr()); flush(stdout()) > > ### Name: cac.pvalues > ### Title: Computes the p-values of the Core Ancestor Cost measure > ### Aliases: cac.pvalues > > ### ** Examples > > #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 > > chi=0.6 > > #Calculate p-values under the uniform model > cac.pvalues(bird.families,comm,chi, reps=1000) [1] 0.9520480 0.4515485 0.9520480 0.9520480 0.9520480 0.4515485 0.9520480 [8] 0.4515485 0.9520480 0.9520480 0.4515485 0.4515485 0.4515485 0.9520480 [15] 0.4515485 0.4515485 0.9520480 0.9520480 0.9520480 0.9520480 0.9520480 [22] 0.4515485 0.9520480 0.4515485 0.4515485 0.4515485 0.4515485 0.9520480 [29] 0.4515485 0.9520480 0.9520480 0.4515485 0.4515485 0.9990010 0.9520480 [36] 0.4515485 0.9520480 0.4515485 0.4515485 0.9520480 0.4515485 0.9520480 [43] 0.9520480 0.4515485 0.9520480 0.4515485 0.4515485 0.9990010 0.4515485 [50] 0.4515485 0.9520480 0.4515485 0.9520480 0.9520480 0.4515485 0.9520480 [57] 0.9520480 0.4515485 0.4515485 0.4515485 0.4515485 0.9520480 0.4515485 [64] 0.4515485 0.9520480 0.4515485 0.9520480 0.4515485 0.4515485 0.4515485 [71] 0.9520480 0.9520480 0.4515485 0.4515485 0.4515485 0.9520480 0.9520480 [78] 0.4515485 0.4515485 0.4515485 0.9520480 0.9520480 0.9520480 0.4515485 [85] 0.9520480 0.9520480 0.9990010 0.4515485 0.4515485 1.0000000 0.4515485 [92] 0.9520480 0.9520480 0.4515485 0.4515485 0.4515485 0.4515485 0.9520480 [99] 0.4515485 0.9520480 > > # Create random abundance weights > weights = runif(length(bird.families$tip.label)) > names(weights) = bird.families$tip.label > > # Calculate p-values under the sequential model > cac.pvalues(bird.families,comm,chi,null.model="sequential", + abundance.weights=weights, reps=1000) [1] 0.9660340 0.5644356 0.9660340 0.9660340 0.9660340 0.5644356 0.9660340 [8] 0.5644356 0.9660340 0.9660340 0.5644356 0.5644356 0.5644356 0.9660340 [15] 0.5644356 0.5644356 0.9660340 0.9660340 0.9660340 0.9660340 0.9660340 [22] 0.5644356 0.9660340 0.5644356 0.5644356 0.5644356 0.5644356 0.9660340 [29] 0.5644356 0.9660340 0.9660340 0.5644356 0.5644356 1.0000000 0.9660340 [36] 0.5644356 0.9660340 0.5644356 0.5644356 0.9660340 0.5644356 0.9660340 [43] 0.9660340 0.5644356 0.9660340 0.5644356 0.5644356 1.0000000 0.5644356 [50] 0.5644356 0.9660340 0.5644356 0.9660340 0.9660340 0.5644356 0.9660340 [57] 0.9660340 0.5644356 0.5644356 0.5644356 0.5644356 0.9660340 0.5644356 [64] 0.5644356 0.9660340 0.5644356 0.9660340 0.5644356 0.5644356 0.5644356 [71] 0.9660340 0.9660340 0.5644356 0.5644356 0.5644356 0.9660340 0.9660340 [78] 0.5644356 0.5644356 0.5644356 0.9660340 0.9660340 0.9660340 0.5644356 [85] 0.9660340 0.9660340 1.0000000 0.5644356 0.5644356 1.0000000 0.5644356 [92] 0.9660340 0.9660340 0.5644356 0.5644356 0.5644356 0.5644356 0.9660340 [99] 0.5644356 0.9660340 > > > > cleanEx() > nameEx("cac.query") > ### * cac.query > > flush(stderr()); flush(stdout()) > > ### Name: cac.query > ### Title: Computes the (standardized) value of the Core Ancestor Cost > ### measure > ### Aliases: cac.query > > ### ** Examples > > #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 cac values for each community > cac.query(bird.families,comm,0.8) [1] 3.0 3.0 3.5 3.0 3.0 3.0 3.0 3.0 4.3 0.0 5.5 3.0 3.0 3.0 3.0 3.0 3.0 3.0 [19] 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.5 3.0 3.0 4.3 3.0 3.0 3.0 5.5 3.0 3.0 3.0 [37] 3.0 3.0 4.3 3.0 3.0 3.0 3.0 3.0 3.0 4.3 4.3 3.0 3.0 4.3 3.0 3.0 3.0 3.0 [55] 3.0 3.0 3.0 3.5 3.0 3.0 3.0 3.0 3.0 3.0 3.0 4.3 3.0 3.0 3.0 3.0 3.0 3.0 [73] 4.3 3.0 3.0 3.0 3.0 3.0 4.3 3.0 3.0 3.0 1.7 3.0 3.0 3.0 3.0 3.0 3.0 3.0 [91] 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 1.7 > > #Calculate standardized versions under the uniform model > cac.query(bird.families,comm,0.8,TRUE) [1] -0.1803238 -0.1803238 0.6336205 -0.1803238 -0.1803238 -0.1803238 [7] -0.1803238 -0.1803238 1.9359313 -5.0639891 3.8893974 -0.1803238 [13] -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [19] -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [25] -0.1803238 0.6336205 -0.1803238 -0.1803238 1.9359313 -0.1803238 [31] -0.1803238 -0.1803238 3.8893974 -0.1803238 -0.1803238 -0.1803238 [37] -0.1803238 -0.1803238 1.9359313 -0.1803238 -0.1803238 -0.1803238 [43] -0.1803238 -0.1803238 -0.1803238 1.9359313 1.9359313 -0.1803238 [49] -0.1803238 1.9359313 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [55] -0.1803238 -0.1803238 -0.1803238 0.6336205 -0.1803238 -0.1803238 [61] -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 1.9359313 [67] -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [73] 1.9359313 -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [79] 1.9359313 -0.1803238 -0.1803238 -0.1803238 -2.2965788 -0.1803238 [85] -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [91] -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 -0.1803238 [97] -0.1803238 -0.1803238 -0.1803238 -2.2965788 > > # 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 > cac.query(bird.families,comm,0.8,TRUE,null.model="sequential", + abundance.weights=weights, reps=1000) [1] -0.1139638 -0.1139638 0.6571039 -0.1139638 -0.1139638 -0.1139638 [7] -0.1139638 -0.1139638 1.8908123 -4.7403703 3.7413749 -0.1139638 [13] -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [19] -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [25] -0.1139638 0.6571039 -0.1139638 -0.1139638 1.8908123 -0.1139638 [31] -0.1139638 -0.1139638 3.7413749 -0.1139638 -0.1139638 -0.1139638 [37] -0.1139638 -0.1139638 1.8908123 -0.1139638 -0.1139638 -0.1139638 [43] -0.1139638 -0.1139638 -0.1139638 1.8908123 1.8908123 -0.1139638 [49] -0.1139638 1.8908123 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [55] -0.1139638 -0.1139638 -0.1139638 0.6571039 -0.1139638 -0.1139638 [61] -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 1.8908123 [67] -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [73] 1.8908123 -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [79] 1.8908123 -0.1139638 -0.1139638 -0.1139638 -2.1187400 -0.1139638 [85] -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [91] -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 -0.1139638 [97] -0.1139638 -0.1139638 -0.1139638 -2.1187400 > > > > cleanEx() > nameEx("cbl.moments") > ### * cbl.moments > > flush(stderr()); flush(stdout()) > > ### Name: cbl.moments > ### Title: Computes the moments of the Common Branch Length measure under > ### the uniform null model > ### Aliases: cbl.moments > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > cbl.moments(bird.families,sample.sizes = expand.grid(1:10,1:10)) [,1] [,2] [1,] 0.000000 0.000000 [2,] 0.000000 0.000000 [3,] 0.000000 0.000000 [4,] 0.000000 0.000000 [5,] 0.000000 0.000000 [6,] 0.000000 0.000000 [7,] 0.000000 0.000000 [8,] 0.000000 0.000000 [9,] 0.000000 0.000000 [10,] 0.000000 0.000000 [11,] 0.000000 0.000000 [12,] 4.130227 5.557448 [13,] 6.195341 6.606510 [14,] 7.704827 7.278577 [15,] 8.936498 7.784479 [16,] 9.989536 8.191809 [17,] 10.913530 8.533675 [18,] 11.739142 8.829186 [19,] 12.487568 9.090225 [20,] 13.174268 9.324547 [21,] 0.000000 0.000000 [22,] 6.195341 6.606510 [23,] 9.293012 7.688801 [24,] 11.557240 8.397083 [25,] 13.404747 8.940711 [26,] 14.984304 9.384492 [27,] 16.370295 9.761881 [28,] 17.608712 10.092638 [29,] 18.731352 10.388893 [30,] 19.761402 10.658324 [31,] 0.000000 0.000000 [32,] 7.704827 7.278577 [33,] 11.557240 8.397083 [34,] 14.398765 9.170498 [35,] 16.734847 9.784710 [36,] 18.744567 10.296233 [37,] 20.517466 10.737063 [38,] 22.109045 11.127168 [39,] 23.557781 11.479102 [40,] 24.891814 11.800883 [41,] 0.000000 0.000000 [42,] 8.936498 7.784479 [43,] 13.404747 8.940711 [44,] 16.734847 9.784710 [45,] 19.495871 10.474473 [46,] 21.887577 11.057789 [47,] 24.009842 11.565017 [48,] 25.924759 12.016317 [49,] 27.675533 12.424765 [50,] 29.293866 12.798891 [51,] 0.000000 0.000000 [52,] 9.989536 8.191809 [53,] 14.984304 9.384492 [54,] 18.744567 10.296233 [55,] 21.887577 11.057789 [56,] 24.627971 11.709064 [57,] 27.073066 12.278943 [58,] 29.289784 12.787754 [59,] 31.324845 13.249083 [60,] 33.212652 13.671974 [61,] 0.000000 0.000000 [62,] 10.913530 8.533675 [63,] 16.370295 9.761881 [64,] 20.517466 10.737063 [65,] 24.009842 11.565017 [66,] 27.073066 12.278943 [67,] 29.819964 12.906506 [68,] 32.321083 13.468215 [69,] 34.625837 13.978121 [70,] 36.770719 14.445752 [71,] 0.000000 0.000000 [72,] 11.739142 8.829186 [73,] 17.608712 10.092638 [74,] 22.109045 11.127168 [75,] 25.924759 12.016317 [76,] 29.289784 12.787754 [77,] 32.321083 13.468215 [78,] 35.091980 14.078406 [79,] 37.653977 14.632813 [80,] 40.045218 15.141416 [81,] 0.000000 0.000000 [82,] 12.487568 9.090225 [83,] 18.731352 10.388893 [84,] 23.557781 11.479102 [85,] 27.675533 12.424765 [86,] 31.324845 13.249083 [87,] 34.625837 13.978121 [88,] 37.653977 14.632813 [89,] 40.462412 15.228062 [90,] 43.090599 15.774263 [91,] 0.000000 0.000000 [92,] 13.174268 9.324547 [93,] 19.761402 10.658324 [94,] 24.891814 11.800883 [95,] 29.293866 12.798891 [96,] 33.212652 13.671974 [97,] 36.770719 14.445752 [98,] 40.045218 15.141416 [99,] 43.090599 15.774263 [100,] 45.947381 16.355082 > > > > cleanEx() > nameEx("cbl.query") > ### * cbl.query > > flush(stderr()); flush(stdout()) > > ### Name: cbl.query > ### Title: Computes the (standardized) value of the Common Branch Length > ### measure > ### Aliases: cbl.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise CBL values for communities in comm > cbl.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 827.0 437.0 419.4 357.3 349.9 417.4 379.7 396.1 406.1 355.3 [2,] 437.0 851.0 388.9 376.7 328.5 394.8 434.2 421.6 427.2 438.2 [3,] 419.4 388.9 854.5 419.1 416.7 395.9 378.6 383.1 424.4 378.5 [4,] 357.3 376.7 419.1 848.4 469.3 400.2 352.7 419.8 396.6 354.3 [5,] 349.9 328.5 416.7 469.3 829.3 453.0 374.7 404.1 399.0 392.9 [6,] 417.4 394.8 395.9 400.2 453.0 838.3 379.3 339.0 336.0 376.5 [7,] 379.7 434.2 378.6 352.7 374.7 379.3 826.3 372.3 512.8 329.3 [8,] 396.1 421.6 383.1 419.8 404.1 339.0 372.3 824.2 344.9 355.2 [9,] 406.1 427.2 424.4 396.6 399.0 336.0 512.8 344.9 869.2 416.5 [10,] 355.3 438.2 378.5 354.3 392.9 376.5 329.3 355.2 416.5 839.9 > > #Calculate pairwise CBL values from > #the first two rows of comm to all rows > cbl.query(bird.families, comm[1:2,],comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 827 437 419.4 357.3 349.9 417.4 379.7 396.1 406.1 355.3 [2,] 437 851 388.9 376.7 328.5 394.8 434.2 421.6 427.2 438.2 > > #Calculate the CBL from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > cbl.query(bird.families,comm,query.matrix = qm) [1] 827.0 437.0 437.0 851.0 419.4 388.9 357.3 376.7 349.9 328.5 417.4 394.8 [13] 379.7 434.2 396.1 421.6 406.1 427.2 355.3 438.2 > > #Calculate standardized versions > cbl.query(bird.families,comm, standardize = TRUE) [,1] [,2] [,3] [,4] [,5] [,6] [1,] 10.27460680 1.06054432 0.64473021 -0.8224320 -0.99726297 0.59747861 [2,] 1.06054432 10.84162603 -0.07585672 -0.3640915 -1.50285512 0.06353550 [3,] 0.64473021 -0.07585672 10.92431633 0.6376425 0.58094055 0.08952389 [4,] -0.82243204 -0.36409150 0.63764247 10.7801989 1.82365770 0.19111483 [5,] -0.99726297 -1.50285512 0.58094055 1.8236577 10.32894614 1.43855714 [6,] 0.59747861 0.06353550 0.08952389 0.1911148 1.43855714 10.54157835 [7,] -0.29321409 0.99439207 -0.31920248 -0.9311107 -0.41134310 -0.30266441 [8,] 0.09424905 0.69670698 -0.21288637 0.6541805 0.28325546 -1.25478420 [9,] 0.33050706 0.82901146 0.76285922 0.1060619 0.16276387 -1.32566161 [10,] -0.86968364 1.08889528 -0.32156506 -0.8933094 0.01864648 -0.36881666 [,7] [,8] [,9] [,10] [1,] -0.2932141 0.09424905 0.3305071 -0.86968364 [2,] 0.9943921 0.69670698 0.8290115 1.08889528 [3,] -0.3192025 -0.21288637 0.7628592 -0.32156506 [4,] -0.9311107 0.65418054 0.1060619 -0.89330945 [5,] -0.4113431 0.28325546 0.1627639 0.01864648 [6,] -0.3026644 -1.25478420 -1.3256616 -0.36881666 [7,] 10.2580687 -0.46804502 2.8513801 -1.48395448 [8,] -0.4680450 10.20845455 -1.1153920 -0.87204622 [9,] 2.8513801 -1.11539198 11.2716156 0.57621539 [10,] -1.4839545 -0.87204622 0.5762154 10.57937963 > > > > cleanEx() > nameEx("cd.moments") > ### * cd.moments > > flush(stderr()); flush(stdout()) > > ### Name: cd.moments > ### Title: Computes the moments of the Community Distance measure under the > ### uniform null model > ### Aliases: cd.moments > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > cd.moments(bird.families,sample.sizes = expand.grid(1:10,1:10)) [,1] [,2] [1,] 45.81776 9.214569 [2,] 45.81776 7.185166 [3,] 45.81776 6.366532 [4,] 45.81776 5.914878 [5,] 45.81776 5.626510 [6,] 45.81776 5.425757 [7,] 45.81776 5.277689 [8,] 45.81776 5.163852 [9,] 45.81776 5.073547 [10,] 45.81776 5.000128 [11,] 45.81776 7.185166 [12,] 45.81776 5.507355 [13,] 45.81776 4.820000 [14,] 45.81776 4.436567 [15,] 45.81776 4.189696 [16,] 45.81776 4.016696 [17,] 45.81776 3.888414 [18,] 45.81776 3.789354 [19,] 45.81776 3.710480 [20,] 45.81776 3.646152 [21,] 45.81776 6.366532 [22,] 45.81776 4.820000 [23,] 45.81776 4.179189 [24,] 45.81776 3.818669 [25,] 45.81776 3.584997 [26,] 45.81776 3.420358 [27,] 45.81776 3.297730 [28,] 45.81776 3.202679 [29,] 45.81776 3.126754 [30,] 45.81776 3.064659 [31,] 45.81776 5.914878 [32,] 45.81776 4.436567 [33,] 45.81776 3.818669 [34,] 45.81776 3.468687 [35,] 45.81776 3.240606 [36,] 45.81776 3.079180 [37,] 45.81776 2.958488 [38,] 45.81776 2.864634 [39,] 45.81776 2.789454 [40,] 45.81776 2.727818 [41,] 45.81776 5.626510 [42,] 45.81776 4.189696 [43,] 45.81776 3.584997 [44,] 45.81776 3.240606 [45,] 45.81776 3.015148 [46,] 45.81776 2.854969 [47,] 45.81776 2.734817 [48,] 45.81776 2.641119 [49,] 45.81776 2.565878 [50,] 45.81776 2.504058 [51,] 45.81776 5.425757 [52,] 45.81776 4.016696 [53,] 45.81776 3.420358 [54,] 45.81776 3.079180 [55,] 45.81776 2.854969 [56,] 45.81776 2.695153 [57,] 45.81776 2.574933 [58,] 45.81776 2.480947 [59,] 45.81776 2.405310 [60,] 45.81776 2.343043 [61,] 45.81776 5.277689 [62,] 45.81776 3.888414 [63,] 45.81776 3.297730 [64,] 45.81776 2.958488 [65,] 45.81776 2.734817 [66,] 45.81776 2.574933 [67,] 45.81776 2.454361 [68,] 45.81776 2.359892 [69,] 45.81776 2.283717 [70,] 45.81776 2.220896 [71,] 45.81776 5.163852 [72,] 45.81776 3.789354 [73,] 45.81776 3.202679 [74,] 45.81776 2.864634 [75,] 45.81776 2.641119 [76,] 45.81776 2.480947 [77,] 45.81776 2.359892 [78,] 45.81776 2.264859 [79,] 45.81776 2.188092 [80,] 45.81776 2.124683 [81,] 45.81776 5.073547 [82,] 45.81776 3.710480 [83,] 45.81776 3.126754 [84,] 45.81776 2.789454 [85,] 45.81776 2.565878 [86,] 45.81776 2.405310 [87,] 45.81776 2.283717 [88,] 45.81776 2.188092 [89,] 45.81776 2.110725 [90,] 45.81776 2.046726 [91,] 45.81776 5.000128 [92,] 45.81776 3.646152 [93,] 45.81776 3.064659 [94,] 45.81776 2.727818 [95,] 45.81776 2.504058 [96,] 45.81776 2.343043 [97,] 45.81776 2.220896 [98,] 45.81776 2.124683 [99,] 45.81776 2.046726 [100,] 45.81776 1.982154 > > > > cleanEx() > nameEx("cd.query") > ### * cd.query > > flush(stderr()); flush(stdout()) > > ### Name: cd.query > ### Title: Computes the (standardized) value of the Community Distance > ### measure > ### Aliases: cd.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise CD values for communities in comm > cd.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 44.46048 45.07616 45.11368 46.29640 45.08168 45.27776 45.75800 44.96568 [2,] 45.07616 44.71824 45.21208 46.19904 45.16232 45.33712 45.60488 44.90240 [3,] 45.11368 45.21208 44.62960 46.20512 45.08480 45.32008 45.63248 45.00040 [4,] 46.29640 46.19904 46.20512 46.54560 46.10352 46.30512 46.48968 45.96088 [5,] 45.08168 45.16232 45.08480 46.10352 44.60720 45.24088 45.58944 44.87432 [6,] 45.27776 45.33712 45.32008 46.30512 45.24088 45.00144 45.71888 45.18568 [7,] 45.75800 45.60488 45.63248 46.48968 45.58944 45.71888 45.43168 45.45720 [8,] 44.96568 44.90240 45.00040 45.96088 44.87432 45.18568 45.45720 44.24096 [9,] 45.95456 45.86752 45.76192 46.68608 45.82744 46.02608 45.97760 45.77016 [10,] 46.27832 46.30616 46.38768 47.24488 46.37752 46.42816 46.83576 46.28144 [,9] [,10] [1,] 45.95456 46.27832 [2,] 45.86752 46.30616 [3,] 45.76192 46.38768 [4,] 46.68608 47.24488 [5,] 45.82744 46.37752 [6,] 46.02608 46.42816 [7,] 45.97760 46.83576 [8,] 45.77016 46.28144 [9,] 45.79520 46.88328 [10,] 46.88328 46.59968 > > #Calculate pairwise distances from > #the first two rows of comm to all rows > cd.query(bird.families, comm[1:2,],comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 44.46048 45.07616 45.11368 46.29640 45.08168 45.27776 45.75800 44.96568 [2,] 45.07616 44.71824 45.21208 46.19904 45.16232 45.33712 45.60488 44.90240 [,9] [,10] [1,] 45.95456 46.27832 [2,] 45.86752 46.30616 > > #Calculate the distances from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > cd.query(bird.families,comm,query.matrix = qm) [1] 44.46048 45.07616 45.07616 44.71824 45.11368 45.21208 46.29640 46.19904 [9] 45.08168 45.16232 45.27776 45.33712 45.75800 45.60488 44.96568 44.90240 [17] 45.95456 45.86752 46.27832 46.30616 > > #Calculate standardized versions > cd.query(bird.families,comm,standardize = TRUE) [,1] [,2] [,3] [,4] [,5] [,6] [1,] -1.93980551 -1.05988647 -1.00626354 0.6840591 -1.05199738 -0.7717633 [2,] -1.05988647 -1.57141945 -0.86563199 0.5449139 -0.93674811 -0.6869270 [3,] -1.00626354 -0.86563199 -1.69810218 0.5536033 -1.04753833 -0.7112803 [4,] 0.68405912 0.54491392 0.55360335 1.0402114 0.40839841 0.6965216 [5,] -1.05199738 -0.93674811 -1.04753833 0.4083984 -1.73011587 -0.8244715 [6,] -0.77176328 -0.68692701 -0.71128028 0.6965216 -0.82447153 -1.1666750 [7,] -0.08541271 -0.30424912 -0.26480369 0.9602915 -0.32631570 -0.1413223 [8,] -1.21778254 -1.30822121 -1.16816133 0.2045398 -1.34835265 -0.9033624 [9,] 0.19550739 0.07111135 -0.07981031 1.2409829 0.01382972 0.2977225 [10,] 0.65821950 0.69800794 0.81451490 2.0396101 0.79999440 0.8723682 [,7] [,8] [,9] [,10] [1,] -0.08541271 -1.21778254 0.19550739 0.6582195 [2,] -0.30424912 -1.30822121 0.07111135 0.6980079 [3,] -0.26480369 -1.16816133 -0.07981031 0.8145149 [4,] 0.96029151 0.20453983 1.24098294 2.0396101 [5,] -0.32631570 -1.34835265 0.01382972 0.7999944 [6,] -0.14132232 -0.90336240 0.29772252 0.8723682 [7,] -0.55178352 -0.51531079 0.22843576 1.4549030 [8,] -0.51531079 -2.25353964 -0.06803385 0.6626786 [9,] 0.22843576 -0.06803385 -0.03224712 1.5228177 [10,] 1.45490297 0.66267855 1.52281772 1.1175016 > > > > cleanEx() > nameEx("cdnt.averaged.query") > ### * cdnt.averaged.query > > flush(stderr()); flush(stdout()) > > ### Name: cdnt.averaged.query > ### Title: Computes the value of the averaged Community Distance Nearest > ### Taxon measure > ### Aliases: cdnt.averaged.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise aCDNT values for communities in comm > cdnt.averaged.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 16.306 17.544 19.852 19.708 17.050 18.762 17.580 18.380 20.112 [2,] 16.306 0.000 19.044 19.276 21.004 18.648 16.654 16.938 17.662 16.820 [3,] 17.544 19.044 0.000 17.918 17.340 18.694 19.168 18.790 17.770 19.740 [4,] 19.852 19.276 17.918 0.000 15.320 18.402 19.844 17.070 18.980 20.358 [5,] 19.708 21.004 17.340 15.320 0.000 15.856 18.522 17.152 18.748 18.460 [6,] 17.050 18.648 18.694 18.402 15.856 0.000 18.464 20.500 21.444 19.180 [7,] 18.762 16.654 19.168 19.844 18.522 18.464 0.000 18.838 13.638 21.348 [8,] 17.580 16.938 18.790 17.070 17.152 20.500 18.838 0.000 20.912 20.230 [9,] 18.380 17.662 17.770 18.980 18.748 21.444 13.638 20.912 0.000 17.786 [10,] 20.112 16.820 19.740 20.358 18.460 19.180 21.348 20.230 17.786 0.000 > > #Calculate pairwise distances from > #the first two rows of comm to all rows > cdnt.averaged.query(bird.families, comm[1:2,],comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 16.306 17.544 19.852 19.708 17.050 18.762 17.580 18.380 20.112 [2,] 16.306 0.000 19.044 19.276 21.004 18.648 16.654 16.938 17.662 16.820 > > #Calculate the distances from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > cdnt.averaged.query(bird.families,comm,query.matrix = qm) [1] 0.000 16.306 16.306 0.000 17.544 19.044 19.852 19.276 19.708 21.004 [11] 17.050 18.648 18.762 16.654 17.580 16.938 18.380 17.662 20.112 16.820 > > > > cleanEx() > nameEx("cdnt.directed.query") > ### * cdnt.directed.query > > flush(stderr()); flush(stdout()) > > ### Name: cdnt.directed.query > ### Title: Computes the value of the directed Community Distance Nearest > ### Taxon measure > ### Aliases: cdnt.directed.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise dCDNT values for communities in comm > cdnt.directed.query(bird.families,comm) $result.A.to.B [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 15.784 17.016 19.068 19.212 16.596 18.184 17.396 17.548 19.596 [2,] 16.828 0.000 19.008 19.396 21.324 18.848 16.692 17.340 17.532 17.072 [3,] 18.072 19.080 0.000 17.704 17.552 18.796 19.124 19.128 17.276 19.596 [4,] 20.636 19.156 18.132 0.000 16.004 18.744 20.392 17.956 18.528 20.328 [5,] 20.204 20.684 17.128 14.636 0.000 15.880 18.672 17.468 17.772 18.356 [6,] 17.504 18.448 18.592 18.060 15.832 0.000 18.472 20.780 20.372 18.908 [7,] 19.340 16.616 19.212 19.296 18.372 18.456 0.000 19.044 12.964 21.088 [8,] 17.764 16.536 18.452 16.184 16.836 20.220 18.632 0.000 19.992 19.600 [9,] 19.212 17.792 18.264 19.432 19.724 22.516 14.312 21.832 0.000 18.260 [10,] 20.628 16.568 19.884 20.388 18.564 19.452 21.608 20.860 17.312 0.000 > #Note that this matrix is asymmetrical, compare to: > cdnt.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 16.828 18.072 20.636 20.204 17.504 19.340 17.764 19.212 20.628 [2,] 16.828 0.000 19.080 19.396 21.324 18.848 16.692 17.340 17.792 17.072 [3,] 18.072 19.080 0.000 18.132 17.552 18.796 19.212 19.128 18.264 19.884 [4,] 20.636 19.396 18.132 0.000 16.004 18.744 20.392 17.956 19.432 20.388 [5,] 20.204 21.324 17.552 16.004 0.000 15.880 18.672 17.468 19.724 18.564 [6,] 17.504 18.848 18.796 18.744 15.880 0.000 18.472 20.780 22.516 19.452 [7,] 19.340 16.692 19.212 20.392 18.672 18.472 0.000 19.044 14.312 21.608 [8,] 17.764 17.340 19.128 17.956 17.468 20.780 19.044 0.000 21.832 20.860 [9,] 19.212 17.792 18.264 19.432 19.724 22.516 14.312 21.832 0.000 18.260 [10,] 20.628 17.072 19.884 20.388 18.564 19.452 21.608 20.860 18.260 0.000 > cdnt.averaged.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 16.306 17.544 19.852 19.708 17.050 18.762 17.580 18.380 20.112 [2,] 16.306 0.000 19.044 19.276 21.004 18.648 16.654 16.938 17.662 16.820 [3,] 17.544 19.044 0.000 17.918 17.340 18.694 19.168 18.790 17.770 19.740 [4,] 19.852 19.276 17.918 0.000 15.320 18.402 19.844 17.070 18.980 20.358 [5,] 19.708 21.004 17.340 15.320 0.000 15.856 18.522 17.152 18.748 18.460 [6,] 17.050 18.648 18.694 18.402 15.856 0.000 18.464 20.500 21.444 19.180 [7,] 18.762 16.654 19.168 19.844 18.522 18.464 0.000 18.838 13.638 21.348 [8,] 17.580 16.938 18.790 17.070 17.152 20.500 18.838 0.000 20.912 20.230 [9,] 18.380 17.662 17.770 18.980 18.748 21.444 13.638 20.912 0.000 17.786 [10,] 20.112 16.820 19.740 20.358 18.460 19.180 21.348 20.230 17.786 0.000 > > #Calculate pairwise distances from > #the first two rows of comm to all rows > cdnt.directed.query(bird.families, comm[1:2,],comm) $result.A.to.B [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 15.784 17.016 19.068 19.212 16.596 18.184 17.396 17.548 19.596 [2,] 16.828 0.000 19.008 19.396 21.324 18.848 16.692 17.340 17.532 17.072 $result.B.to.A [,1] [,2] [1,] 0.000 16.828 [2,] 18.072 20.636 [3,] 20.204 17.504 [4,] 19.340 17.764 [5,] 19.212 20.628 [6,] 15.784 0.000 [7,] 19.080 19.156 [8,] 20.684 18.448 [9,] 16.616 16.536 [10,] 17.792 16.568 > > #Calculate the distances from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > cdnt.directed.query(bird.families,comm,query.matrix = qm) $result.A.to.B [1] 0.000 16.828 15.784 0.000 17.016 19.008 19.068 19.396 19.212 21.324 [11] 16.596 18.848 18.184 16.692 17.396 17.340 17.548 17.532 19.596 17.072 $result.B.to.A [1] 0.000 15.784 16.828 0.000 18.072 19.080 20.636 19.156 20.204 20.684 [11] 17.504 18.448 19.340 16.616 17.764 16.536 19.212 17.792 20.628 16.568 > > > > cleanEx() > nameEx("cdnt.query") > ### * cdnt.query > > flush(stderr()); flush(stdout()) > > ### Name: cdnt.query > ### Title: Computes the value of the maximised Community Distance Nearest > ### Taxon measure > ### Aliases: cdnt.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise mCDNT values for communities in comm > cdnt.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 16.828 18.072 20.636 20.204 17.504 19.340 17.764 19.212 20.628 [2,] 16.828 0.000 19.080 19.396 21.324 18.848 16.692 17.340 17.792 17.072 [3,] 18.072 19.080 0.000 18.132 17.552 18.796 19.212 19.128 18.264 19.884 [4,] 20.636 19.396 18.132 0.000 16.004 18.744 20.392 17.956 19.432 20.388 [5,] 20.204 21.324 17.552 16.004 0.000 15.880 18.672 17.468 19.724 18.564 [6,] 17.504 18.848 18.796 18.744 15.880 0.000 18.472 20.780 22.516 19.452 [7,] 19.340 16.692 19.212 20.392 18.672 18.472 0.000 19.044 14.312 21.608 [8,] 17.764 17.340 19.128 17.956 17.468 20.780 19.044 0.000 21.832 20.860 [9,] 19.212 17.792 18.264 19.432 19.724 22.516 14.312 21.832 0.000 18.260 [10,] 20.628 17.072 19.884 20.388 18.564 19.452 21.608 20.860 18.260 0.000 > > #Calculate pairwise distances from > #the first two rows of comm to all rows > cdnt.query(bird.families, comm[1:2,],comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.000 16.828 18.072 20.636 20.204 17.504 19.340 17.764 19.212 20.628 [2,] 16.828 0.000 19.080 19.396 21.324 18.848 16.692 17.340 17.792 17.072 > > #Calculate the distances from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > cdnt.query(bird.families,comm,query.matrix = qm) [1] 0.000 16.828 16.828 0.000 18.072 19.080 20.636 19.396 20.204 21.324 [11] 17.504 18.848 19.340 16.692 17.764 17.340 19.212 17.792 20.628 17.072 > > > > cleanEx() > nameEx("mntd.moments") > ### * mntd.moments > > flush(stderr()); flush(stdout()) > > ### Name: mntd.moments > ### Title: Computes the moments of the Mean Nearest Taxon Distance measure > ### Aliases: mntd.moments > > ### ** Examples > > #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) [,1] [,2] [1,] 0.00000 0.0000000 [2,] 46.15466 8.3656034 [3,] 42.88455 7.1070642 [4,] 41.10455 6.3041508 [5,] 39.84535 5.6813282 [6,] 38.85361 5.1620308 [7,] 38.03451 4.7180262 [8,] 37.34009 4.3349661 [9,] 36.74077 4.0032771 [10,] 36.21608 3.7153826 [11,] 35.75102 3.4648372 [12,] 35.33427 3.2460570 [13,] 34.95712 3.0542199 [14,] 34.61282 2.8852001 [15,] 34.29608 2.7355013 [16,] 34.00274 2.6021842 [17,] 33.72946 2.4827929 [18,] 33.47360 2.3752827 [19,] 33.23300 2.2779541 [20,] 33.00589 2.1893950 [21,] 32.79082 2.1084299 [22,] 32.58657 2.0340779 [23,] 32.39213 1.9655169 [24,] 32.20663 1.9020553 [25,] 32.02930 1.8431078 [26,] 31.85951 1.7881766 [27,] 31.69669 1.7368358 [28,] 31.54032 1.6887190 [29,] 31.38996 1.6435088 [30,] 31.24521 1.6009293 [31,] 31.10571 1.5607390 [32,] 30.97114 1.5227253 [33,] 30.84119 1.4867008 [34,] 30.71559 1.4524989 [35,] 30.59409 1.4199712 [36,] 30.47647 1.3889849 [37,] 30.36251 1.3594210 [38,] 30.25202 1.3311722 [39,] 30.14482 1.3041415 [40,] 30.04074 1.2782414 [41,] 29.93962 1.2533922 [42,] 29.84132 1.2295213 [43,] 29.74570 1.2065627 [44,] 29.65264 1.1844560 [45,] 29.56201 1.1631459 [46,] 29.47372 1.1425816 [47,] 29.38764 1.1227164 [48,] 29.30369 1.1035073 [49,] 29.22177 1.0849148 [50,] 29.14180 1.0669022 [51,] 29.06369 1.0494356 [52,] 28.98737 1.0324837 [53,] 28.91276 1.0160172 [54,] 28.83980 1.0000091 [55,] 28.76843 0.9844341 [56,] 28.69857 0.9692688 [57,] 28.63017 0.9544911 [58,] 28.56318 0.9400806 [59,] 28.49754 0.9260179 [60,] 28.43320 0.9122852 [61,] 28.37012 0.8988654 [62,] 28.30825 0.8857426 [63,] 28.24754 0.8729020 [64,] 28.18796 0.8603293 [65,] 28.12946 0.8480112 [66,] 28.07202 0.8359351 [67,] 28.01558 0.8240892 [68,] 27.96012 0.8124620 [69,] 27.90561 0.8010429 [70,] 27.85201 0.7898216 [71,] 27.79929 0.7787885 [72,] 27.74743 0.7679343 [73,] 27.69639 0.7572500 [74,] 27.64615 0.7467273 [75,] 27.59669 0.7363581 [76,] 27.54797 0.7261345 [77,] 27.49998 0.7160491 [78,] 27.45269 0.7060946 [79,] 27.40608 0.6962642 [80,] 27.36013 0.6865511 [81,] 27.31481 0.6769488 [82,] 27.27012 0.6674509 [83,] 27.22602 0.6580514 [84,] 27.18251 0.6487443 [85,] 27.13956 0.6395238 [86,] 27.09716 0.6303841 [87,] 27.05529 0.6213196 [88,] 27.01393 0.6123248 [89,] 26.97307 0.6033943 [90,] 26.93270 0.5945227 [91,] 26.89280 0.5857048 [92,] 26.85335 0.5769352 [93,] 26.81434 0.5682086 [94,] 26.77577 0.5595199 [95,] 26.73761 0.5508637 [96,] 26.69986 0.5422348 [97,] 26.66250 0.5336278 [98,] 26.62552 0.5250373 [99,] 26.58891 0.5164578 [100,] 26.55267 0.5078838 > > # 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) [,1] [,2] [1,] 0.00000 0.0000000 [2,] 46.56880 7.9252960 [3,] 43.60507 6.4716839 [4,] 41.70680 5.9145525 [5,] 40.40180 5.4821632 [6,] 39.45393 4.9879330 [7,] 38.58577 4.6229980 [8,] 37.81050 4.1424633 [9,] 37.13013 3.9843482 [10,] 36.57194 3.7119115 [11,] 36.13569 3.4677957 [12,] 35.71630 3.2236703 [13,] 35.27551 3.0519716 [14,] 34.97341 2.9679028 [15,] 34.60087 2.7984207 [16,] 34.32620 2.6534680 [17,] 34.08534 2.5625649 [18,] 33.83373 2.4486773 [19,] 33.58322 2.3291625 [20,] 33.30759 2.2316892 [21,] 33.09028 2.1568026 [22,] 32.86852 2.0714145 [23,] 32.67397 1.9748190 [24,] 32.47986 1.9049319 [25,] 32.29071 1.8340068 [26,] 32.11060 1.7980983 [27,] 31.91656 1.7283150 [28,] 31.74774 1.6599864 [29,] 31.59553 1.5997891 [30,] 31.44414 1.5662005 [31,] 31.27482 1.5433946 [32,] 31.12558 1.4784323 [33,] 30.99337 1.4455180 [34,] 30.86129 1.4048379 [35,] 30.73135 1.3708020 [36,] 30.60747 1.3757835 [37,] 30.49223 1.3499489 [38,] 30.38552 1.3235972 [39,] 30.27661 1.2959039 [40,] 30.16033 1.2652644 [41,] 30.05605 1.2202950 [42,] 29.95638 1.1843729 [43,] 29.85370 1.1532349 [44,] 29.74860 1.1331800 [45,] 29.64738 1.1000752 [46,] 29.55056 1.0799613 [47,] 29.46480 1.0554911 [48,] 29.38761 1.0321346 [49,] 29.30140 1.0183243 [50,] 29.22265 0.9949309 [51,] 29.13773 0.9984668 [52,] 29.06747 0.9813978 [53,] 28.98557 0.9597204 [54,] 28.90445 0.9457699 [55,] 28.83465 0.9437308 [56,] 28.76881 0.9269639 [57,] 28.69867 0.9129179 [58,] 28.63450 0.8898909 [59,] 28.56436 0.8683258 [60,] 28.48896 0.8492173 [61,] 28.43854 0.8282257 [62,] 28.37572 0.8152687 [63,] 28.31363 0.8009361 [64,] 28.25472 0.7886089 [65,] 28.18383 0.7905307 [66,] 28.12829 0.7828236 [67,] 28.06417 0.7693714 [68,] 28.00828 0.7570315 [69,] 27.95053 0.7523773 [70,] 27.89475 0.7370543 [71,] 27.83911 0.7231900 [72,] 27.79077 0.7170339 [73,] 27.73588 0.7088203 [74,] 27.67670 0.6988764 [75,] 27.61901 0.6897167 [76,] 27.56691 0.6760681 [77,] 27.52649 0.6687450 [78,] 27.47985 0.6674105 [79,] 27.43826 0.6522555 [80,] 27.39055 0.6550721 [81,] 27.33799 0.6415315 [82,] 27.29246 0.6352233 [83,] 27.24211 0.6195002 [84,] 27.20298 0.6000352 [85,] 27.15798 0.5938468 [86,] 27.11057 0.5770758 [87,] 27.06830 0.5617092 [88,] 27.02848 0.5557571 [89,] 26.99394 0.5422917 [90,] 26.95615 0.5320652 [91,] 26.91576 0.5197242 [92,] 26.87849 0.5122133 [93,] 26.83919 0.5046939 [94,] 26.79992 0.4966791 [95,] 26.76317 0.4891923 [96,] 26.72555 0.4798474 [97,] 26.69305 0.4714599 [98,] 26.65953 0.4578987 [99,] 26.62319 0.4519610 [100,] 26.58272 0.4354873 > > > > > cleanEx() > nameEx("mntd.pvalues") > ### * mntd.pvalues > > flush(stderr()); flush(stdout()) > > ### Name: mntd.pvalues > ### Title: Computes the p-values of the Mean Nearest Taxon Distance measure > ### Aliases: mntd.pvalues > > ### ** Examples > > #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 > mntd.pvalues(bird.families,comm, reps=1000) [1] 0.392607393 0.104895105 0.116883117 0.586413586 0.595404595 0.405594406 [7] 0.775224775 0.603396603 0.069930070 0.356643357 0.666333666 0.208791209 [13] 0.964035964 0.338661339 0.772227772 0.740259740 0.678321678 0.386613387 [19] 0.330669331 0.886113886 0.684315684 0.999000999 0.108891109 0.503496503 [25] 0.125874126 0.013986014 0.475524476 0.004995005 0.964035964 0.018981019 [31] 0.541458541 0.565434565 0.924075924 0.595404595 0.561438561 0.392607393 [37] 0.346653347 0.944055944 0.086913087 0.468531469 0.635364635 0.339660340 [43] 0.522477522 0.578421578 0.657342657 0.913086913 0.859140859 0.663336663 [49] 0.912087912 0.654345654 0.388611389 0.905094905 0.514485514 0.009990010 [55] 0.723276723 0.637362637 0.441558442 0.746253746 0.663336663 0.506493506 [61] 0.503496503 0.318681319 0.330669331 0.118881119 0.396603397 0.839160839 [67] 0.346653347 0.248751249 0.740259740 0.992007992 0.228771229 0.516483516 [73] 0.942057942 0.484515485 0.499500500 0.883116883 0.133866134 0.586413586 [79] 0.330669331 0.290709291 0.530469530 0.499500500 0.234765235 0.970029970 [85] 0.145854146 0.048951049 0.018981019 0.631368631 0.125874126 0.045954046 [91] 0.728271728 0.937062937 0.277722278 0.353646354 0.644355644 0.593406593 [97] 0.969030969 0.180819181 0.919080919 0.811188811 > > # Create random abundance weights > weights = runif(length(bird.families$tip.label)) > names(weights) = bird.families$tip.label > > # Calculate p-values under the sequential model > mntd.pvalues(bird.families,comm,null.model="sequential", + abundance.weights=weights, reps=1000) [1] 0.436563437 0.108891109 0.119880120 0.619380619 0.627372627 0.443556444 [7] 0.832167832 0.636363636 0.082917083 0.383616384 0.717282717 0.210789211 [13] 0.984015984 0.356643357 0.832167832 0.809190809 0.737262737 0.425574426 [19] 0.350649351 0.917082917 0.744255744 1.000000000 0.114885115 0.542457542 [25] 0.130869131 0.013986014 0.502497502 0.003996004 0.984015984 0.019980020 [31] 0.569430569 0.603396603 0.939060939 0.627372627 0.599400599 0.436563437 [37] 0.360639361 0.962037962 0.100899101 0.497502498 0.684315684 0.357642358 [43] 0.547452547 0.614385614 0.706293706 0.933066933 0.905094905 0.713286713 [49] 0.933066933 0.699300699 0.434565435 0.929070929 0.543456543 0.010989011 [55] 0.785214785 0.685314685 0.472527473 0.811188811 0.715284715 0.542457542 [61] 0.542457542 0.334665335 0.350649351 0.119880120 0.438561439 0.886113886 [67] 0.360639361 0.258741259 0.809190809 1.000000000 0.237762238 0.543456543 [73] 0.960039960 0.508491508 0.536463536 0.915084915 0.138861139 0.619380619 [79] 0.350649351 0.312687313 0.559440559 0.536463536 0.241758242 0.989010989 [85] 0.153846154 0.054945055 0.018981019 0.678321678 0.130869131 0.046953047 [91] 0.789210789 0.959040959 0.298701299 0.375624376 0.693306693 0.626373626 [97] 0.987012987 0.186813187 0.933066933 0.868131868 > > > > cleanEx() > nameEx("mntd.query") > ### * mntd.query > > flush(stderr()); flush(stdout()) > > ### Name: mntd.query > ### Title: Computes the (standardized) value of the Mean Nearest Taxon > ### Distance measure > ### Aliases: mntd.query > > ### ** Examples > > #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 mntd values for each community > mntd.query(bird.families,comm) [1] 29.456 30.500 30.440 28.916 28.888 29.424 28.280 28.868 30.680 29.576 [11] 28.680 30.068 27.212 29.636 28.288 28.392 28.616 29.480 29.660 27.868 [21] 28.596 26.028 30.476 29.152 30.392 31.292 29.252 31.660 27.220 31.120 [31] 29.044 28.972 27.628 28.888 28.984 29.456 29.612 27.476 30.564 29.272 [41] 28.768 29.632 29.116 28.936 28.716 27.708 27.952 28.692 27.712 28.724 [51] 29.464 27.800 29.136 31.428 28.476 28.760 29.328 28.376 28.688 29.148 [61] 29.152 29.700 29.656 30.428 29.448 28.048 29.616 29.924 28.392 26.332 [71] 30.004 29.132 27.500 29.236 29.172 27.880 30.356 28.916 29.656 29.776 [81] 29.076 29.172 29.988 27.140 30.296 30.820 31.132 28.780 30.392 30.868 [91] 28.460 27.528 29.820 29.588 28.740 28.892 27.168 30.160 27.692 28.132 > > #Calculate standardized versions under the uniform model > mntd.query(bird.families,comm,TRUE) [1] 0.294499958 1.273033889 1.216796307 -0.211638282 -0.237882488 [6] 0.264506581 -0.807756654 -0.256628348 1.441746636 0.406975122 [11] -0.432839439 0.868123297 -1.808785618 0.463212704 -0.800258310 [16] -0.702779834 -0.492826194 0.316994991 0.485707737 -1.193921386 [21] -0.511572054 -2.918540575 1.250538856 0.009562874 1.171806241 [26] 2.015369974 0.103292178 2.360293812 -1.801287274 1.854155572 [31] -0.091664774 -0.159149872 -1.418871715 -0.237882488 -0.147902356 [36] 0.294499958 0.440717672 -1.561340256 1.333020643 0.122038039 [41] -0.350357652 0.459463532 -0.024179675 -0.192892422 -0.399096890 [46] -1.343888272 -1.115188771 -0.421591923 -1.340139100 -0.391598546 [51] 0.301998302 -1.257657312 -0.005433814 2.142841828 -0.624047219 [56] -0.357855996 0.174526449 -0.717776523 -0.425341095 0.005813702 [61] 0.009562874 0.523199459 0.481958565 1.205548790 0.287001613 [66] -1.025208639 0.444466844 0.733153099 -0.702779834 -2.633603491 [71] 0.808136542 -0.009182986 -1.538845223 0.088295489 0.028308735 [76] -1.182673869 1.138063691 -0.211638282 0.481958565 0.594433730 [81] -0.061671397 0.028308735 0.793139854 -1.876270717 1.081826109 [86] 1.572967661 1.865403088 -0.339110136 1.171806241 1.617957727 [91] -0.639043908 -1.512601018 0.635674623 0.418222639 -0.376601857 [96] -0.234133315 -1.850026512 0.954354256 -1.358884960 -0.946476024 > > # 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 > mntd.query(bird.families,comm,TRUE,null.model="sequential", + abundance.weights=weights, reps=1000) [1] 0.126143477 1.175496386 1.115188747 -0.416625269 -0.444768833 [6] 0.093979403 -1.055886236 -0.464871380 1.356419301 0.246758754 [11] -0.653835313 0.741281389 -2.129362200 0.307066392 -1.047845218 [16] -0.943311978 -0.718163461 0.150266532 0.331189448 -1.469998687 [21] -0.738266007 -3.319432932 1.151373330 -0.179415224 1.066942637 [26] 1.971557213 -0.078902494 2.341444062 -2.121321182 1.798675316 [31] -0.287968974 -0.360338140 -1.711229240 -0.444768833 -0.348276612 [36] 0.126143477 0.282943337 -1.864008591 1.239824533 -0.058799947 [41] -0.565384110 0.303045883 -0.215599807 -0.396522723 -0.617650730 [46] -1.630819056 -1.385567993 -0.641773786 -1.626798547 -0.609609712 [51] 0.134184496 -1.538347344 -0.195497261 2.108254527 -0.858881284 [56] -0.573425129 -0.002512818 -0.959394015 -0.645794295 -0.183435734 [61] -0.179415224 0.371394540 0.327168938 1.103127220 0.118102459 [66] -1.289075771 0.286963846 0.596543057 -0.943311978 -3.013874231 [71] 0.676953241 -0.199517770 -1.839885536 -0.094984531 -0.159312678 [76] -1.457937159 1.030758054 -0.416625269 0.327168938 0.447784215 [81] -0.255804900 -0.159312678 0.660871204 -2.201731366 0.970450415 [86] 1.497137124 1.810736844 -0.553322583 1.066942637 1.545383235 [91] -0.874963321 -1.811741971 0.492009817 0.258820282 -0.593527675 [96] -0.440748324 -2.173587802 0.833753101 -1.646901093 -1.204645078 > > > > cleanEx() > nameEx("mpd.moments") > ### * mpd.moments > > flush(stderr()); flush(stdout()) > > ### Name: mpd.moments > ### Title: Computes the moments of the Mean Pairwise Distance measure > ### Aliases: mpd.moments > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > # Calculate mean and variance under the uniform model > mpd.moments(bird.families,1:100) [,1] [,2] [1,] 0.00000 0.0000000 [2,] 46.15466 8.3656034 [3,] 46.15466 5.9846230 [4,] 46.15466 4.9048285 [5,] 46.15466 4.2505773 [6,] 46.15466 3.7985716 [7,] 46.15466 3.4615811 [8,] 46.15466 3.1974473 [9,] 46.15466 2.9829384 [10,] 46.15466 2.8040474 [11,] 46.15466 2.6517552 [12,] 46.15466 2.5199539 [13,] 46.15466 2.4043387 [14,] 46.15466 2.3017762 [15,] 46.15466 2.2099232 [16,] 46.15466 2.1269873 [17,] 46.15466 2.0515708 [18,] 46.15466 1.9825654 [19,] 46.15466 1.9190793 [20,] 46.15466 1.8603855 [21,] 46.15466 1.8058848 [22,] 46.15466 1.7550779 [23,] 46.15466 1.7075452 [24,] 46.15466 1.6629310 [25,] 46.15466 1.6209316 [26,] 46.15466 1.5812856 [27,] 46.15466 1.5437671 [28,] 46.15466 1.5081792 [29,] 46.15466 1.4743496 [30,] 46.15466 1.4421269 [31,] 46.15466 1.4113771 [32,] 46.15466 1.3819815 [33,] 46.15466 1.3538342 [34,] 46.15466 1.3268405 [35,] 46.15466 1.3009155 [36,] 46.15466 1.2759826 [37,] 46.15466 1.2519727 [38,] 46.15466 1.2288232 [39,] 46.15466 1.2064771 [40,] 46.15466 1.1848827 [41,] 46.15466 1.1639924 [42,] 46.15466 1.1437631 [43,] 46.15466 1.1241549 [44,] 46.15466 1.1051312 [45,] 46.15466 1.0866583 [46,] 46.15466 1.0687051 [47,] 46.15466 1.0512428 [48,] 46.15466 1.0342447 [49,] 46.15466 1.0176860 [50,] 46.15466 1.0015436 [51,] 46.15466 0.9857962 [52,] 46.15466 0.9704236 [53,] 46.15466 0.9554071 [54,] 46.15466 0.9407292 [55,] 46.15466 0.9263735 [56,] 46.15466 0.9123245 [57,] 46.15466 0.8985678 [58,] 46.15466 0.8850896 [59,] 46.15466 0.8718772 [60,] 46.15466 0.8589184 [61,] 46.15466 0.8462017 [62,] 46.15466 0.8337163 [63,] 46.15466 0.8214519 [64,] 46.15466 0.8093987 [65,] 46.15466 0.7975475 [66,] 46.15466 0.7858895 [67,] 46.15466 0.7744163 [68,] 46.15466 0.7631198 [69,] 46.15466 0.7519925 [70,] 46.15466 0.7410271 [71,] 46.15466 0.7302166 [72,] 46.15466 0.7195542 [73,] 46.15466 0.7090337 [74,] 46.15466 0.6986487 [75,] 46.15466 0.6883934 [76,] 46.15466 0.6782621 [77,] 46.15466 0.6682492 [78,] 46.15466 0.6583494 [79,] 46.15466 0.6485576 [80,] 46.15466 0.6388687 [81,] 46.15466 0.6292780 [82,] 46.15466 0.6197805 [83,] 46.15466 0.6103719 [84,] 46.15466 0.6010475 [85,] 46.15466 0.5918030 [86,] 46.15466 0.5826340 [87,] 46.15466 0.5735364 [88,] 46.15466 0.5645059 [89,] 46.15466 0.5555384 [90,] 46.15466 0.5466299 [91,] 46.15466 0.5377763 [92,] 46.15466 0.5289736 [93,] 46.15466 0.5202178 [94,] 46.15466 0.5115049 [95,] 46.15466 0.5028309 [96,] 46.15466 0.4941917 [97,] 46.15466 0.4855832 [98,] 46.15466 0.4770014 [99,] 46.15466 0.4684420 [100,] 46.15466 0.4599007 > > # 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 > mpd.moments(bird.families,1:100, + null.model="sequential", abundance.weights=weights, reps=1000) Measures/Mean_pairwise_distance.h:28:8: runtime error: load of value 3487090104, which is not a valid value for type 'Distribution_type' #0 0x7eff7411a5b6 in PhylogeneticMeasures::Mean_pairwise_distance >::Mean_pairwise_distance(PhylogeneticMeasures::Mean_pairwise_distance > const&) Measures/Mean_pairwise_distance.h:28 #1 0x7eff74131f35 in void __gnu_cxx::new_allocator > >::construct >, PhylogeneticMeasures::Mean_pairwise_distance > const&>(PhylogeneticMeasures::Mean_pairwise_distance >*, PhylogeneticMeasures::Mean_pairwise_distance > const&) /usr/include/c++/11/ext/new_allocator.h:162 #2 0x7eff74131f35 in void std::allocator_traits > > >::construct >, PhylogeneticMeasures::Mean_pairwise_distance > const&>(std::allocator > >&, PhylogeneticMeasures::Mean_pairwise_distance >*, PhylogeneticMeasures::Mean_pairwise_distance > const&) /usr/include/c++/11/bits/alloc_traits.h:516 #3 0x7eff74131f35 in void std::vector >, std::allocator > > >::_M_realloc_insert > const&>(__gnu_cxx::__normal_iterator >*, std::vector >, std::allocator > > > >, PhylogeneticMeasures::Mean_pairwise_distance > const&) /usr/include/c++/11/bits/vector.tcc:449 #4 0x7eff74148a25 in std::vector >, std::allocator > > >::push_back(PhylogeneticMeasures::Mean_pairwise_distance > const&) /usr/include/c++/11/bits/stl_vector.h:1198 #5 0x7eff74148a25 in void PhylogeneticMeasures::Incremental_Monte_Carlo_handler >::estimate_moments_with_Monte_Carlo >, PhylogeneticMeasures::Sequential_sampler >, std::back_insert_iterator, std::allocator > > > >(PhylogeneticMeasures::Mean_pairwise_distance >&, std::vector >&, PhylogeneticMeasures::Sequential_sampler >&, int, std::back_insert_iterator, std::allocator > > >) Incremental_Monte_Carlo_types/Incremental_Monte_Carlo_handler.h:455 #6 0x7eff73e76e35 in mpd_moments_weighted_sequential /data/gannet/ripley/R/packages/tests-gcc-SAN/PhyloMeasures/src/PhyloMeasures.cpp:2138 #7 0x58ead5 in do_dotCode /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:1865 #8 0x62b2be in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7126 #9 0x672fd7 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:748 #10 0x6780b0 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1918 #11 0x67a4a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1844 #12 0x647daf in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7094 #13 0x672fd7 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:748 #14 0x6780b0 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1918 #15 0x67a4a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1844 #16 0x67364f in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:871 #17 0x6f6f6d in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264 #18 0x6f7600 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:316 #19 0x6f7744 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1194 #20 0x6f7792 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1201 #21 0x41b418 in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #22 0x7eff862a4b74 in __libc_start_main (/lib64/libc.so.6+0x27b74) #23 0x41dc1d in _start (/data/gannet/ripley/R/gcc-SAN/bin/exec/R+0x41dc1d) [,1] [,2] [1,] 0.00000 0.0000000 [2,] 46.39880 8.3566352 [3,] 46.32500 5.8912366 [4,] 46.39257 4.7377931 [5,] 46.35656 4.1535084 [6,] 46.42428 3.6853906 [7,] 46.47475 3.4180168 [8,] 46.49847 3.1173161 [9,] 46.49216 2.9005593 [10,] 46.47011 2.7579589 [11,] 46.46044 2.6388551 [12,] 46.42107 2.5114264 [13,] 46.45146 2.3538575 [14,] 46.45041 2.2414631 [15,] 46.40805 2.1639339 [16,] 46.42072 2.0675542 [17,] 46.35891 1.9996478 [18,] 46.34805 1.9286465 [19,] 46.34175 1.8846318 [20,] 46.33197 1.8390475 [21,] 46.32706 1.7969713 [22,] 46.33155 1.7661049 [23,] 46.33229 1.7131717 [24,] 46.32802 1.6666501 [25,] 46.34339 1.5975360 [26,] 46.32487 1.5569386 [27,] 46.32473 1.5195284 [28,] 46.33344 1.4860717 [29,] 46.31706 1.4514448 [30,] 46.32262 1.4084222 [31,] 46.32289 1.3651021 [32,] 46.33198 1.3317643 [33,] 46.33339 1.3001631 [34,] 46.33980 1.2616513 [35,] 46.32623 1.2456536 [36,] 46.32831 1.2133426 [37,] 46.33501 1.1891473 [38,] 46.32913 1.1785436 [39,] 46.33960 1.1488569 [40,] 46.34022 1.1188237 [41,] 46.33332 1.0943947 [42,] 46.34551 1.0706453 [43,] 46.34709 1.0408756 [44,] 46.33856 1.0150236 [45,] 46.33592 0.9931706 [46,] 46.33578 0.9763031 [47,] 46.33879 0.9576958 [48,] 46.33571 0.9314767 [49,] 46.33710 0.9167438 [50,] 46.34241 0.8995595 [51,] 46.33976 0.8859169 [52,] 46.33731 0.8623104 [53,] 46.33897 0.8356103 [54,] 46.33643 0.8211479 [55,] 46.33457 0.8024775 [56,] 46.32828 0.7851867 [57,] 46.32834 0.7789953 [58,] 46.32547 0.7678576 [59,] 46.31640 0.7588727 [60,] 46.30981 0.7474547 [61,] 46.31052 0.7382271 [62,] 46.30997 0.7317621 [63,] 46.30255 0.7211012 [64,] 46.29666 0.7075748 [65,] 46.29406 0.6962479 [66,] 46.29409 0.6894645 [67,] 46.29346 0.6808352 [68,] 46.29457 0.6640239 [69,] 46.30052 0.6537049 [70,] 46.29886 0.6455961 [71,] 46.29847 0.6276007 [72,] 46.29740 0.6198852 [73,] 46.30011 0.6079813 [74,] 46.30232 0.5991406 [75,] 46.30557 0.5918253 [76,] 46.30525 0.5809583 [77,] 46.30266 0.5757670 [78,] 46.30105 0.5588948 [79,] 46.30355 0.5515054 [80,] 46.29898 0.5495947 [81,] 46.29478 0.5428788 [82,] 46.29563 0.5324510 [83,] 46.29628 0.5247063 [84,] 46.29510 0.5145566 [85,] 46.29236 0.5042889 [86,] 46.28629 0.4966682 [87,] 46.28844 0.4855088 [88,] 46.28848 0.4792422 [89,] 46.28772 0.4715479 [90,] 46.29047 0.4665950 [91,] 46.28271 0.4571933 [92,] 46.27658 0.4536865 [93,] 46.27798 0.4400823 [94,] 46.27491 0.4325291 [95,] 46.27311 0.4277336 [96,] 46.27020 0.4185371 [97,] 46.27267 0.4108868 [98,] 46.27071 0.4117165 [99,] 46.26660 0.4029542 [100,] 46.26726 0.3910185 > > > > cleanEx() > nameEx("mpd.pvalues") > ### * mpd.pvalues > > flush(stderr()); flush(stdout()) > > ### Name: mpd.pvalues > ### Title: Computes the p-values of the Mean Pairwise Distance measure > ### Aliases: mpd.pvalues > > ### ** Examples > > #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 > mpd.pvalues(bird.families,comm, reps=1000) [1] 0.788211788 0.706293706 0.738261738 0.083916084 0.744255744 0.607392607 [7] 0.426573427 0.833166833 0.276723277 0.076923077 0.924075924 0.706293706 [13] 0.925074925 0.473526474 0.592407592 0.610389610 0.320679321 0.334665335 [19] 0.237762238 0.113886114 0.080919081 0.813186813 0.331668332 0.526473526 [25] 0.706293706 0.779220779 0.637362637 0.338661339 0.960039960 0.100899101 [31] 0.234765235 0.885114885 0.992007992 0.035964036 0.323676324 0.519480519 [37] 0.045954046 0.856143856 0.847152847 0.305694306 0.472527473 0.120879121 [43] 0.719280719 0.801198801 0.312687313 0.925074925 0.846153846 0.101898102 [49] 0.610389610 0.947052947 0.131868132 0.830169830 0.334665335 0.182817183 [55] 0.545454545 0.564435564 0.472527473 0.982017982 0.632367632 0.746253746 [61] 0.676323676 0.440559441 0.581418581 0.677322677 0.129870130 0.973026973 [67] 0.036963037 0.576423576 0.421578422 0.811188811 0.120879121 0.267732268 [73] 0.847152847 0.599400599 0.575424575 0.827172827 0.556443556 0.536463536 [79] 0.960039960 0.274725275 0.166833167 0.249750250 0.261738262 0.642357642 [85] 0.688311688 0.275724276 0.063936064 0.799200799 0.295704296 0.005994006 [91] 0.810189810 0.514485514 0.193806194 0.481518482 0.412587413 0.877122877 [97] 0.776223776 0.123876124 0.294705295 0.286713287 > > # Create random abundance weights > weights = runif(length(bird.families$tip.label)) > names(weights) = bird.families$tip.label > > # Calculate p-values under the sequential model > mpd.pvalues(bird.families,comm,null.model="sequential", + abundance.weights=weights, reps=1000) [1] 0.836163836 0.753246753 0.781218781 0.072927073 0.786213786 0.630369630 [7] 0.456543457 0.878121878 0.292707293 0.066933067 0.947052947 0.753246753 [13] 0.947052947 0.498501499 0.617382617 0.632367632 0.352647353 0.374625375 [19] 0.237762238 0.117882118 0.067932068 0.860139860 0.369630370 0.544455544 [25] 0.753246753 0.826173826 0.664335664 0.381618382 0.973026973 0.089910090 [31] 0.232767233 0.917082917 0.998001998 0.033966034 0.353646354 0.538461538 [37] 0.038961039 0.900099900 0.892107892 0.327672328 0.496503497 0.133866134 [43] 0.763236763 0.849150849 0.336663337 0.947052947 0.892107892 0.089910090 [49] 0.632367632 0.965034965 0.138861139 0.876123876 0.375624376 0.179820180 [55] 0.564435564 0.584415584 0.496503497 0.991008991 0.656343656 0.790209790 [61] 0.709290709 0.469530470 0.605394605 0.712287712 0.137862138 0.987012987 [67] 0.033966034 0.598401598 0.453546454 0.858141858 0.131868132 0.279720280 [73] 0.892107892 0.618381618 0.593406593 0.875124875 0.575424575 0.554445554 [79] 0.973026973 0.285714286 0.160839161 0.257742258 0.270729271 0.669330669 [85] 0.732267732 0.290709291 0.054945055 0.849150849 0.318681319 0.002997003 [91] 0.855144855 0.536463536 0.189810190 0.504495504 0.440559441 0.912087912 [97] 0.824175824 0.134865135 0.317682318 0.302697303 > > > > cleanEx() > nameEx("mpd.query") > ### * mpd.query > > flush(stderr()); flush(stdout()) > > ### Name: mpd.query > ### Title: Computes the (standardized) value of the Mean Pairwise Distance > ### measure > ### Aliases: mpd.query > > ### ** Examples > > #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 mpd values for each community > mpd.query(bird.families,comm) [1] 45.36784 45.63086 45.54041 47.49551 45.51755 45.91984 46.35886 45.14384 [9] 46.72980 47.55069 44.65878 45.62759 44.65241 46.24800 45.97420 45.91265 [17] 46.58890 46.54188 46.86416 47.31967 47.51445 45.24441 46.55559 46.14041 [25] 45.62922 45.38890 45.84620 46.52588 44.34302 47.41404 46.88571 44.90988 [33] 43.49486 47.87298 46.58384 46.15396 47.79184 45.02188 45.07967 46.65404 [41] 46.25290 47.26155 45.59527 45.29633 46.62596 44.65731 45.08473 47.41094 [49] 45.91102 44.49208 47.21927 45.16049 46.53992 47.06971 46.09829 46.04114 [57] 46.25404 43.90514 45.86302 45.49535 45.73633 46.33437 46.00490 45.72457 [65] 47.22351 44.10547 47.86008 46.02253 46.37241 45.25486 47.26400 46.76784 [73] 45.07869 45.95951 46.02678 45.17241 46.06759 46.11951 44.34335 46.75184 [81] 47.12098 46.82057 46.78433 45.82482 45.68898 46.73633 47.64653 45.30400 [89] 46.67004 48.55869 45.26433 46.16310 47.03412 46.22808 46.39216 44.93649 [97] 45.40245 47.24571 46.67184 46.70057 > > #Calculate standardized versions under the uniform model > mpd.query(bird.families,comm,TRUE) [1] -0.7856092245 -0.5229941977 -0.6133037724 1.3387849592 -0.6361256866 [6] -0.2344599968 0.2038837693 -1.0092639836 0.5742508339 1.3938835806 [11] -1.4935776054 -0.5262544711 -1.4999351387 0.0931974855 -0.1801764438 [16] -0.2416325984 0.4335700342 0.3866220965 0.7084110866 1.1632192336 [21] 1.3576945453 -0.9088475611 0.4003152450 -0.0142285249 -0.5246243344 [26] -0.7645804607 -0.3079791633 0.3706467566 -1.8088460486 1.2574411365 [31] 0.7299288914 -1.2428625767 -2.6557020787 1.7156725707 0.4285166104 [36] -0.0006983901 1.6346547753 -1.1310351971 -1.0733283570 0.4986124897 [41] 0.0980878957 1.1051863661 -0.5585311783 -0.8570092132 0.4705741380 [46] -1.4950447285 -1.0682749331 1.2543438767 -0.2432627352 -1.6600145653 [51] 1.0629658249 -0.9926365889 0.3846659324 0.9136453006 -0.0562860525 [56] -0.1133408379 0.0992289914 -2.2460487190 -0.2911887550 -0.6582955461 [61] -0.4176873650 0.1794317184 -0.1495298733 -0.4294243495 1.0672041804 [66] -2.0460309425 1.7027944906 -0.1319243966 0.2174139041 -0.8984146861 [71] 1.1076315712 0.6122330196 -1.0743064390 -0.1948476743 -0.1276860411 [76] -0.9807365908 -0.0869326230 -0.0350942750 -1.8085200212 0.5962576797 [81] 0.9648315939 0.6648864359 0.6286974006 -0.3293339544 -0.4649613301 [86] 0.5807713808 1.4895726066 -0.8493475706 0.5145878296 2.4003299964 [91] -0.8889598931 0.0084303756 0.8781083199 0.0733098174 0.2371385585 [96] -1.2162913480 -0.7510503259 1.0893740399 0.5163809800 0.5450713864 > > # 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 > mpd.query(bird.families,comm,TRUE,null.model="sequential", + abundance.weights=weights, reps=1000) [1] -0.90556300 -0.62314502 -0.72026455 1.37902491 -0.74480739 -0.31285338 [7] 0.15854448 -1.14608284 0.55683973 1.43827834 -1.66691699 -0.62665114 [13] -1.67375393 0.03951170 -0.25447648 -0.32056685 0.40555064 0.35506251 [19] 0.70111657 1.19022034 1.39936041 -1.03809434 0.36978822 -0.07601496 [25] -0.62489808 -0.88294852 -0.39191639 0.33788252 -2.00595882 1.29154721 [31] 0.72425697 -1.39729635 -2.91667353 1.78433240 0.40011616 -0.06146457 [37] 1.69720532 -1.27703643 -1.21497810 0.47549774 0.04477088 1.12781140 [43] -0.66136173 -0.98234703 0.44534511 -1.66849475 -1.20954362 1.28821640 [49] -0.32231991 -1.84590443 1.08240714 -1.12820163 0.35295884 0.92182684 [55] -0.12124391 -0.18260102 0.04599802 -2.47612953 -0.37385987 -0.76864901 [61] -0.50989734 0.13224857 -0.22151895 -0.52251937 1.08696510 -2.26102906 [67] 1.77048323 -0.20258590 0.17309487 -1.02687476 1.13044099 0.59768603 [73] -1.21602994 -0.27025402 -0.19802795 -1.11540429 -0.15420144 -0.09845413 [79] -2.00560820 0.58050604 0.97687292 0.65430987 0.61539193 -0.41488148 [85] -0.56073608 0.56385197 1.54118297 -0.97410765 0.49267773 2.52061764 [91] -1.01670701 -0.05164743 0.88361013 0.01812436 0.19430690 -1.36872147 [97] -0.86839812 1.11080672 0.49460609 0.52545995 > > > > cleanEx() > nameEx("pd.moments") > ### * pd.moments > > flush(stderr()); flush(stdout()) > > ### Name: pd.moments > ### Title: Computes the moments of the Phylogenetic Diversity measure > ### Aliases: pd.moments > > ### ** Examples > > #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) [,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 > > # 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) [,1] [,2] [1,] 0.0000 0.000000 [2,] 46.4066 8.063720 [3,] 69.7090 8.347711 [4,] 90.7849 9.628890 [5,] 111.3737 10.725054 [6,] 131.2992 11.804589 [7,] 150.8834 12.829607 [8,] 169.9557 13.814821 [9,] 189.0078 14.283492 [10,] 207.5697 15.090358 [11,] 225.8606 15.774992 [12,] 243.7268 16.385807 [13,] 261.6081 16.782497 [14,] 279.1142 17.254204 [15,] 296.3785 17.749486 [16,] 313.7715 17.766160 [17,] 330.9120 17.966085 [18,] 347.7983 18.238747 [19,] 364.5824 18.437341 [20,] 381.3926 18.925380 [21,] 397.8600 19.586758 [22,] 414.2499 20.017961 [23,] 430.4903 20.215916 [24,] 446.9374 20.191218 [25,] 463.1600 20.352167 [26,] 479.2179 20.785809 [27,] 495.2126 21.284117 [28,] 511.3423 21.473868 [29,] 527.0444 21.483162 [30,] 542.8222 21.595110 [31,] 558.4807 21.945757 [32,] 574.0331 21.942421 [33,] 589.6024 21.978935 [34,] 605.2428 22.016951 [35,] 620.2901 22.184936 [36,] 635.7794 22.456666 [37,] 651.1173 22.539940 [38,] 666.1693 22.476354 [39,] 681.4280 22.427470 [40,] 696.3003 22.684109 [41,] 711.1334 22.678499 [42,] 726.0637 22.556652 [43,] 740.9659 22.653551 [44,] 756.0404 22.339701 [45,] 771.1236 22.484733 [46,] 785.7272 22.388000 [47,] 800.6644 22.385872 [48,] 815.1407 22.446854 [49,] 829.8222 22.268146 [50,] 844.4939 22.224111 [51,] 859.1067 22.224358 [52,] 873.6758 22.102304 [53,] 887.9900 22.072998 [54,] 902.6492 22.073197 [55,] 917.2047 22.002573 [56,] 931.4828 21.773183 [57,] 945.7479 21.748027 [58,] 960.1581 21.622942 [59,] 974.5181 21.630807 [60,] 988.6366 21.615470 [61,] 1002.5920 21.812497 [62,] 1016.6555 21.730194 [63,] 1030.6404 21.648001 [64,] 1044.7650 21.398201 [65,] 1058.9543 21.174504 [66,] 1073.1034 20.905308 [67,] 1086.9839 20.941253 [68,] 1101.0811 20.958811 [69,] 1115.1749 20.976782 [70,] 1128.9643 20.861787 [71,] 1142.9850 20.697444 [72,] 1157.0188 20.594933 [73,] 1170.9354 20.473841 [74,] 1184.7194 20.170011 [75,] 1198.5892 19.982585 [76,] 1212.2790 20.033627 [77,] 1225.7254 19.764830 [78,] 1239.6146 19.632956 [79,] 1253.2381 19.656057 [80,] 1266.7920 19.536666 [81,] 1280.8244 19.471100 [82,] 1294.3026 19.204242 [83,] 1307.8686 19.045476 [84,] 1321.5927 18.861443 [85,] 1335.1250 18.751599 [86,] 1348.6293 18.577661 [87,] 1362.3552 18.580211 [88,] 1375.7155 18.505201 [89,] 1389.0063 18.350601 [90,] 1402.5719 18.043396 [91,] 1415.9324 17.812543 [92,] 1429.1346 17.576612 [93,] 1442.3208 17.485009 [94,] 1455.6742 17.436050 [95,] 1468.9549 17.287419 [96,] 1482.1503 17.131333 [97,] 1495.2422 16.897139 [98,] 1508.6050 16.683631 [99,] 1521.9313 16.355454 [100,] 1535.0988 16.166014 > > > > cleanEx() > nameEx("pd.pvalues") > ### * pd.pvalues > > flush(stderr()); flush(stdout()) > > ### Name: pd.pvalues > ### Title: Computes the p-values of the unrooted Phylogenetic Diversity > ### measure > ### Aliases: pd.pvalues > > ### ** Examples > > #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) Measures/Phylogenetic_diversity.h:34:8: runtime error: load of value 256, which is not a valid value for type 'Distribution_type' #0 0x7eff74105932 in PhylogeneticMeasures::Phylogenetic_diversity >::Phylogenetic_diversity(PhylogeneticMeasures::Phylogenetic_diversity > const&) Measures/Phylogenetic_diversity.h:34 #1 0x7eff74105932 in void __gnu_cxx::new_allocator > >::construct >, PhylogeneticMeasures::Phylogenetic_diversity > const&>(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity > const&) /usr/include/c++/11/ext/new_allocator.h:162 #2 0x7eff74105932 in void std::allocator_traits > > >::construct >, PhylogeneticMeasures::Phylogenetic_diversity > const&>(std::allocator > >&, PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity > const&) /usr/include/c++/11/bits/alloc_traits.h:516 #3 0x7eff74105932 in void std::vector >, std::allocator > > >::_M_realloc_insert > const&>(__gnu_cxx::__normal_iterator >*, std::vector >, std::allocator > > > >, PhylogeneticMeasures::Phylogenetic_diversity > const&) /usr/include/c++/11/bits/vector.tcc:449 #4 0x7eff743ba7bc in std::vector >, std::allocator > > >::push_back(PhylogeneticMeasures::Phylogenetic_diversity > const&) /usr/include/c++/11/bits/stl_vector.h:1198 #5 0x7eff743ba7bc in void PhylogeneticMeasures::Incremental_Monte_Carlo_handler >::estimate_pvalues_with_Monte_Carlo >, PhylogeneticMeasures::Uniform_sampler >, std::back_insert_iterator > > >(PhylogeneticMeasures::Phylogenetic_diversity >&, std::vector, std::allocator >, std::allocator, std::allocator > > >&, std::vector >, std::allocator > > >&, PhylogeneticMeasures::Uniform_sampler >&, int, std::back_insert_iterator > >) Incremental_Monte_Carlo_types/Incremental_Monte_Carlo_handler.h:594 #6 0x7eff73f295a9 in int PhylogeneticMeasures::Measure_base_unimodal >::_pvalues_query_uniform_fixed_size, PhylogeneticMeasures::Tree_node_unimodal > >, PhylogeneticMeasures::Phylogenetic_diversity >, std::back_insert_iterator > > >(PhylogeneticMeasures::Phylogenetic_tree_base, PhylogeneticMeasures::Tree_node_unimodal > >&, std::vector, std::allocator >, std::allocator, std::allocator > > >&, std::vector >, std::allocator > > >&, PhylogeneticMeasures::Phylogenetic_diversity >&, std::back_insert_iterator > >, int) Measures/Measure_base/Measure_base_unimodal_impl.h:802 #7 0x7eff73f295a9 in int PhylogeneticMeasures::Phylogenetic_diversity >::pvalues_query_uniform_fixed_size > > >(std::vector, std::allocator >, std::allocator, std::allocator > > >&, std::vector >, std::allocator > > >&, std::back_insert_iterator > >, int) Measures/Phylogenetic_diversity.h:232 #8 0x7eff73f295a9 in pd_pvalues_uniform /data/gannet/ripley/R/packages/tests-gcc-SAN/PhyloMeasures/src/PhyloMeasures.cpp:2548 #9 0x58e907 in do_dotCode /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:1855 #10 0x62b2be in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7126 #11 0x672fd7 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:748 #12 0x6780b0 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1918 #13 0x67a4a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1844 #14 0x67364f in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:871 #15 0x6f6f6d in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264 #16 0x6f7600 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:316 #17 0x6f7744 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1194 #18 0x6f7792 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1201 #19 0x41b418 in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #20 0x7eff862a4b74 in __libc_start_main (/lib64/libc.so.6+0x27b74) #21 0x41dc1d in _start (/data/gannet/ripley/R/gcc-SAN/bin/exec/R+0x41dc1d) Measures/Phylogenetic_diversity.h:34:8: runtime error: load of value 256, which is not a valid value for type 'Distribution_type' #0 0x7eff741058fd in PhylogeneticMeasures::Phylogenetic_diversity >::Phylogenetic_diversity(PhylogeneticMeasures::Phylogenetic_diversity >&&) Measures/Phylogenetic_diversity.h:34 #1 0x7eff741058fd in void __gnu_cxx::new_allocator > >::construct >, PhylogeneticMeasures::Phylogenetic_diversity > >(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >&&) /usr/include/c++/11/ext/new_allocator.h:162 #2 0x7eff741058fd in void std::allocator_traits > > >::construct >, PhylogeneticMeasures::Phylogenetic_diversity > >(std::allocator > >&, PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >&&) /usr/include/c++/11/bits/alloc_traits.h:516 #3 0x7eff741058fd in void std::__relocate_object_a >, PhylogeneticMeasures::Phylogenetic_diversity >, std::allocator > > >(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > >&) /usr/include/c++/11/bits/stl_uninitialized.h:994 #4 0x7eff741058fd in PhylogeneticMeasures::Phylogenetic_diversity >* std::__relocate_a_1 >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > > >(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > >&) /usr/include/c++/11/bits/stl_uninitialized.h:1032 #5 0x7eff741058fd in PhylogeneticMeasures::Phylogenetic_diversity >* std::__relocate_a >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > > >(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > >&) /usr/include/c++/11/bits/stl_uninitialized.h:1046 #6 0x7eff741058fd in std::vector >, std::allocator > > >::_S_do_relocate(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > >&, std::integral_constant) /usr/include/c++/11/bits/stl_vector.h:456 #7 0x7eff741058fd in std::vector >, std::allocator > > >::_S_relocate(PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, PhylogeneticMeasures::Phylogenetic_diversity >*, std::allocator > >&) /usr/include/c++/11/bits/stl_vector.h:469 #8 0x7eff741058fd in void std::vector >, std::allocator > > >::_M_realloc_insert > const&>(__gnu_cxx::__normal_iterator >*, std::vector >, std::allocator > > > >, PhylogeneticMeasures::Phylogenetic_diversity > const&) /usr/include/c++/11/bits/vector.tcc:461 #9 0x7eff743ba7bc in std::vector >, std::allocator > > >::push_back(PhylogeneticMeasures::Phylogenetic_diversity > const&) /usr/include/c++/11/bits/stl_vector.h:1198 #10 0x7eff743ba7bc in void PhylogeneticMeasures::Incremental_Monte_Carlo_handler >::estimate_pvalues_with_Monte_Carlo >, PhylogeneticMeasures::Uniform_sampler >, std::back_insert_iterator > > >(PhylogeneticMeasures::Phylogenetic_diversity >&, std::vector, std::allocator >, std::allocator, std::allocator > > >&, std::vector >, std::allocator > > >&, PhylogeneticMeasures::Uniform_sampler >&, int, std::back_insert_iterator > >) Incremental_Monte_Carlo_types/Incremental_Monte_Carlo_handler.h:594 #11 0x7eff73f295a9 in int PhylogeneticMeasures::Measure_base_unimodal >::_pvalues_query_uniform_fixed_size, PhylogeneticMeasures::Tree_node_unimodal > >, PhylogeneticMeasures::Phylogenetic_diversity >, std::back_insert_iterator > > >(PhylogeneticMeasures::Phylogenetic_tree_base, PhylogeneticMeasures::Tree_node_unimodal > >&, std::vector, std::allocator >, std::allocator, std::allocator > > >&, std::vector >, std::allocator > > >&, PhylogeneticMeasures::Phylogenetic_diversity >&, std::back_insert_iterator > >, int) Measures/Measure_base/Measure_base_unimodal_impl.h:802 #12 0x7eff73f295a9 in int PhylogeneticMeasures::Phylogenetic_diversity >::pvalues_query_uniform_fixed_size > > >(std::vector, std::allocator >, std::allocator, std::allocator > > >&, std::vector >, std::allocator > > >&, std::back_insert_iterator > >, int) Measures/Phylogenetic_diversity.h:232 #13 0x7eff73f295a9 in pd_pvalues_uniform /data/gannet/ripley/R/packages/tests-gcc-SAN/PhyloMeasures/src/PhyloMeasures.cpp:2548 #14 0x58e907 in do_dotCode /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:1855 #15 0x62b2be in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7126 #16 0x672fd7 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:748 #17 0x6780b0 in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1918 #18 0x67a4a7 in Rf_applyClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:1844 #19 0x67364f in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:871 #20 0x6f6f6d in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:264 #21 0x6f7600 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:316 #22 0x6f7744 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1194 #23 0x6f7792 in Rf_mainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1201 #24 0x41b418 in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29 #25 0x7eff862a4b74 in __libc_start_main (/lib64/libc.so.6+0x27b74) #26 0x41dc1d in _start (/data/gannet/ripley/R/gcc-SAN/bin/exec/R+0x41dc1d) [1] 0.68331668 0.30469530 0.26073926 0.34665335 0.64835165 0.50049950 [7] 0.69530470 0.72527473 0.10289710 0.47852148 0.88311688 0.46653347 [13] 0.95904096 0.35164835 0.70229770 0.70529471 0.74925075 0.32567433 [19] 0.27072927 0.57642358 0.45054945 1.00000000 0.14985015 0.49950050 [25] 0.26673327 0.17882118 0.62637363 0.02697303 0.97402597 0.02897103 [31] 0.50449550 0.77022977 0.96903097 0.26073926 0.57342657 0.50449550 [37] 0.16283716 0.98101898 0.28971029 0.48151848 0.55644356 0.24375624 [43] 0.63636364 0.76323676 0.57842158 0.97802198 0.87612388 0.44855145 [49] 0.82817183 0.87312687 0.16583417 0.88411588 0.28971029 0.04695305 [55] 0.53546454 0.57942058 0.41058941 0.95604396 0.57842158 0.60439560 [61] 0.49450549 0.34865135 0.39660340 0.16583417 0.26773227 0.97302697 [67] 0.20079920 0.43256743 0.60739261 0.98701299 0.27372627 0.45154845 [73] 0.91508492 0.44655345 0.46453546 0.87612388 0.11588412 0.63336663 [79] 0.68331668 0.25774226 0.27872128 0.35164835 0.36063936 0.93506494 [85] 0.34365634 0.06793207 0.02497502 0.81518482 0.18781219 0.02397602 [91] 0.72227772 0.84915085 0.11188811 0.27872128 0.46653347 0.71428571 [97] 0.93106893 0.10089910 0.84615385 0.71428571 > > # 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) [1] 0.75724276 0.34665335 0.29070929 0.39260739 0.72327672 0.55944056 [7] 0.76323676 0.80019980 0.12487512 0.53246753 0.93806194 0.51848152 [13] 0.97602398 0.40559441 0.76823177 0.77822178 0.83316683 0.37362637 [19] 0.30569431 0.65134865 0.50649351 0.99700300 0.17882118 0.55844156 [25] 0.30069930 0.21678322 0.69730270 0.02897103 0.98501499 0.03296703 [31] 0.57142857 0.84915085 0.98201798 0.29370629 0.64635365 0.57142857 [37] 0.19680320 0.99000999 0.33566434 0.53646354 0.61738262 0.27472527 [43] 0.71328671 0.84215784 0.65534466 0.98801199 0.93206793 0.50649351 [49] 0.89010989 0.92907093 0.20379620 0.93806194 0.33566434 0.05694306 [55] 0.60039960 0.65634366 0.46153846 0.97602398 0.65534466 0.67832168 [61] 0.55444555 0.40259740 0.44855145 0.20679321 0.30169830 0.98401598 [67] 0.23076923 0.47952048 0.68331668 0.99300699 0.31368631 0.50749251 [73] 0.95304695 0.49850150 0.51448551 0.93006993 0.13886114 0.70729271 [79] 0.75724276 0.28771229 0.32167832 0.40559441 0.40959041 0.96403596 [85] 0.38861139 0.08191808 0.02597403 0.87512488 0.22377622 0.02597403 [91] 0.80019980 0.90809191 0.13386613 0.32167832 0.51848152 0.79220779 [97] 0.96303696 0.12187812 0.90309690 0.79220779 > > > > cleanEx() > nameEx("pd.query") > ### * pd.query > > flush(stderr()); flush(stdout()) > > ### Name: pd.query > ### Title: Computes the (standardized) value of the unrooted Phylogenetic > ### Diversity measure > ### Aliases: pd.query > > ### ** Examples > > #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 > > #Use query function to calculate pd values for each community > pd.query(bird.families,comm) [1] 827.0 851.0 854.5 848.4 829.3 838.3 826.3 824.2 869.2 839.9 809.8 840.6 [13] 798.4 847.8 825.8 825.6 821.7 849.6 853.6 833.6 841.4 775.8 863.8 838.4 [25] 854.0 860.9 830.7 885.1 794.2 884.3 837.9 820.8 796.1 854.3 833.9 837.9 [37] 862.5 790.5 852.0 839.6 835.2 855.8 829.7 821.2 833.3 792.4 810.5 841.5 [49] 816.1 811.2 862.1 809.7 852.0 878.5 836.1 833.2 844.1 799.1 833.3 831.8 [61] 838.7 848.0 844.9 862.0 853.9 794.4 859.2 842.9 831.5 787.3 853.3 841.3 [73] 806.3 841.9 840.8 810.8 867.9 830.1 827.0 854.8 852.9 847.8 847.5 803.2 [85] 848.7 874.6 886.6 817.1 860.1 886.8 824.3 814.0 868.3 852.9 840.6 824.9 [97] 803.9 869.4 814.8 824.9 > > #Use query function to calculate standardized versions under the uniform model > pd.query(bird.families,comm,TRUE) [1] -0.468016587 0.549495731 0.697882945 0.439265230 -0.370504990 [6] 0.011062130 -0.497694029 -0.586726357 1.321109239 0.078896284 [11] -1.197233748 0.108573727 -1.680552099 0.413827422 -0.518892203 [16] -0.527371472 -0.692717224 0.490140846 0.659726233 -0.188200699 [21] 0.142490804 -2.638709532 1.092168968 0.015301764 0.676684771 [26] 0.969219563 -0.311150104 1.995211150 -1.858616755 1.961294073 [31] -0.005896409 -0.730873936 -1.778063696 0.689403675 -0.175481795 [36] -0.005896409 1.037053717 -2.015483237 0.591892078 0.066177380 [41] -0.120366545 0.752998195 -0.353546451 -0.713915397 -0.200919603 [46] -1.934930179 -1.167556305 0.146730439 -0.930136765 -1.137878863 [51] 1.020095179 -1.201473383 0.591892078 1.715395263 -0.082209833 [56] -0.205159238 0.256960940 -1.650874657 -0.200919603 -0.264514123 [61] 0.028020668 0.422306692 0.290878017 1.015855544 0.672445137 [66] -1.850137486 0.897145773 0.206085324 -0.277233027 -2.151151546 [71] 0.647007329 0.138251170 -1.345620961 0.163688977 0.117052996 [76] -1.154837402 1.265993989 -0.336587912 -0.468016587 0.710601848 [81] 0.630048790 0.413827422 0.401108518 -1.477049636 0.451984134 [86] 1.550049511 2.058805670 -0.887740418 0.935302485 2.067284939 [91] -0.582486723 -1.019169092 1.282952527 0.630048790 0.108573727 [96] -0.557048915 -1.447372193 1.329588509 -0.985252015 -0.557048915 > > # 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.query(bird.families,comm,TRUE,null.model="sequential", + abundance.weights=weights, reps=1000) [1] -0.638736456 0.448112250 0.606611019 0.330370307 -0.534580121 [6] -0.127011857 -0.670436209 -0.765535471 1.272305851 -0.054555276 [11] -1.417644694 -0.022855523 -1.933897829 0.303199089 -0.693078891 [16] -0.702135963 -0.878748878 0.384712742 0.565854193 -0.339853062 [21] 0.013372768 -2.957347027 1.027764892 -0.122483321 0.583968338 [26] 0.896437341 -0.471180613 1.992343118 -2.124096353 1.956114828 [31] -0.145126002 -0.919505704 -2.038054164 0.597553947 -0.326267453 [36] -0.145126002 0.968893921 -2.291652195 0.493397612 -0.068140885 [41] -0.267396481 0.665481991 -0.516465976 -0.901391559 -0.353438670 [46] -2.205610006 -1.385944940 0.017901304 -1.132346909 -1.354245186 [51] 0.950779776 -1.422173231 0.493397612 1.693459724 -0.226639655 [56] -0.357967207 0.135643247 -1.902198075 -0.353438670 -0.421366714 [61] -0.108897712 0.312256162 0.171871537 0.946251240 0.579439802 [66] -2.115039280 0.819452224 0.081300812 -0.434952323 -2.436565355 [71] 0.552268584 0.008844231 -1.576143464 0.036015449 -0.013798450 [76] -1.372359332 1.213434880 -0.498351831 -0.638736456 0.620196628 [81] 0.534154439 0.303199089 0.289613480 -1.716528088 0.343955915 [86] 1.516846810 2.060271162 -1.087061546 0.860209050 2.069328235 [91] -0.761006935 -1.227446171 1.231549025 0.534154439 -0.022855523 [96] -0.733835717 -1.684828334 1.281362924 -1.191217881 -0.733835717 > > > > cleanEx() > nameEx("phylosor.query") > ### * phylosor.query > > flush(stderr()); flush(stdout()) > > ### Name: phylosor.query > ### Title: Computes the value of the Phylogenetic Sorensen's Similarity > ### measure > ### Aliases: phylosor.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise PhyloSor values for communities in comm > phylosor.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.0000000 0.5208582 0.4988403 0.4265250 0.4225080 0.5012911 0.4593238 [2,] 0.5208582 1.0000000 0.4560539 0.4433329 0.3910016 0.4674125 0.5177368 [3,] 0.4988403 0.4560539 1.0000000 0.4922192 0.4949519 0.4677457 0.4504998 [4,] 0.4265250 0.4433329 0.4922192 1.0000000 0.5594564 0.4745361 0.4212098 [5,] 0.4225080 0.3910016 0.4949519 0.5594564 1.0000000 0.5432958 0.4526456 [6,] 0.5012911 0.4674125 0.4677457 0.4745361 0.5432958 1.0000000 0.4557251 [7,] 0.4593238 0.5177368 0.4504998 0.4212098 0.4526456 0.4557251 1.0000000 [8,] 0.4797723 0.5033429 0.4564246 0.5019730 0.4887814 0.4078195 0.4511360 [9,] 0.4788350 0.4966864 0.4924291 0.4618072 0.4698263 0.3935578 0.6048953 [10,] 0.4263003 0.5183039 0.4467658 0.4197121 0.4707644 0.4486950 0.3952707 [,8] [,9] [,10] [1,] 0.4797723 0.4788350 0.4263003 [2,] 0.5033429 0.4966864 0.5183039 [3,] 0.4564246 0.4924291 0.4467658 [4,] 0.5019730 0.4618072 0.4197121 [5,] 0.4887814 0.4698263 0.4707644 [6,] 0.4078195 0.3935578 0.4486950 [7,] 0.4511360 0.6048953 0.3952707 [8,] 1.0000000 0.4073462 0.4268974 [9,] 0.4073462 1.0000000 0.4873910 [10,] 0.4268974 0.4873910 1.0000000 > > #Calculate pairwise distances from > #the first two rows of comm to all rows > phylosor.query(bird.families, comm[1:2,],comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 1.0000000 0.5208582 0.4988403 0.4265250 0.4225080 0.5012911 0.4593238 [2,] 0.5208582 1.0000000 0.4560539 0.4433329 0.3910016 0.4674125 0.5177368 [,8] [,9] [,10] [1,] 0.4797723 0.4788350 0.4263003 [2,] 0.5033429 0.4966864 0.5183039 > > #Calculate the distances from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > phylosor.query(bird.families,comm,query.matrix = qm) [1] 1.0000000 0.5208582 0.5208582 1.0000000 0.4988403 0.4560539 0.4265250 [8] 0.4433329 0.4225080 0.3910016 0.5012911 0.4674125 0.4593238 0.5177368 [15] 0.4797723 0.5033429 0.4788350 0.4966864 0.4263003 0.5183039 > > > > cleanEx() > nameEx("unifrac.query") > ### * unifrac.query > > flush(stderr()); flush(stdout()) > > ### Name: unifrac.query > ### Title: Computes the value of the Unique Fraction measure > ### Aliases: unifrac.query > > ### ** Examples > > #Load phylogenetic tree of bird families from package "ape" > data(bird.families, package = "ape") > > #Create 10 random communities with 50 families each > comm = matrix(0,nrow = 10,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 all pairwise UniFrac values for communities in comm > unifrac.query(bird.families,comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.0000000 0.6478646 0.6676967 0.7289280 0.7321647 0.6655181 0.7018687 [2,] 0.6478646 0.0000000 0.7046180 0.7152037 0.7569907 0.6950174 0.6507119 [3,] 0.6676967 0.7046180 0.0000000 0.6735473 0.6711388 0.6947336 0.7092613 [4,] 0.7289280 0.7152037 0.6735473 0.0000000 0.6116352 0.6889234 0.7332073 [5,] 0.7321647 0.7569907 0.6711388 0.6116352 0.0000000 0.6270377 0.7074713 [6,] 0.6655181 0.6950174 0.6947336 0.6889234 0.6270377 0.0000000 0.7048938 [7,] 0.7018687 0.6507119 0.7092613 0.7332073 0.7074713 0.7048938 0.0000000 [8,] 0.6844076 0.6636886 0.7043069 0.6649106 0.6765648 0.7438610 0.7087310 [9,] 0.6852182 0.6696056 0.6733626 0.6997729 0.6929588 0.7550128 0.5664158 [10,] 0.7291095 0.6501956 0.7123642 0.7344078 0.6921570 0.7107628 0.7536839 [,8] [,9] [,10] [1,] 0.6844076 0.6852182 0.7291095 [2,] 0.6636886 0.6696056 0.6501956 [3,] 0.7043069 0.6733626 0.7123642 [4,] 0.6649106 0.6997729 0.7344078 [5,] 0.6765648 0.6929588 0.6921570 [6,] 0.7438610 0.7550128 0.7107628 [7,] 0.7087310 0.5664158 0.7536839 [8,] 0.0000000 0.7442343 0.7286271 [9,] 0.7442343 0.0000000 0.6777812 [10,] 0.7286271 0.6777812 0.0000000 > > #Calculate pairwise distances from > #the first two rows of comm to all rows > unifrac.query(bird.families, comm[1:2,],comm) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.0000000 0.6478646 0.6676967 0.7289280 0.7321647 0.6655181 0.7018687 [2,] 0.6478646 0.0000000 0.7046180 0.7152037 0.7569907 0.6950174 0.6507119 [,8] [,9] [,10] [1,] 0.6844076 0.6852182 0.7291095 [2,] 0.6636886 0.6696056 0.6501956 > > #Calculate the distances from the first two rows > #to all rows using the query matrix > qm = expand.grid(1:2,1:10) > unifrac.query(bird.families,comm,query.matrix = qm) [1] 0.0000000 0.6478646 0.6478646 0.0000000 0.6676967 0.7046180 0.7289280 [8] 0.7152037 0.7321647 0.7569907 0.6655181 0.6950174 0.7018687 0.6507119 [15] 0.6844076 0.6636886 0.6852182 0.6696056 0.7291095 0.6501956 > > > > ### *