Title: Replacement and Richness components of Beta Diversity

Name: Tammy L. Elliott

Date: April 15, 2016

R version 3.2

Data setup for beta diversity composition analyses

#Species in cluster 1 of env.dist.4
site.env.dist.cfuz.4.cluster1<-colSums(pa.sp.allsp[site.env.dist.cfuz.4$clustering==1,])
site.env.dist.cfuz.4.cluster1[site.env.dist.cfuz.4.cluster1>0]<-1

#Species in cluster 2 of env.dist.4
site.env.dist.cfuz.4.cluster2<-colSums(pa.sp.allsp[site.env.dist.cfuz.4$clustering==2,])
site.env.dist.cfuz.4.cluster2[site.env.dist.cfuz.4.cluster2>0]<-1

#Species in cluster 3 of env.dist.4
site.env.dist.cfuz.4.cluster3<-colSums(pa.sp.allsp[site.env.dist.cfuz.4$clustering==3,])
site.env.dist.cfuz.4.cluster3[site.env.dist.cfuz.4.cluster3>0]<-1

#Species in cluster 4 of env.dist.4
site.env.dist.cfuz.4.cluster4<-colSums(pa.sp.allsp[site.env.dist.cfuz.4$clustering==4,])
site.env.dist.cfuz.4.cluster4[site.env.dist.cfuz.4.cluster4>0]<-1

#make a community of six clusters of env.dist.4
site.env.dist.cfuz.4.comm<-rbind(site.env.dist.cfuz.4.cluster1,site.env.dist.cfuz.4.cluster2,site.env.dist.cfuz.4.cluster3,
    site.env.dist.cfuz.4.cluster4)

rich.repl.site.env.dist.cfuz.4<-beta.div.comp(site.env.dist.cfuz.4.comm, coef="S", quant=TRUE, save.abc=FALSE)
rich.repl.site.env.dist.cfuz.4.rich.m<-as.matrix(rich.repl.site.env.dist.cfuz.4$rich)
rich.repl.site.env.dist.cfuz.4.repl.m<-as.matrix(rich.repl.site.env.dist.cfuz.4$repl)
rownames(rich.repl.site.env.dist.cfuz.4.rich.m)<-c("Group1", "Group2", "Group3", "Group4")
colnames(rich.repl.site.env.dist.cfuz.4.rich.m)<-c("Group1", "Group2", "Group3", "Group4")
rownames(rich.repl.site.env.dist.cfuz.4.repl.m)<-c("Group1", "Group2", "Group3", "Group4")
colnames(rich.repl.site.env.dist.cfuz.4.repl.m)<-c("Group1", "Group2", "Group3", "Group4")
rich.repl.site.env.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.09090909 0.4358974 0.1914894
## Group2 0.09090909 0.00000000 0.3592233 0.1023622
## Group3 0.43589744 0.35922330 0.0000000 0.2666667
## Group4 0.19148936 0.10236220 0.2666667 0.0000000
rich.repl.site.env.dist.cfuz.4.repl.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.07792208 0.1025641 0.2411348
## Group2 0.07792208 0.00000000 0.1553398 0.3937008
## Group3 0.10256410 0.15533981 0.0000000 0.1777778
## Group4 0.24113475 0.39370079 0.1777778 0.0000000

raoD presence absence with Pierre’s betacomp

rich.repl.raoD.pa.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.05590062 0.1643836 0.3281250
## Group2 0.05590062 0.00000000 0.1094891 0.2773109
## Group3 0.16438356 0.10948905 0.0000000 0.1730769
## Group4 0.32812500 0.27731092 0.1730769 0.0000000
rich.repl.raoD.pa.dist.cfuz.4.repl.m
##           Group1    Group2    Group3    Group4
## Group1 0.0000000 0.1490683 0.1643836 0.1562500
## Group2 0.1490683 0.0000000 0.1605839 0.1008403
## Group3 0.1643836 0.1605839 0.0000000 0.2115385
## Group4 0.1562500 0.1008403 0.2115385 0.0000000

raoD presence-absence with phylogeny using Pierre’s betacomp function

rich.repl.raoD.pa.phy.dist.cfuz.4.rich.m
##           Group1    Group2    Group3    Group4
## Group1 0.0000000 0.5000000 0.0877193 0.3006993
## Group2 0.5000000 0.0000000 0.4311927 0.2345679
## Group3 0.0877193 0.4311927 0.0000000 0.2187500
## Group4 0.3006993 0.2345679 0.2187500 0.0000000
rich.repl.raoD.pa.phy.dist.cfuz.4.repl.m
##            Group1     Group2    Group3     Group4
## Group1 0.00000000 0.06451613 0.1754386 0.08391608
## Group2 0.06451613 0.00000000 0.0733945 0.02469136
## Group3 0.17543860 0.07339450 0.0000000 0.09375000
## Group4 0.08391608 0.02469136 0.0937500 0.00000000

raoD abundance using Pierre’s betacomp function

rich.repl.raoD.abd.dist.cfuz.4.rich.m
##            Group1     Group2     Group3    Group4
## Group1 0.00000000 0.09459459 0.15189873 0.4888889
## Group2 0.09459459 0.00000000 0.05813953 0.5576923
## Group3 0.15189873 0.05813953 0.00000000 0.5964912
## Group4 0.48888889 0.55769231 0.59649123 0.0000000
rich.repl.raoD.abd.dist.cfuz.4.repl.m
##           Group1     Group2     Group3     Group4
## Group1 0.0000000 0.18918919 0.13924051 0.00000000
## Group2 0.1891892 0.00000000 0.15116279 0.05769231
## Group3 0.1392405 0.15116279 0.00000000 0.01754386
## Group4 0.0000000 0.05769231 0.01754386 0.00000000

raoD abundance with phylogeny using Pierre’s betacomp function

rich.repl.raoD.abd.phy.dist.cfuz.4.rich.m
##           Group1      Group2      Group3    Group4
## Group1 0.0000000 0.175675676 0.170068027 0.3260870
## Group2 0.1756757 0.000000000 0.005780347 0.4745763
## Group3 0.1700680 0.005780347 0.000000000 0.4700855
## Group4 0.3260870 0.474576271 0.470085470 0.0000000
rich.repl.raoD.abd.phy.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.14864865 0.06802721 0.19565217
## Group2 0.14864865 0.00000000 0.23121387 0.01694915
## Group3 0.06802721 0.23121387 0.00000000 0.05128205
## Group4 0.19565217 0.01694915 0.05128205 0.00000000

Environmental distance clusters with beta function

BAT.rich.repl.site.env.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.09090909 0.4358974 0.1914894
## Group2 0.09090909 0.00000000 0.3592233 0.1023622
## Group3 0.43589744 0.35922330 0.0000000 0.2666667
## Group4 0.19148936 0.10236220 0.2666667 0.0000000
BAT.rich.repl.site.env.dist.cfuz.4.repl.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.07792208 0.1025641 0.2411348
## Group2 0.07792208 0.00000000 0.1553398 0.3937008
## Group3 0.10256410 0.15533981 0.0000000 0.1777778
## Group4 0.24113475 0.39370079 0.1777778 0.0000000

raoD clusters with presence absence calculated with beta function

BAT.rich.repl.raoD.pa.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.05590062 0.1643836 0.3281250
## Group2 0.05590062 0.00000000 0.1094891 0.2773109
## Group3 0.16438356 0.10948905 0.0000000 0.1730769
## Group4 0.32812500 0.27731092 0.1730769 0.0000000
BAT.rich.repl.raoD.pa.dist.cfuz.4.repl.m
##           Group1    Group2    Group3    Group4
## Group1 0.0000000 0.1490683 0.1643836 0.1562500
## Group2 0.1490683 0.0000000 0.1605839 0.1008403
## Group3 0.1643836 0.1605839 0.0000000 0.2115385
## Group4 0.1562500 0.1008403 0.2115385 0.0000000

raoD clusters with presence-absence and phylogeny calculated with beta function

BAT.rich.repl.raoD.pa.phy.dist.cfuz.4.rich.m
##           Group1    Group2    Group3    Group4
## Group1 0.0000000 0.5000000 0.0877193 0.3006993
## Group2 0.5000000 0.0000000 0.4311927 0.2345679
## Group3 0.0877193 0.4311927 0.0000000 0.2187500
## Group4 0.3006993 0.2345679 0.2187500 0.0000000
BAT.rich.repl.raoD.pa.phy.dist.cfuz.4.repl.m
##            Group1     Group2    Group3     Group4
## Group1 0.00000000 0.06451613 0.1754386 0.08391608
## Group2 0.06451613 0.00000000 0.0733945 0.02469136
## Group3 0.17543860 0.07339450 0.0000000 0.09375000
## Group4 0.08391608 0.02469136 0.0937500 0.00000000

raoD clusters with abundance calculated with beta function

BAT.rich.repl.raoD.abd.dist.cfuz.4.rich.m
##            Group1     Group2     Group3    Group4
## Group1 0.00000000 0.09459459 0.15189873 0.4888889
## Group2 0.09459459 0.00000000 0.05813953 0.5576923
## Group3 0.15189873 0.05813953 0.00000000 0.5964912
## Group4 0.48888889 0.55769231 0.59649123 0.0000000
BAT.rich.repl.raoD.abd.dist.cfuz.4.repl.m
##           Group1     Group2     Group3     Group4
## Group1 0.0000000 0.18918919 0.13924051 0.00000000
## Group2 0.1891892 0.00000000 0.15116279 0.05769231
## Group3 0.1392405 0.15116279 0.00000000 0.01754386
## Group4 0.0000000 0.05769231 0.01754386 0.00000000

raoD clusters with abundance and phylogeny calculated with beta function

BAT.rich.repl.raoD.abd.phy.dist.cfuz.4.rich.m
##           Group1      Group2      Group3    Group4
## Group1 0.0000000 0.175675676 0.170068027 0.3260870
## Group2 0.1756757 0.000000000 0.005780347 0.4745763
## Group3 0.1700680 0.005780347 0.000000000 0.4700855
## Group4 0.3260870 0.474576271 0.470085470 0.0000000
BAT.rich.repl.raoD.abd.phy.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.14864865 0.06802721 0.19565217
## Group2 0.14864865 0.00000000 0.23121387 0.01694915
## Group3 0.06802721 0.23121387 0.00000000 0.05128205
## Group4 0.19565217 0.01694915 0.05128205 0.00000000

Environmental distance clusters calculated with beta function and phylogeny

BAT.phy.rich.repl.site.env.dist.cfuz.4.rich.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.05464814 0.22487593 0.13856380
## Group2 0.05464814 0.00000000 0.17234576 0.08455594
## Group3 0.22487593 0.17234576 0.00000000 0.08908809
## Group4 0.13856380 0.08455594 0.08908809 0.00000000
BAT.phy.rich.repl.site.env.dist.cfuz.4.repl.m
##            Group1     Group2     Group3    Group4
## Group1 0.00000000 0.02061814 0.03474099 0.1008037
## Group2 0.02061814 0.00000000 0.07384810 0.1848123
## Group3 0.03474099 0.07384810 0.00000000 0.1019635
## Group4 0.10080374 0.18481232 0.10196347 0.0000000

raoD clusters with presence absence, calculated with beta function and phylogeny

BAT.phy.rich.repl.raoD.pa.dist.cfuz.4.rich.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.01391552 0.09184692 0.16610032
## Group2 0.01391552 0.00000000 0.07803113 0.15253737
## Group3 0.09184692 0.07803113 0.00000000 0.07540374
## Group4 0.16610032 0.15253737 0.07540374 0.00000000
BAT.phy.rich.repl.raoD.pa.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.08301030 0.07764551 0.07553228
## Group2 0.08301030 0.00000000 0.06810040 0.04388534
## Group3 0.07764551 0.06810040 0.00000000 0.11428223
## Group4 0.07553228 0.04388534 0.11428223 0.00000000

raoD clusters with presence-absence and phylogeny, calculated with beta function and phylogeny

BAT.phy.rich.repl.raoD.pa.phy.dist.cfuz.4.rich.m
##            Group1    Group2     Group3     Group4
## Group1 0.00000000 0.2980676 0.06784954 0.16179434
## Group2 0.29806760 0.0000000 0.23497003 0.14317811
## Group3 0.06784954 0.2349700 0.00000000 0.09498754
## Group4 0.16179434 0.1431781 0.09498754 0.00000000
BAT.phy.rich.repl.raoD.pa.phy.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.03433435 0.07724359 0.01845803
## Group2 0.03433435 0.00000000 0.01522543 0.03266644
## Group3 0.07724359 0.01522543 0.00000000 0.04813123
## Group4 0.01845803 0.03266644 0.04813123 0.00000000

raoD clusters with abundance, calculated with beta function and phylogeny

BAT.phy.rich.repl.raoD.abd.dist.cfuz.4.rich.m
##            Group1     Group2     Group3    Group4
## Group1 0.00000000 0.02090861 0.03436017 0.3162492
## Group2 0.02090861 0.00000000 0.01346123 0.3349431
## Group3 0.03436017 0.01346123 0.00000000 0.3468405
## Group4 0.31624922 0.33494308 0.34684050 0.0000000
BAT.phy.rich.repl.raoD.abd.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.08803984 0.08753767 0.00000000
## Group2 0.08803984 0.00000000 0.09455076 0.03736583
## Group3 0.08753767 0.09455076 0.00000000 0.01933224
## Group4 0.00000000 0.03736583 0.01933224 0.00000000

raoD clusters with abundance and phylogeny, calculated with beta function and phylogeny

BAT.phy.rich.repl.raoD.abd.phy.dist.cfuz.4.rich.m
##            Group1      Group2      Group3    Group4
## Group1 0.00000000 0.051781596 0.057231060 0.2338227
## Group2 0.05178160 0.000000000 0.005465661 0.2821876
## Group3 0.05723106 0.005465661 0.000000000 0.2872103
## Group4 0.23382270 0.282187648 0.287210333 0.0000000
BAT.phy.rich.repl.raoD.abd.phy.dist.cfuz.4.repl.m
##            Group1      Group2     Group3      Group4
## Group1 0.00000000 0.099704442 0.04487338 0.093092240
## Group2 0.09970444 0.000000000 0.09338291 0.003726812
## Group3 0.04487338 0.093382909 0.00000000 0.031085281
## Group4 0.09309224 0.003726812 0.03108528 0.000000000

Angiosperms only analyses - all analyses calculated with beta function


Angiosperm environmental distances

angio.BAT.rich.repl.site.env.dist.cfuz.4.rich.m
##            Group1     Group2    Group3     Group4
## Group1 0.00000000 0.08396947 0.4343434 0.15447154
## Group2 0.08396947 0.00000000 0.3636364 0.07142857
## Group3 0.43434343 0.36363636 0.0000000 0.30000000
## Group4 0.15447154 0.07142857 0.3000000 0.00000000
angio.BAT.rich.repl.site.env.dist.cfuz.4.repl.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.09160305 0.1010101 0.2601626
## Group2 0.09160305 0.00000000 0.1363636 0.3928571
## Group3 0.10101010 0.13636364 0.0000000 0.1500000
## Group4 0.26016260 0.39285714 0.1500000 0.0000000

Angiosperm raoD with presence absence

angio.BAT.rich.repl.raoD.pa.dist.cfuz.4.rich.m
##          Group1     Group2     Group3     Group4
## Group1 0.000000 0.25581395 0.17391304 0.20000000
## Group2 0.255814 0.00000000 0.08571429 0.05882353
## Group3 0.173913 0.08571429 0.00000000 0.02702703
## Group4 0.200000 0.05882353 0.02702703 0.00000000
angio.BAT.rich.repl.raoD.pa.dist.cfuz.4.repl.m
##            Group1     Group2    Group3     Group4
## Group1 0.00000000 0.07751938 0.1594203 0.04444444
## Group2 0.07751938 0.00000000 0.2095238 0.21568627
## Group3 0.15942029 0.20952381 0.0000000 0.25225225
## Group4 0.04444444 0.21568627 0.2522523 0.00000000

Angiosperm raoD with presence absence and phylogeny

angio.BAT.rich.repl.raoD.pa.phy.dist.cfuz.4.rich.m
##           Group1    Group2    Group3    Group4
## Group1 0.0000000 0.2272727 0.3246753 0.1500000
## Group2 0.2272727 0.0000000 0.5140187 0.0800000
## Group3 0.3246753 0.5140187 0.0000000 0.4526316
## Group4 0.1500000 0.0800000 0.4526316 0.0000000
angio.BAT.rich.repl.raoD.pa.phy.dist.cfuz.4.repl.m
##            Group1     Group2     Group3    Group4
## Group1 0.00000000 0.04545455 0.10389610 0.1500000
## Group2 0.04545455 0.00000000 0.03738318 0.1333333
## Group3 0.10389610 0.03738318 0.00000000 0.1052632
## Group4 0.15000000 0.13333333 0.10526316 0.0000000

Angoisperm raoD with abundance

angio.BAT.rich.repl.raoD.abd.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.02531646 0.3050847 0.5247525
## Group2 0.02531646 0.00000000 0.3278689 0.5428571
## Group3 0.30508475 0.32786885 0.0000000 0.2615385
## Group4 0.52475248 0.54285714 0.2615385 0.0000000
angio.BAT.rich.repl.raoD.abd.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.16455696 0.05084746 0.00000000
## Group2 0.16455696 0.00000000 0.06557377 0.01904762
## Group3 0.05084746 0.06557377 0.00000000 0.12307692
## Group4 0.00000000 0.01904762 0.12307692 0.00000000

Angiosperm raoD with abundance and phylogeny

angio.BAT.rich.repl.raoD.abd.phy.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.07792208 0.4821429 0.3174603
## Group2 0.07792208 0.00000000 0.4200000 0.2456140
## Group3 0.48214286 0.42000000 0.0000000 0.1944444
## Group4 0.31746032 0.24561404 0.1944444 0.0000000
angio.BAT.rich.repl.raoD.abd.phy.dist.cfuz.4.repl.m
##            Group1    Group2     Group3     Group4
## Group1 0.00000000 0.1428571 0.07142857 0.03174603
## Group2 0.14285714 0.0000000 0.00000000 0.12280702
## Group3 0.07142857 0.0000000 0.00000000 0.27777778
## Group4 0.03174603 0.1228070 0.27777778 0.00000000

Angiosperm environmental distances calculated with phylogeny

angio.phy.BAT.rich.repl.site.env.dist.cfuz.4.rich.m
##            Group1      Group2    Group3      Group4
## Group1 0.00000000 0.052906459 0.2056153 0.062364740
## Group2 0.05290646 0.000000000 0.1543884 0.009489592
## Group3 0.20561534 0.154388380 0.0000000 0.145111388
## Group4 0.06236474 0.009489592 0.1451114 0.000000000
angio.phy.BAT.rich.repl.site.env.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.01938838 0.08287289 0.13046792
## Group2 0.01938838 0.00000000 0.10181115 0.19444341
## Group3 0.08287289 0.10181115 0.00000000 0.05894284
## Group4 0.13046792 0.19444341 0.05894284 0.00000000

Angiosperm raoD with presence-absence, calculated with phylogeny

angio.phy.BAT.rich.repl.raoD.pa.dist.cfuz.4.rich.m
##           Group1     Group2      Group3      Group4
## Group1 0.0000000 0.15730347 0.104192922 0.102389393
## Group2 0.1573035 0.00000000 0.053995525 0.055813008
## Group3 0.1041929 0.05399553 0.000000000 0.001822976
## Group4 0.1023894 0.05581301 0.001822976 0.000000000
angio.phy.BAT.rich.repl.raoD.pa.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.02687826 0.04729147 0.04155433
## Group2 0.02687826 0.00000000 0.03671666 0.08446850
## Group3 0.04729147 0.03671666 0.00000000 0.10597395
## Group4 0.04155433 0.08446850 0.10597395 0.00000000

Angiosperm raoD with presence-absence and phylogeny, calculated with phylogeny

angio.phy.BAT.rich.repl.raoD.pa.phy.dist.cfuz.4.rich.m
##            Group1    Group2    Group3     Group4
## Group1 0.00000000 0.1034140 0.1746065 0.03251245
## Group2 0.10341395 0.0000000 0.2730894 0.07114070
## Group3 0.17460651 0.2730894 0.0000000 0.20594981
## Group4 0.03251245 0.0711407 0.2059498 0.00000000
angio.phy.BAT.rich.repl.raoD.pa.phy.dist.cfuz.4.repl.m
##            Group1     Group2     Group3     Group4
## Group1 0.00000000 0.02711544 0.04283288 0.06500707
## Group2 0.02711544 0.00000000 0.02704945 0.02783488
## Group3 0.04283288 0.02704945 0.00000000 0.03466298
## Group4 0.06500707 0.02783488 0.03466298 0.00000000

Angiosperm raoD with abundance, calculated with phylogeny

angio.phy.BAT.rich.repl.raoD.abd.dist.cfuz.4.rich.m
##            Group1     Group2    Group3    Group4
## Group1 0.00000000 0.02503411 0.1437879 0.3428994
## Group2 0.02503411 0.00000000 0.1682165 0.3648020
## Group3 0.14378793 0.16821653 0.0000000 0.2094378
## Group4 0.34289939 0.36480198 0.2094378 0.0000000
angio.phy.BAT.rich.repl.raoD.abd.dist.cfuz.4.repl.m
##             Group1      Group2      Group3      Group4
## Group1 0.000000000 0.065787295 0.005169929 0.000000000
## Group2 0.065787295 0.000000000 0.008998642 0.001713681
## Group3 0.005169929 0.008998642 0.000000000 0.050898543
## Group4 0.000000000 0.001713681 0.050898543 0.000000000

Angiosperm raoD with phylogeny and abundance, calculated with phylogeny

angio.phy.BAT.rich.repl.raoD.abd.phy.dist.cfuz.4.rich.m
##             Group1      Group2     Group3     Group4
## Group1 0.000000000 0.002222963 0.24041543 0.16404759
## Group2 0.002222963 0.000000000 0.23831984 0.16188366
## Group3 0.240415433 0.238319837 0.00000000 0.07950342
## Group4 0.164047592 0.161883664 0.07950342 0.00000000
angio.phy.BAT.rich.repl.raoD.abd.phy.dist.cfuz.4.repl.m
##             Group1     Group2     Group3      Group4
## Group1 0.000000000 0.08801255 0.03760344 0.002230163
## Group2 0.088012545 0.00000000 0.00000000 0.024854205
## Group3 0.037603442 0.00000000 0.00000000 0.167150487
## Group4 0.002230163 0.02485421 0.16715049 0.000000000