# set global chunk options:
library(knitr)
opts_chunk$set(cache=FALSE, fig.align='center')
#Calculate beta diversity for vasculars
vasc.abd1<-pairPhylo(tree0, abd.sp.allsp, q=1)
vasc.abd1.mat<-1-(as.matrix(vasc.abd1$CqN))
rownames(vasc.abd1.mat)<-colnames(abd.sp.allsp)
colnames(vasc.abd1.mat)<-colnames(abd.sp.allsp)
vasc.abd1.dist<-dist(vasc.abd1.mat)
vasc.abd1.dist.small<-0.1*(vasc.abd1.dist)
#Calculate phylogenetic beta diversity for vasculars
vasc.ph.abd1<-pairPhylo(tree, abd.sp.allsp, q=1)
vasc.ph.abd1.mat<-1-(as.matrix(vasc.ph.abd1$CqN))
rownames(vasc.ph.abd1.mat)<-colnames(abd.sp.allsp)
colnames(vasc.ph.abd1.mat)<-colnames(abd.sp.allsp)
vasc.ph.abd1.dist<-dist(vasc.ph.abd1.mat)
vasc.ph.abd1.dist.small<-0.1*(vasc.ph.abd1.dist)
#Calculate beta diversity for angiosperms
angio.abd1<-pairPhylo(angiotree0, angio.sp.abd, q=1)
angio.abd1.mat<-1-(as.matrix(angio.abd1$CqN))
rownames(angio.abd1.mat)<-colnames(angio.sp.abd)
colnames(angio.abd1.mat)<-colnames(angio.sp.abd)
angio.abd1.dist<-dist(angio.abd1.mat)
angio.abd1.dist.small<-0.1*(angio.abd1.dist)
#Calculate phylogenetic beta diversity for angiosperms
angio.ph.abd1<-pairPhylo(angiotree, angio.sp.abd, q=1)
angio.ph.abd1.mat<-1-(as.matrix(angio.ph.abd1$CqN))
rownames(angio.ph.abd1.mat)<-colnames(angio.sp.abd)
colnames(angio.ph.abd1.mat)<-colnames(angio.sp.abd)
angio.ph.abd1.dist<-dist(angio.ph.abd1.mat)
angio.ph.abd1.dist.small<-0.1*(angio.ph.abd1.dist)
#Create Principal coordinates for each of the distance matrices
site.dist.ord<-cmdscale(site.env.dist)
vasc.abd1.ord<-cmdscale(vasc.abd1.dist.small)
vasc.ph.abd1.ord<-cmdscale(vasc.ph.abd1.dist.small)
angio.abd1.ord<-cmdscale(angio.abd1.dist.small)
angio.ph.abd1.ord<-cmdscale(angio.ph.abd1.dist.small)
#saveRDS(site.dist.cfuz, file="site.dist.cfuz.rds")
site.dist.cfuz<-readRDS("site.dist.cfuz.rds")
#saveRDS(vasc.abd1.cfuz, file="vasc.abd1.cfuz.rds")
vasc.abd1.cfuz<-readRDS("vasc.abd1.cfuz.rds")
#saveRDS(vasc.ph.abd1.cfuz, file="vasc.ph.abd1.cfuz.rds")
vasc.ph.abd1.cfuz<-readRDS("vasc.ph.abd1.cfuz.rds")
#saveRDS(angio.abd1.cfuz, file="angio.abd1.cfuz.rds")
angio.abd1.cfuz<-readRDS("angio.abd1.cfuz.rds")
#saveRDS(angio.ph.abd1.cfuz, file="angio.ph.abd1.cfuz.rds")
angio.ph.abd1.cfuz<-readRDS("angio.ph.abd1.cfuz.rds")
Cluster order: 1) Environmental distance 2) All vasculars - beta diversity 3) All vasculars - phylogenetic beta diversity 4) Angiosperms - beta diversity 5) Angiosperms - phylogenetic beta diversity
#dev.new(width=11.8, height=8)
par(mfrow=c(2,3))
# Environmental distances - 5 clusters - plot
#site.dist.cfuz<-fanny(site.env.dist, 5, memb.exp=1.5)
ordiplot(site.dist.ord, dis="si", type="n")
stars(site.dist.cfuz$membership, locatio=site.dist.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(site.dist.ord, site.dist.cfuz$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#vasc.abd1.cfuz<-fanny(vasc.abd1.dist.small, 5, memb.exp=1.5)
ordiplot(vasc.abd1.ord, dis="si", type="n")
stars(vasc.abd1.cfuz$membership, locatio=vasc.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(vasc.abd1.ord, vasc.abd1.cfuz$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#vasc.ph.abd1.cfuz<-fanny(vasc.ph.abd1.dist.small, 5, memb.exp=1.5)
ordiplot(vasc.ph.abd1.ord, dis="si", type="n")
stars(vasc.ph.abd1.cfuz$membership, locatio=vasc.ph.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(vasc.ph.abd1.ord, vasc.ph.abd1.cfuz$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#angio.abd1.cfuz<-fanny(angio.abd1.dist.small, 5, memb.exp=1.5)
ordiplot(angio.abd1.ord, dis="si", type="n")
stars(angio.abd1.cfuz$membership, locatio=angio.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(angio.abd1.ord, angio.abd1.cfuz$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#angio.ph.abd1.cfuz<-fanny(angio.ph.abd1.dist.small, 5, memb.exp=1.5)
ordiplot(angio.ph.abd1.ord, dis="si", type="n")
stars(angio.ph.abd1.cfuz$membership, locatio=angio.ph.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(angio.ph.abd1.ord, angio.ph.abd1.cfuz$clustering, col="grey30")
#textClick("(A)", cex=1.75)
#textClick("(B)", cex=1.75)
#textClick("(C)", cex=1.75)
#textClick("(D)", cex=1.75)
#textClick("(E)", cex=1.75)
#Choose maximum value for each cluster
max.site.env<-apply(site.dist.cfuz$membership, 1, max)
max.vasc.abd1<-apply(vasc.abd1.cfuz$membership,1, max)
max.ph.vasc.abd1<-apply(vasc.ph.abd1.cfuz$membership,1, max)
max.angio.abd1<-apply(angio.abd1.cfuz$membership,1, max)
max.ph.angio.abd1<-apply(angio.ph.abd1.cfuz$membership,1, max)
#Box plot of maximum values
#dev.new(width=5.9, height=5.9)
boxplot(max.site.env, max.vasc.abd1, max.ph.vasc.abd1, max.angio.abd1, max.ph.angio.abd1, col=c("grey15", "grey65", "grey30", "grey80", "grey50"),
cex.axis=1.15, cex.lab=1.3,yaxt="n", xaxt = "n",ylab="Support for membership in primary fuzzy cluster", frame=F)
axis(
1, # puts the axis at the bottom
at=1:5, # labels will be placed in the 3 categories
labels=c("Site\nEnv.", "Vasc.\nBD", "Vasc.\nPhBD", "Angio.\nBD", "Angio.\nPhBD"), # labels will be the 3 genera
lwd=0, # width of the long axis line is zero, makes invisible
# width of the etick lines also zero, makes them invisible
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,2,0) # middle zero controls distance of labels from axis
)
axis(
2,
#at=c(-4,-3,-2,-1,0,1,2,3,4),
#ylim=c(-1,1.5),
lwd=2, # width of the long axis line is zero, makes invisible
lwd.ticks=0.1, # width of the etick lines also zero, makes them invisible
tck=0.02,
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,0.75,0) # middle zero controls distance of labels from axis
)
abline(h=0, col="grey20", lty=2)
#Box plot of maximum values for only angiosperms
#dev.new(width=5.9, height=5.9)
boxplot(max.site.env, max.angio.abd1, max.ph.angio.abd1, col=c("grey15", "grey80", "grey50"),
cex.axis=1.15, cex.lab=1.3,yaxt="n", xaxt = "n",ylab="Highest membership coefficient across all clusters", frame=F)
axis(
1, # puts the axis at the bottom
at=1:3, # labels will be placed in the 3 categories
labels=c("Site\nEnv.", "Angio.\nBD", "Angio.\nPhBD"), # labels will be the 3 genera
lwd=0, # width of the long axis line is zero, makes invisible
# width of the etick lines also zero, makes them invisible
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,2,0) # middle zero controls distance of labels from axis
)
axis(
2,
#at=c(-4,-3,-2,-1,0,1,2,3,4),
ylim=c(0,1),
lwd=2, # width of the long axis line is zero, makes invisible
lwd.ticks=0.1, # width of the etick lines also zero, makes them invisible
tck=0.02,
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,0.75,0) # middle zero controls distance of labels from axis
)
abline(h=0, col="grey20", lty=2)
library(reshape)
## Warning: package 'reshape' was built under R version 3.1.1
max.combined<-cbind(max.site.env, max.vasc.abd1, max.ph.vasc.abd1, max.angio.abd1, max.ph.angio.abd1)
colnames(max.combined)<-c("Site Env.", "Vasc.BD", "Vasc.PhBD", "Angio.BD", "Angio.PhBD")
max.combined.one.col<-melt(max.combined)
colnames(max.combined.one.col)<-c("Plot.number", "Measurement", "Max.Support")
#Compare with Tukey test: we can use this because there are a similar number of measurements per measurement type
(max.combined.aov <- aov(max.combined.one.col$Max.Support~ max.combined.one.col$Measurement))
## Call:
## aov(formula = max.combined.one.col$Max.Support ~ max.combined.one.col$Measurement)
##
## Terms:
## max.combined.one.col$Measurement Residuals
## Sum of Squares 25.81591 22.19737
## Deg. of Freedom 4 875
##
## Residual standard error: 0.1592747
## Estimated effects may be unbalanced
summary(max.combined.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## max.combined.one.col$Measurement 4 25.82 6.454 254.4 <2e-16 ***
## Residuals 875 22.20 0.025
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(posthoc.max.combined <- TukeyHSD(x=max.combined.aov, 'max.combined.one.col$Measurement', conf.level=0.95))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = max.combined.one.col$Max.Support ~ max.combined.one.col$Measurement)
##
## $`max.combined.one.col$Measurement`
## diff lwr upr p adj
## Angio.PhBD-Angio.BD 0.31771836 0.27130743 0.36412930 0.0000000
## Site Env.-Angio.BD 0.32224488 0.27583395 0.36865582 0.0000000
## Vasc.BD-Angio.BD -0.10233081 -0.14874175 -0.05591988 0.0000000
## Vasc.PhBD-Angio.BD 0.20227869 0.15586775 0.24868962 0.0000000
## Site Env.-Angio.PhBD 0.00452652 -0.04188442 0.05093746 0.9988904
## Vasc.BD-Angio.PhBD -0.42004917 -0.46646011 -0.37363824 0.0000000
## Vasc.PhBD-Angio.PhBD -0.11543968 -0.16185061 -0.06902874 0.0000000
## Vasc.BD-Site Env. -0.42457569 -0.47098663 -0.37816476 0.0000000
## Vasc.PhBD-Site Env. -0.11996620 -0.16637713 -0.07355526 0.0000000
## Vasc.PhBD-Vasc.BD 0.30460950 0.25819856 0.35102043 0.0000000
summary(posthoc.max.combined)
## Length Class Mode
## max.combined.one.col$Measurement 40 -none- numeric
#Examine for only angiosperms
max.combined.angio<-cbind(max.site.env, max.angio.abd1, max.ph.angio.abd1)
colnames(max.combined.angio)<-c("Site Env.", "Angio.BD", "Angio.PhBD")
max.combined.angio.one.col<-melt(max.combined.angio)
colnames(max.combined.angio.one.col)<-c("Plot.number", "Measurement", "Max.Support")
#Compare with Tukey test: we can use this because there are a similar number of measurements per measurement type
(max.combined.angio.aov <- aov(max.combined.angio.one.col$Max.Support~ max.combined.angio.one.col$Measurement))
## Call:
## aov(formula = max.combined.angio.one.col$Max.Support ~ max.combined.angio.one.col$Measurement)
##
## Terms:
## max.combined.angio.one.col$Measurement Residuals
## Sum of Squares 12.01536 14.77798
## Deg. of Freedom 2 525
##
## Residual standard error: 0.1677753
## Estimated effects may be unbalanced
summary(max.combined.angio.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## max.combined.angio.one.col$Measurement 2 12.02 6.008 213.4 <2e-16
## Residuals 525 14.78 0.028
##
## max.combined.angio.one.col$Measurement ***
## Residuals
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(posthoc.max.combined.angio <- TukeyHSD(x=max.combined.angio.aov, 'max.combined.angio.one.col$Measurement', conf.level=0.95))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = max.combined.angio.one.col$Max.Support ~ max.combined.angio.one.col$Measurement)
##
## $`max.combined.angio.one.col$Measurement`
## diff lwr upr p adj
## Angio.PhBD-Angio.BD 0.31771836 0.27568209 0.3597546 0.0000000
## Site Env.-Angio.BD 0.32224488 0.28020860 0.3642812 0.0000000
## Site Env.-Angio.PhBD 0.00452652 -0.03750976 0.0465628 0.9653077
summary(posthoc.max.combined.angio)
## Length Class Mode
## max.combined.angio.one.col$Measurement 12 -none- numeric
Cluster order: 1) Environmental distance 2) All vasculars - beta diversity 3) All vasculars - phylogenetic beta diversity 4) Angiosperms - beta diversity 5) Angiosperms - phylogenetic beta diversity
#dev.new(width=11.8, height=8)
par(mfrow=c(2,3))
# Environmental distances - 3 clusters - plot
#saveRDS(site.dist.cfuz.3, file="site.dist.cfuz.3.rds")
site.dist.cfuz.3<-readRDS("site.dist.cfuz.3.rds")
#saveRDS(vasc.abd1.cfuz.3, file="vasc.abd1.cfuz.3.rds")
vasc.abd1.cfuz.3<-readRDS("vasc.abd1.cfuz.3.rds")
#saveRDS(vasc.ph.abd1.cfuz.3, file="vasc.ph.abd1.cfuz.3.rds")
vasc.ph.abd1.cfuz.3<-readRDS("vasc.ph.abd1.cfuz.3.rds")
#saveRDS(angio.abd1.cfuz.3, file="angio.abd1.cfuz.3.rds")
angio.abd1.cfuz.3<-readRDS("angio.abd1.cfuz.3.rds")
#saveRDS(angio.ph.abd1.cfuz.3, file="angio.ph.abd1.cfuz.3.rds")
angio.ph.abd1.cfuz.3<-readRDS("angio.ph.abd1.cfuz.3.rds")
#dev.new(width=11.8, height=8)
par(mfrow=c(2,3))
# Environmental distances - 5 clusters - plot
#site.dist.cfuz.3<-fanny(site.env.dist, 3, memb.exp=1.40)
ordiplot(site.dist.ord, dis="si", type="n")
stars(site.dist.cfuz.3$membership, locatio=site.dist.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(site.dist.ord, site.dist.cfuz.3$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#vasc.abd1.cfuz.3<-fanny(vasc.abd1.dist.small, 3, memb.exp=1.40)
ordiplot(vasc.abd1.ord, dis="si", type="n")
stars(vasc.abd1.cfuz.3$membership, locatio=vasc.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(vasc.abd1.ord, vasc.abd1.cfuz.3$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#vasc.ph.abd1.cfuz.3<-fanny(vasc.ph.abd1.dist.small, 3, memb.exp=1.4)
ordiplot(vasc.ph.abd1.ord, dis="si", type="n")
stars(vasc.ph.abd1.cfuz.3$membership, locatio=vasc.ph.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(vasc.ph.abd1.ord, vasc.ph.abd1.cfuz.3$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#angio.abd1.cfuz.3<-fanny(angio.abd1.dist.small, 3, memb.exp=1.4)
ordiplot(angio.abd1.ord, dis="si", type="n")
stars(angio.abd1.cfuz.3$membership, locatio=angio.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(angio.abd1.ord, angio.abd1.cfuz.3$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#angio.ph.abd1.cfuz.3<-fanny(angio.ph.abd1.dist.small, 3, memb.exp=1.4)
ordiplot(angio.ph.abd1.ord, dis="si", type="n")
stars(angio.ph.abd1.cfuz.3$membership, locatio=angio.ph.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(angio.ph.abd1.ord, angio.ph.abd1.cfuz.3$clustering, col="grey30")
#textClick("(A)", cex=1.75)
#textClick("(B)", cex=1.75)
#textClick("(C)", cex=1.75)
#textClick("(D)", cex=1.75)
#textClick("(E)", cex=1.75)
#Choose maximum value for each cluster
max.site.env.3<-apply(site.dist.cfuz.3$membership, 1, max)
max.vasc.abd1.3<-apply(vasc.abd1.cfuz.3$membership,1, max)
max.ph.vasc.abd1.3<-apply(vasc.ph.abd1.cfuz.3$membership,1, max)
max.angio.abd1.3<-apply(angio.abd1.cfuz.3$membership,1, max)
max.ph.angio.abd1.3<-apply(angio.ph.abd1.cfuz.3$membership,1, max)
library(reshape)
max.combined.3<-cbind(max.site.env.3, max.vasc.abd1.3, max.ph.vasc.abd1.3, max.angio.abd1.3, max.ph.angio.abd1.3)
colnames(max.combined.3)<-c("Site Env.", "Vasc.BD", "Vasc.PhBD", "Angio.BD", "Angio.PhBD")
max.combined.one.col.3<-melt(max.combined.3)
colnames(max.combined.one.col.3)<-c("Plot.number", "Measurement", "Max.Support")
#Compare with Tukey test: we can use this because there are a similar number of measurements per measurement type
(max.combined.aov.3 <- aov(max.combined.one.col.3$Max.Support~ max.combined.one.col.3$Measurement))
## Call:
## aov(formula = max.combined.one.col.3$Max.Support ~ max.combined.one.col.3$Measurement)
##
## Terms:
## max.combined.one.col.3$Measurement Residuals
## Sum of Squares 11.12712 19.21176
## Deg. of Freedom 4 875
##
## Residual standard error: 0.1481766
## Estimated effects may be unbalanced
summary(max.combined.aov.3)
## Df Sum Sq Mean Sq F value Pr(>F)
## max.combined.one.col.3$Measurement 4 11.13 2.782 126.7 <2e-16 ***
## Residuals 875 19.21 0.022
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(posthoc.max.combined.3 <- TukeyHSD(x=max.combined.aov.3, 'max.combined.one.col.3$Measurement', conf.level=0.95))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = max.combined.one.col.3$Max.Support ~ max.combined.one.col.3$Measurement)
##
## $`max.combined.one.col.3$Measurement`
## diff lwr upr p adj
## Angio.PhBD-Angio.BD 0.21565622 0.172479146 0.25883329 0.0000000
## Site Env.-Angio.BD 0.26272052 0.219543448 0.30589759 0.0000000
## Vasc.BD-Angio.BD -0.01900801 -0.062185085 0.02416906 0.7494641
## Vasc.PhBD-Angio.BD 0.10446302 0.061285949 0.14764009 0.0000000
## Site Env.-Angio.PhBD 0.04706430 0.003887231 0.09024137 0.0246787
## Vasc.BD-Angio.PhBD -0.23466423 -0.277841302 -0.19148716 0.0000000
## Vasc.PhBD-Angio.PhBD -0.11119320 -0.154370268 -0.06801613 0.0000000
## Vasc.BD-Site Env. -0.28172853 -0.324905603 -0.23855146 0.0000000
## Vasc.PhBD-Site Env. -0.15825750 -0.201434570 -0.11508043 0.0000000
## Vasc.PhBD-Vasc.BD 0.12347103 0.080293963 0.16664810 0.0000000
summary(posthoc.max.combined.3)
## Length Class Mode
## max.combined.one.col.3$Measurement 40 -none- numeric
Cluster order: 1) Environmental distance 2) All vasculars - beta diversity 3) All vasculars - phylogenetic beta diversity 4) Angiosperms - beta diversity 5) Angiosperms - phylogenetic beta diversity
#dev.new(width=11.8, height=8)
par(mfrow=c(2,3))
# Environmental distances - 5 clusters - plot
#saveRDS(site.dist.cfuz.7, file="site.dist.cfuz.7.rds")
site.dist.cfuz.7<-readRDS("site.dist.cfuz.7.rds")
#saveRDS(vasc.abd1.cfuz.7, file="vasc.abd1.cfuz.7.rds")
vasc.abd1.cfuz.7<-readRDS("vasc.abd1.cfuz.7.rds")
#saveRDS(vasc.ph.abd1.cfuz.7, file="vasc.ph.abd1.cfuz.7.rds")
vasc.ph.abd1.cfuz.7<-readRDS("vasc.ph.abd1.cfuz.7.rds")
#saveRDS(angio.abd1.cfuz.7, file="angio.abd1.cfuz.7.rds")
angio.abd1.cfuz.7<-readRDS("angio.abd1.cfuz.7.rds")
#saveRDS(angio.ph.abd1.cfuz.7, file="angio.ph.abd1.cfuz.7.rds")
angio.ph.abd1.cfuz.7<-readRDS("angio.ph.abd1.cfuz.7.rds")
#dev.new(width=11.8, height=8)
par(mfrow=c(2,3))
# Environmental distances - 5 clusters - plot
#site.dist.cfuz.7<-fanny(site.env.dist, 7, memb.exp=1.40)
ordiplot(site.dist.ord, dis="si", type="n")
stars(site.dist.cfuz.7$membership, locatio=site.dist.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(site.dist.ord, site.dist.cfuz.7$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
vasc.abd1.cfuz.7<-fanny(vasc.abd1.dist.small, 7, memb.exp=1.40)
ordiplot(vasc.abd1.ord, dis="si", type="n")
stars(vasc.abd1.cfuz.7$membership, locatio=vasc.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(vasc.abd1.ord, vasc.abd1.cfuz.7$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#vasc.ph.abd1.cfuz.7<-fanny(vasc.ph.abd1.dist.small, 7, memb.exp=1.4)
ordiplot(vasc.ph.abd1.ord, dis="si", type="n")
stars(vasc.ph.abd1.cfuz.7$membership, locatio=vasc.ph.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(vasc.ph.abd1.ord, vasc.ph.abd1.cfuz.7$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#angio.abd1.cfuz.7<-fanny(angio.abd1.dist.small, 7, memb.exp=1.4)
ordiplot(angio.abd1.ord, dis="si", type="n")
stars(angio.abd1.cfuz.7$membership, locatio=angio.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(angio.abd1.ord, angio.abd1.cfuz.7$clustering, col="grey30")
# Vascular beta diversity - 5 clusters - plot
#angio.ph.abd1.cfuz.7<-fanny(angio.ph.abd1.dist.small, 7, memb.exp=1.4)
ordiplot(angio.ph.abd1.ord, dis="si", type="n")
stars(angio.ph.abd1.cfuz.7$membership, locatio=angio.ph.abd1.ord, draw.segm=TRUE, add=TRUE, scale=FALSE, len=0.1)
ordihull(angio.ph.abd1.ord, angio.ph.abd1.cfuz.7$clustering, col="grey30")
#textClick("(A)", cex=1.75)
#textClick("(B)", cex=1.75)
#textClick("(C)", cex=1.75)
#textClick("(D)", cex=1.75)
#textClick("(E)", cex=1.75)
#Choose maximum value for each cluster
max.site.env.7<-apply(site.dist.cfuz.7$membership, 1, max)
max.vasc.abd1.7<-apply(vasc.abd1.cfuz.7$membership,1, max)
max.ph.vasc.abd1.7<-apply(vasc.ph.abd1.cfuz.7$membership,1, max)
max.angio.abd1.7<-apply(angio.abd1.cfuz.7$membership,1, max)
max.ph.angio.abd1.7<-apply(angio.ph.abd1.cfuz.7$membership,1, max)
#Box plot of maximum values
#dev.new(width=11.8, height=5.9)
par(mfrow=c(1,2))
par(mai=c(1.25,1,1.25, 0.75))
boxplot(max.site.env.3, max.vasc.abd1.3, max.ph.vasc.abd1.3, max.angio.abd1.3, max.ph.angio.abd1.3, col=c("grey15", "grey65", "grey30", "grey80", "grey50"),
cex.axis=1.15, cex.lab=1.3,yaxt="n", xaxt = "n",ylab="Support for membership in primary fuzzy cluster", frame=F)
axis(
1, # puts the axis at the bottom
at=1:5, # labels will be placed in the 3 categories
labels=c("Site\nEnv.", "Vasc.\nBD", "Vasc.\nPhBD", "Angio.\nBD", "Angio.\nPhBD"), # labels will be the 3 genera
lwd=0, # width of the long axis line is zero, makes invisible
# width of the etick lines also zero, makes them invisible
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,2,0) # middle zero controls distance of labels from axis
)
axis(
2,
#at=c(-4,-3,-2,-1,0,1,2,3,4),
#ylim=c(-1,1.5),
lwd=2, # width of the long axis line is zero, makes invisible
lwd.ticks=0.1, # width of the etick lines also zero, makes them invisible
tck=0.02,
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,0.75,0) # middle zero controls distance of labels from axis
)
abline(h=0, col="grey20", lty=2)
boxplot(max.site.env.7, max.vasc.abd1.7, max.ph.vasc.abd1.7, max.angio.abd1.7, max.ph.angio.abd1.7, col=c("grey15", "grey65", "grey30", "grey80", "grey50"),
cex.axis=1.15, cex.lab=1.3,yaxt="n", xaxt = "n",ylab="Support for membership in primary fuzzy cluster", frame=F)
axis(
1, # puts the axis at the bottom
at=1:5, # labels will be placed in the 3 categories
labels=c("Site\nEnv.", "Vasc.\nBD", "Vasc.\nPhBD", "Angio.\nBD", "Angio.\nPhBD"), # labels will be the 3 genera
lwd=0, # width of the long axis line is zero, makes invisible
# width of the etick lines also zero, makes them invisible
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,2,0) # middle zero controls distance of labels from axis
)
axis(
2,
#at=c(-4,-3,-2,-1,0,1,2,3,4),
#ylim=c(-1,1.5),
lwd=2, # width of the long axis line is zero, makes invisible
lwd.ticks=0.1, # width of the etick lines also zero, makes them invisible
tck=0.02,
cex.axis=1.15, # offset from the axis of the labels
cex.lab=1.3,
mgp=c(0,0.75,0) # middle zero controls distance of labels from axis
)
abline(h=0, col="grey20", lty=2)
#textClick("(A)", cex=1.75)
#textClick("(B)", cex=1.75)
library(reshape)
max.combined.7<-cbind(max.site.env.7, max.vasc.abd1.7, max.ph.vasc.abd1.7, max.angio.abd1.7, max.ph.angio.abd1.7)
colnames(max.combined.7)<-c("Site Env.", "Vasc.BD", "Vasc.PhBD", "Angio.BD", "Angio.PhBD")
max.combined.one.col.7<-melt(max.combined.7)
colnames(max.combined.one.col.7)<-c("Plot.number", "Measurement", "Max.Support")
#Compare with Tukey test: we can use this because there are a similar number of measurements per measurement type
(max.combined.aov.7 <- aov(max.combined.one.col.7$Max.Support~ max.combined.one.col.7$Measurement))
## Call:
## aov(formula = max.combined.one.col.7$Max.Support ~ max.combined.one.col.7$Measurement)
##
## Terms:
## max.combined.one.col.7$Measurement Residuals
## Sum of Squares 17.80252 37.67391
## Deg. of Freedom 4 875
##
## Residual standard error: 0.2074992
## Estimated effects may be unbalanced
summary(max.combined.aov.7)
## Df Sum Sq Mean Sq F value Pr(>F)
## max.combined.one.col.7$Measurement 4 17.80 4.451 103.4 <2e-16 ***
## Residuals 875 37.67 0.043
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(posthoc.max.combined.7 <- TukeyHSD(x=max.combined.aov.7, 'max.combined.one.col.7$Measurement', conf.level=0.95))
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = max.combined.one.col.7$Max.Support ~ max.combined.one.col.7$Measurement)
##
## $`max.combined.one.col.7$Measurement`
## diff lwr upr p adj
## Angio.PhBD-Angio.BD 0.30256875 0.24210572 0.36303178 0.0000000
## Site Env.-Angio.BD 0.33634100 0.27587797 0.39680403 0.0000000
## Vasc.BD-Angio.BD 0.02401227 -0.03645076 0.08447530 0.8140325
## Vasc.PhBD-Angio.BD 0.25063783 0.19017480 0.31110086 0.0000000
## Site Env.-Angio.PhBD 0.03377225 -0.02669078 0.09423528 0.5452327
## Vasc.BD-Angio.PhBD -0.27855648 -0.33901951 -0.21809345 0.0000000
## Vasc.PhBD-Angio.PhBD -0.05193092 -0.11239395 0.00853211 0.1310356
## Vasc.BD-Site Env. -0.31232873 -0.37279175 -0.25186570 0.0000000
## Vasc.PhBD-Site Env. -0.08570317 -0.14616620 -0.02524014 0.0010843
## Vasc.PhBD-Vasc.BD 0.22662556 0.16616253 0.28708859 0.0000000
summary(posthoc.max.combined.7)
## Length Class Mode
## max.combined.one.col.7$Measurement 40 -none- numeric
library(letsR)
## Loading required package: raster
## Loading required package: sp
##
## Attaching package: 'raster'
##
## The following objects are masked from 'package:MASS':
##
## area, select
##
## The following object is masked from 'package:geiger':
##
## hdr
##
## The following object is masked from 'package:nlme':
##
## getData
##
## The following object is masked from 'package:magic':
##
## shift
##
## The following objects are masked from 'package:ape':
##
## rotate, zoom
library(geosphere)
#site.dist.cfuz.3$clustering
#vasc.abd1.cfuz.3$clustering
#vasc.ph.abd1.cfuz.3$clustering
#angio.abd1.cfuz.3$clustering
#angio.ph.abd1.cfuz.3$clustering
# Calculate distances - use Gower's
grid.xy.comb<-cbind(site.lat, site.lon)
grid.xy<-distm(grid.xy.comb)
par(mfrow=c(2,3))
site.dist.correl<-lets.correl(site.dist.cfuz$clustering, grid.xy, 16, equidistant = FALSE, plot = TRUE)
vasc.abd1.i.correl<-lets.correl(vasc.abd1.cfuz$clustering, grid.xy, 16, equidistant = FALSE, plot = TRUE)
vasc.ph.abd1.i.correl<-lets.correl(vasc.ph.abd1.cfuz$clustering, grid.xy, 16, equidistant = FALSE, plot = TRUE)
angio.abd1.i.correl<-lets.correl(angio.abd1.cfuz$clustering, grid.xy, 16, equidistant = FALSE, plot = TRUE)
angio.ph.abd1.i.correl<-lets.correl(angio.ph.abd1.cfuz$clustering, grid.xy, 16, equidistant = FALSE, plot = TRUE)
site.dist.i<-site.dist.correl[,1]
vasc.abd1.i<-vasc.abd1.i.correl[,1]
vasc.ph.abd1.i<-vasc.ph.abd1.i.correl[,1]
angio.abd1.i<-angio.abd1.i.correl[,1]
angio.ph.abd1.i<-angio.ph.abd1.i.correl[,1]
bin.dist<-site.dist.correl[,5]
bin<-rownames(site.dist.i)
mean.dist<-round(site.dist.correl[,5],2)
count<-site.dist.correl[,6]
site.dist.i.p<-round(site.dist.correl[,4],3)
vasc.abd1.i.p<-round(vasc.abd1.i.correl[,4],3)
vasc.ph.abd1.i.p<-round(vasc.ph.abd1.i.correl[,4],3)
angio.abd1.i.p<-round(angio.abd1.i.correl[,4], 3)
angio.ph.abd1.i.p<-round(angio.ph.abd1.i.correl[,4], 3)
(moran.i.sign<-cbind(bin, mean.dist, count, site.dist.i.p, vasc.abd1.i.p, vasc.ph.abd1.i.p, angio.abd1.i.p, angio.ph.abd1.i.p))
## mean.dist count site.dist.i.p vasc.abd1.i.p vasc.ph.abd1.i.p
## [1,] 96.74 1926 0.000 0.000 0.000
## [2,] 198.62 1924 0.000 0.000 0.000
## [3,] 272.69 1926 0.000 0.210 0.028
## [4,] 336.51 1924 0.000 0.055 0.982
## [5,] 395.40 1926 0.000 0.080 0.516
## [6,] 456.60 1924 0.000 0.096 0.309
## [7,] 517.77 1926 0.002 0.395 0.366
## [8,] 583.27 1924 0.767 0.207 0.863
## [9,] 655.12 1926 0.752 0.900 0.593
## [10,] 733.57 1924 0.743 0.826 0.560
## [11,] 821.21 1926 0.002 0.078 0.729
## [12,] 921.79 1924 0.000 0.904 0.575
## [13,] 1040.01 1926 0.000 0.411 0.063
## [14,] 1185.67 1924 0.000 0.003 0.000
## [15,] 1388.76 1926 0.000 0.000 0.000
## [16,] 2080.00 1924 0.000 0.000 0.000
## angio.abd1.i.p angio.ph.abd1.i.p
## [1,] 0.000 0.000
## [2,] 0.000 0.000
## [3,] 0.012 0.127
## [4,] 0.000 0.506
## [5,] 0.458 0.611
## [6,] 0.620 0.088
## [7,] 0.849 0.197
## [8,] 0.018 0.176
## [9,] 0.981 0.733
## [10,] 0.860 0.348
## [11,] 0.573 0.421
## [12,] 0.624 0.293
## [13,] 0.060 0.237
## [14,] 0.061 0.038
## [15,] 0.001 0.000
## [16,] 0.000 0.016
# Plots showing Moran's I for five clusters
#dev.new(width=11.8, height=5.9)
par(mfrow=c(1,2))
plot(bin.dist, site.dist.i, type="l",axes=TRUE, cex=1, pch=16, col="grey15",ylab=expression(paste("Moran's ", italic("I"))), xlab="Distance (m)", las=1, cex.axis=1, cex.lab=1.2, ylim=c(-1,1),
cex.main=0.85, bty="l", lwd=2)
points(bin.dist,vasc.abd1.i, type="l",col="gray65", lwd=2)
points(bin.dist,vasc.ph.abd1.i, type="l",col="gray30", lwd=2)
abline(h=0, lwd=1, lty=2)
legend("bottomleft", c("Site Env.", "Vasc.BD", "Vasc.PhBD"), col = c("grey15","grey65", "grey30" ), cex=1.1,
lty = c(1, 1, 1), pch = c(NA, NA, NA), lwd=3 , bg = "white", bty="n")
box(bty="l", lwd=3)
plot(bin.dist, site.dist.i, type="l",axes=TRUE, cex=1, pch=16, col="grey15",ylab=expression(paste("Moran's ", italic("I"))), xlab="Distance (m)", las=1, cex.axis=1, cex.lab=1.2, ylim=c(-1,1),
cex.main=0.85, bty="l", lwd=2)
points(bin.dist,angio.abd1.i, type="l",col="gray80", lwd=2)
points(bin.dist,angio.ph.abd1.i, type="l",col="gray50", lwd=2)
abline(h=0, lwd=1, lty=2)
legend("bottomleft", c("Site Env.", "Angio.BD", "Angio.PhBD"), col = c("grey15","grey80", "grey50" ), cex=1.1,
lty = c(1, 1, 1), pch = c(NA, NA, NA), lwd=3 , bg = "white", bty="n")
box(bty="l", lwd=3)
#textClick("(A)", cex=1.75)
#textClick("(B)", cex=1.75)
(moran.i.sign.3<-cbind(bin, mean.dist, count, site.dist.3.i.p, vasc.abd1.3.i.p, vasc.ph.abd1.3.i.p, angio.abd1.3.i.p, angio.ph.abd1.3.i.p))
## mean.dist count site.dist.3.i.p vasc.abd1.3.i.p vasc.ph.abd1.3.i.p
## [1,] 96.74 1926 0.000 0.000 0.000
## [2,] 198.62 1924 0.000 0.000 0.000
## [3,] 272.69 1926 0.000 0.000 0.000
## [4,] 336.51 1924 0.000 0.000 0.001
## [5,] 395.40 1926 0.000 0.523 0.000
## [6,] 456.60 1924 0.000 0.206 0.174
## [7,] 517.77 1926 0.084 0.114 0.216
## [8,] 583.27 1924 0.325 0.043 0.090
## [9,] 655.12 1926 0.560 0.497 0.237
## [10,] 733.57 1924 0.619 0.541 0.950
## [11,] 821.21 1926 0.024 0.162 0.360
## [12,] 921.79 1924 0.000 0.644 0.205
## [13,] 1040.01 1926 0.000 0.477 0.000
## [14,] 1185.67 1924 0.000 0.000 0.000
## [15,] 1388.76 1926 0.000 0.000 0.000
## [16,] 2080.00 1924 0.000 0.000 0.000
## angio.abd1.3.i.p angio.ph.abd1.3.i.p
## [1,] 0.000 0.000
## [2,] 0.017 0.000
## [3,] 0.081 0.025
## [4,] 0.176 0.283
## [5,] 0.423 0.608
## [6,] 0.518 0.197
## [7,] 0.797 0.422
## [8,] 0.125 0.498
## [9,] 0.688 0.804
## [10,] 0.790 0.524
## [11,] 0.286 0.411
## [12,] 0.861 0.878
## [13,] 0.483 0.180
## [14,] 0.138 0.143
## [15,] 0.003 0.000
## [16,] 0.002 0.002
(moran.i.sign.7<-cbind(bin, mean.dist, count, site.dist.7.i.p, vasc.abd1.7.i.p, vasc.ph.abd1.7.i.p, angio.abd1.7.i.p, angio.ph.abd1.7.i.p))
## mean.dist count site.dist.7.i.p vasc.abd1.7.i.p vasc.ph.abd1.7.i.p
## [1,] 96.74 1926 0.000 0.000 0.000
## [2,] 198.62 1924 0.000 0.000 0.000
## [3,] 272.69 1926 0.000 0.000 0.012
## [4,] 336.51 1924 0.000 0.000 0.595
## [5,] 395.40 1926 0.000 0.000 0.246
## [6,] 456.60 1924 0.000 0.156 0.827
## [7,] 517.77 1926 0.006 0.415 0.874
## [8,] 583.27 1924 0.813 0.480 0.309
## [9,] 655.12 1926 0.825 0.385 0.722
## [10,] 733.57 1924 0.886 0.660 0.953
## [11,] 821.21 1926 0.013 0.351 0.420
## [12,] 921.79 1924 0.000 0.038 0.418
## [13,] 1040.01 1926 0.000 0.000 0.004
## [14,] 1185.67 1924 0.000 0.000 0.000
## [15,] 1388.76 1926 0.000 0.000 0.000
## [16,] 2080.00 1924 0.000 0.000 0.010
## angio.abd1.7.i.p angio.ph.abd1.7.i.p
## [1,] 0.000 0.000
## [2,] 0.000 0.000
## [3,] 0.000 0.002
## [4,] 0.000 0.028
## [5,] 0.000 0.498
## [6,] 0.005 0.032
## [7,] 0.076 0.143
## [8,] 0.442 0.000
## [9,] 0.524 0.506
## [10,] 0.890 0.561
## [11,] 0.582 0.165
## [12,] 0.009 0.836
## [13,] 0.000 0.142
## [14,] 0.000 0.008
## [15,] 0.000 0.000
## [16,] 0.000 0.051
# Plots showing Moran's I
#dev.new(width=11.8, height=11.8)
par(mfrow=c(2,2))
plot(bin.dist, site.dist.3.i, type="l",axes=TRUE, cex=1, pch=16, col="grey15",ylab=expression(paste("Moran's ", italic("I"))), xlab="Distance (m)", las=1, cex.axis=1, cex.lab=1.2, ylim=c(-1,1),
cex.main=0.85, bty="l", lwd=2)
points(bin.dist,vasc.abd1.3.i, type="l",col="gray65", lwd=2)
points(bin.dist,vasc.ph.abd1.3.i, type="l",col="gray30", lwd=2)
abline(h=0, lwd=1, lty=2)
legend("bottomleft", c("Site Env.", "Vasc.BD", "Vasc.PhBD"), col = c("grey15","grey65", "grey30" ), cex=1.1,
lty = c(1, 1, 1), pch = c(NA, NA, NA), lwd=3 , bg = "white", bty="n")
box(bty="l", lwd=3)
plot(bin.dist, site.dist.3.i, type="l",axes=TRUE, cex=1, pch=16, col="grey15",ylab=expression(paste("Moran's ", italic("I"))), xlab="Distance (m)", las=1, cex.axis=1, cex.lab=1.2, ylim=c(-1,1),
cex.main=0.85, bty="l", lwd=2)
points(bin.dist,angio.abd1.3.i, type="l",col="gray80", lwd=2)
points(bin.dist,angio.ph.abd1.3.i, type="l",col="gray50", lwd=2)
abline(h=0, lwd=1, lty=2)
legend("bottomleft", c("Site Env.", "Angio.BD", "Angio.PhBD"), col = c("grey15","grey80", "grey50" ), cex=1.1,
lty = c(1, 1, 1), pch = c(NA, NA, NA), lwd=3 , bg = "white", bty="n")
box(bty="l", lwd=3)
plot(bin.dist, site.dist.7.i, type="l",axes=TRUE, cex=1, pch=16, col="grey15",ylab=expression(paste("Moran's ", italic("I"))), xlab="Distance (m)", las=1, cex.axis=1, cex.lab=1.2, ylim=c(-1,1),
cex.main=0.85, bty="l", lwd=2)
points(bin.dist,vasc.abd1.7.i, type="l",col="gray65", lwd=2)
points(bin.dist,vasc.ph.abd1.7.i, type="l",col="gray30", lwd=2)
abline(h=0, lwd=1, lty=2)
legend("bottomleft", c("Site Env.", "Vasc.BD", "Vasc.PhBD"), col = c("grey15","grey65", "grey30" ), cex=1.1,
lty = c(1, 1, 1), pch = c(NA, NA, NA), lwd=3 , bg = "white", bty="n")
box(bty="l", lwd=3)
plot(bin.dist, site.dist.7.i, type="l",axes=TRUE, cex=1, pch=16, col="grey15",ylab=expression(paste("Moran's ", italic("I"))), xlab="Distance (m)", las=1, cex.axis=1, cex.lab=1.2, ylim=c(-1,1),
cex.main=0.85, bty="l", lwd=2)
points(bin.dist,angio.abd1.7.i, type="l",col="gray80", lwd=2)
points(bin.dist,angio.ph.abd1.7.i, type="l",col="gray50", lwd=2)
abline(h=0, lwd=1, lty=2)
legend("bottomleft", c("Site Env.", "Angio.BD", "Angio.PhBD"), col = c("grey15","grey80", "grey50" ), cex=1.1,
lty = c(1, 1, 1), pch = c(NA, NA, NA), lwd=3 , bg = "white", bty="n")
box(bty="l", lwd=3)
#textClick("(A)", cex=1.75)
#textClick("(B)", cex=1.75)
#textClick("(C)", cex=1.75)
#textClick("(D)", cex=1.75)
# Calculate Moran's I for each of the different clustering measures
site.dist.moran <- as.matrix(dist(cbind(site.lon, site.lat)))
site.dists.inv <- 1/site.dist.moran
diag(site.dists.inv) <- 0
# global Moran's I for five fuzzy clusters
(moran.i.site.dist<-Moran.I(site.dist.cfuz$clustering, site.dists.inv))
## $observed
## [1] 0.3396678
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.00698061
##
## $p.value
## [1] 0
(moran.i.vasc.abd1<-Moran.I(vasc.abd1.cfuz$clustering, site.dists.inv))
## $observed
## [1] 0.112909
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006979257
##
## $p.value
## [1] 0
(moran.i.vasc.ph.abd1<-Moran.I(vasc.ph.abd1.cfuz$clustering, site.dists.inv))
## $observed
## [1] 0.1054507
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006979294
##
## $p.value
## [1] 0
(moran.i.angio.abd1<-Moran.I(angio.abd1.cfuz$clustering, site.dists.inv))
## $observed
## [1] 0.08096499
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006980042
##
## $p.value
## [1] 0
(moran.i.angio.ph.abd1<-Moran.I(angio.ph.abd1.cfuz$clustering, site.dists.inv))
## $observed
## [1] 0.08178647
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.00697463
##
## $p.value
## [1] 0
# global Moran's I for three fuzzy clusters
(moran.i.site.dist.3<-Moran.I(site.dist.cfuz.3$clustering, site.dists.inv))
## $observed
## [1] 0.3295083
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006980927
##
## $p.value
## [1] 0
(moran.i.vasc.abd1.3<-Moran.I(vasc.abd1.cfuz.3$clustering, site.dists.inv))
## $observed
## [1] 0.1730467
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006985898
##
## $p.value
## [1] 0
(moran.i.vasc.ph.abd1.3<-Moran.I(vasc.ph.abd1.cfuz.3$clustering, site.dists.inv))
## $observed
## [1] 0.109113
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006980374
##
## $p.value
## [1] 0
(moran.i.angio.abd1.3<-Moran.I(angio.abd1.cfuz.3$clustering, site.dists.inv))
## $observed
## [1] 0.07170648
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006984696
##
## $p.value
## [1] 0
(moran.i.angio.ph.abd1.3<-Moran.I(angio.ph.abd1.cfuz.3$clustering, site.dists.inv))
## $observed
## [1] 0.07691404
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006979994
##
## $p.value
## [1] 0
# global Moran's I for seven fuzzy clusters
(moran.i.site.dist.7<-Moran.I(site.dist.cfuz.7$clustering, site.dists.inv))
## $observed
## [1] 0.3277354
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006975717
##
## $p.value
## [1] 0
(moran.i.vasc.abd1.7<-Moran.I(vasc.abd1.cfuz.7$clustering, site.dists.inv))
## $observed
## [1] 0.1180549
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006983507
##
## $p.value
## [1] 0
(moran.i.vasc.ph.abd1.7<-Moran.I(vasc.ph.abd1.cfuz.7$clustering, site.dists.inv))
## $observed
## [1] 0.08860929
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006978596
##
## $p.value
## [1] 0
(moran.i.angio.abd1.7<-Moran.I(angio.abd1.cfuz.7$clustering, site.dists.inv))
## $observed
## [1] 0.1148027
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006986079
##
## $p.value
## [1] 0
(moran.i.angio.ph.abd1.7<-Moran.I(angio.ph.abd1.cfuz.7$clustering, site.dists.inv))
## $observed
## [1] 0.08242697
##
## $expected
## [1] -0.005714286
##
## $sd
## [1] 0.006978131
##
## $p.value
## [1] 0
library(scatterplot3d)
## Warning: package 'scatterplot3d' was built under R version 3.1.3
site.coord<-cbind(site.lat, site.lon, site.elev)
library(plot3D)
## Warning: package 'plot3D' was built under R version 3.1.3
par(mfrow=c(1,3))
par(mar=c(1,2,1,1))
site.dist.5.3d<-with(site.coord, scatter3D(x = site.lon[,1], y = site.lat[,1], z = site.elev[,1], colvar = site.dist.cfuz$clustering,
col=c("grey95", "gray75", "gray60", "gray25", "black"),pch = 16, cex = 1.25, cex.lab=1.25, cex.axis=1,xlab = "Longitude", ylab = "Latitude",
zlab = "Elevation (m)",
main = "", ticktype = "simple", theta = 35, d = 5,
colkey = list(length = 0.25, width = 0.5, cex.clab = 0.65))
)
par(mar=c(1,2,1,1))
site.dist.5.3d<-with(site.coord, scatter3D(x = site.lon[,1], y = site.lat[,1], z = site.elev[,1], colvar = vasc.abd1.cfuz$clustering,
col=c("grey95", "gray75", "gray60", "gray25", "black"),pch = 16, cex = 1.25, cex.lab=1.25, cex.axis=1,xlab = "Longitude", ylab = "Latitude",
zlab = "Elevation (m)",
main = "", ticktype = "simple", theta = 35, d = 5,
colkey = list(length = 0.25, width = 0.5, cex.clab = 0.65))
)
par(mar=c(1,2,1,1))
site.dist.5.3d<-with(site.coord, scatter3D(x = site.lon[,1], y = site.lat[,1], z = site.elev[,1], colvar = vasc.ph.abd1.cfuz$clustering,
col=c("grey95", "gray75", "gray60", "gray25", "black"),pch = 16, cex = 1.25, cex.lab=1.25, cex.axis=1,xlab = "Longitude", ylab = "Latitude",
zlab = "Elevation (m)",
main = "", ticktype = "simple", theta = 35, d = 5,
colkey = list(length = 0.25, width = 0.5, cex.clab = 0.65))
)