library(plotrix)
library(car)
## Warning: package 'car' was built under R version 3.3.3
library(MASS)
## Warning: package 'MASS' was built under R version 3.3.3
library(vegan)
## Warning: package 'vegan' was built under R version 3.3.3
## Loading required package: permute
## Warning: package 'permute' was built under R version 3.3.3
## Loading required package: lattice
## This is vegan 2.4-2
setwd("C:/Users/theco/Desktop/")
FaunaData<-read.csv ("faunadataF.csv",header=TRUE)

FaunaData
##    block treatment Edwardsia.neozelanica Abarenicola.affinis
## 1      1     black                     0                   0
## 2      1      blue                     0                   0
## 3      1     green                     0                   0
## 4      1    yellow                     0                   0
## 5      2     black                     0                   0
## 6      2      blue                     0                   1
## 7      3     black                     0                   0
## 8      3      blue                     2                   0
## 9      3     green                     0                   1
## 10     3    yellow                     0                   0
## 11     4     black                     0                   1
## 12     4      blue                     0                   0
## 13     4     green                     0                   1
## 14     4    yellow                     0                   0
## 15     5     black                     0                   0
## 16     5      blue                     1                   0
## 17     5     green                     0                   0
## 18     5    yellow                     0                   0
## 19     6     black                     0                   0
## 20     6      blue                     0                   1
## 21     6     green                     0                   0
## 22     6    yellow                     0                   0
## 23     7     black                     0                   0
## 24     7      blue                     0                   0
## 25     7     green                     0                   0
## 26     7    yellow                     0                   0
##    Macroclymenella.stewartensis Family.Orbiniidae Family.Spionidae
## 1                             0                 0                1
## 2                             0                 1                0
## 3                             0                 1                0
## 4                             0                 0                0
## 5                             0                 6                0
## 6                             0                 2                0
## 7                             0                 1                0
## 8                             0                 1                0
## 9                             0                 5                0
## 10                            0                 0                0
## 11                            0                 0                0
## 12                            1                 0                2
## 13                            0                 5                2
## 14                            0                 1                1
## 15                            1                 0                1
## 16                            0                 0                0
## 17                            0                 0                0
## 18                            0                 0                0
## 19                            0                 0                0
## 20                            3                 6                1
## 21                            1                 4                0
## 22                            1                 2                0
## 23                            1                 0                2
## 24                            2                 0                1
## 25                            0                 0                0
## 26                            0                 2                0
##    Family.Nephtytidae Family.Nereididae Family.Opheliidae Family.Syllidae
## 1                   0                 0                 0               0
## 2                   1                 0                 0               0
## 3                   0                 0                 0               1
## 4                   0                 1                 0               0
## 5                   1                 0                 0               0
## 6                   1                 2                 0               0
## 7                   1                 0                 1               0
## 8                   0                 0                 0               0
## 9                   0                 0                 1               0
## 10                  2                 3                 0               0
## 11                  0                 0                 0               0
## 12                  1                 0                 0               0
## 13                  1                 0                 2               0
## 14                  1                 0                 0               0
## 15                  0                 0                 3               1
## 16                  4                 0                 0               2
## 17                  0                 2                 0               0
## 18                  0                 0                 0               0
## 19                  0                 1                 0               0
## 20                  0                 0                 0               0
## 21                  0                 0                 0               0
## 22                  1                 0                 0               0
## 23                  0                 1                 2               3
## 24                  1                 2                 0               0
## 25                  0                 0                 0               0
## 26                  0                 0                 0               0
##    Family.Capitellidae Nucula.hartvigiana Austrovenus.stutchburyi
## 1                    0                  0                       2
## 2                    0                  0                       0
## 3                    0                  0                       0
## 4                    1                  0                       0
## 5                    2                  0                       1
## 6                    0                  0                       0
## 7                    0                  0                       0
## 8                    0                  5                       0
## 9                    0                  0                       0
## 10                   0                  0                       1
## 11                   0                  4                       0
## 12                   0                  1                       0
## 13                   0                  0                      16
## 14                   0                  1                       0
## 15                   0                  0                       3
## 16                   0                 23                       0
## 17                   0                 11                       0
## 18                   0                 11                       1
## 19                   0                  0                       0
## 20                   2                  0                       1
## 21                   0                  0                       1
## 22                   0                  0                       0
## 23                   0                  4                       0
## 24                   0                  0                       3
## 25                   0                  9                       0
## 26                   0                  6                       0
##    Paphies.australis Perrierina.turneri Arthritica.bifurca
## 1                  0                  6                  0
## 2                  0                 37                  0
## 3                  0                  0                  6
## 4                  0                  0                  0
## 5                  0                  1                  0
## 6                  0                  3                  0
## 7                  0                  5                  3
## 8                  0                  0                  0
## 9                  0                  1                  0
## 10                 0                  6                  3
## 11                 0                 14                  0
## 12                 0                 11                  5
## 13                 0                 37                  7
## 14                 0                 18                  0
## 15                 0                  4                  0
## 16                 1                 16                 10
## 17                 1                  5                  0
## 18                 0                  6                  0
## 19                 0                 58                  0
## 20                 0                  7                  0
## 21                 0                 11                  2
## 22                 0                 25                  2
## 23                 0                 21                  1
## 24                 0                  0                  0
## 25                 0                  8                  0
## 26                 0                  0                  1
##    Macomona..Tellina..lilliana Micrelenchus.tenebrosus Cantharidus.huttoni
## 1                            0                       0                   0
## 2                            0                       0                   9
## 3                            0                       0                   1
## 4                            0                       0                   1
## 5                            2                       0                   0
## 6                            1                       0                   0
## 7                            2                       0                   0
## 8                            0                       0                   0
## 9                            0                       0                   1
## 10                           0                       0                   3
## 11                           0                       0                   2
## 12                           2                       0                   0
## 13                           2                       2                   0
## 14                           1                       0                   0
## 15                           0                       0                   0
## 16                           0                       0                   0
## 17                           0                       0                   0
## 18                           0                       0                   0
## 19                           0                       0                   2
## 20                           0                       0                   0
## 21                           0                       0                   3
## 22                           0                       0                   0
## 23                           0                       0                   1
## 24                           3                       0                   1
## 25                           0                       0                   0
## 26                           0                       0                   3
##    Diloma.subrostrata Zethalia.zelandica Cominella.glandiformis
## 1                   0                  0                      0
## 2                   0                  0                      1
## 3                   0                  1                      0
## 4                   0                  0                      0
## 5                   0                  0                      0
## 6                   0                  0                      0
## 7                   0                  1                      0
## 8                   0                  0                      0
## 9                   0                  0                      1
## 10                  0                  0                      0
## 11                  0                  0                      0
## 12                  0                  0                      0
## 13                  0                  0                      0
## 14                  0                  1                      0
## 15                  0                  0                      0
## 16                  0                  0                      0
## 17                  0                  0                      0
## 18                  0                  0                      0
## 19                  0                  0                      1
## 20                  0                  0                      0
## 21                  0                  0                      0
## 22                  0                  0                      0
## 23                  0                  0                      0
## 24                  1                  0                      0
## 25                  2                  0                      0
## 26                  0                  0                      1
##    Zeacumantus.subcarinatus Notoacmea.sp. Amphibola.crenata
## 1                         0             0                 0
## 2                         0             4                 0
## 3                         0             0                 0
## 4                         0             0                 0
## 5                         0             0                 0
## 6                         0             0                 0
## 7                         0             0                 0
## 8                         0             0                 0
## 9                         0             0                 0
## 10                        0             0                 0
## 11                        0             0                 0
## 12                        0             0                 0
## 13                        0             1                 0
## 14                        0             0                 0
## 15                        0             0                 0
## 16                        2             0                 0
## 17                        0             0                 0
## 18                        0             0                 0
## 19                        0             0                 0
## 20                        0             0                 0
## 21                        1             2                 0
## 22                        0             0                 0
## 23                        0             0                 0
## 24                        0             0                 0
## 25                        0             4                 0
## 26                        0             0                 0
##    ORDER.HARPACTECOIDA Family.Anthuridae Zeuxo.novazealandiae
## 1                    0                 0                    0
## 2                    0                 0                    2
## 3                    0                 0                    0
## 4                   10                 0                    0
## 5                    0                 0                    0
## 6                    0                 3                    0
## 7                    0                 0                    0
## 8                    0                 1                    0
## 9                    0                 0                    0
## 10                   0                 0                    0
## 11                   5                 0                    0
## 12                   0                 0                    0
## 13                   0                 0                    0
## 14                   0                 0                    0
## 15                   3                 0                    0
## 16                   0                 0                    0
## 17                   8                 0                    0
## 18                   0                 0                    0
## 19                   0                 0                    0
## 20                   0                 0                    0
## 21                   1                 0                    0
## 22                   0                 0                    0
## 23                   0                 0                    0
## 24                   0                 0                    0
## 25                   0                 0                    0
## 26                   0                 0                    0
##    Paracorophium.excavatum Torridoharpinia.hurleyi
## 1                        0                       0
## 2                        0                       1
## 3                        0                       0
## 4                        0                       1
## 5                        0                       0
## 6                        0                       0
## 7                        0                       0
## 8                        0                       0
## 9                        0                       0
## 10                       0                       0
## 11                       1                       0
## 12                       0                       0
## 13                       0                       0
## 14                       0                       0
## 15                       0                       0
## 16                       1                       0
## 17                       1                       0
## 18                       0                       0
## 19                       0                       0
## 20                       0                       0
## 21                       0                       0
## 22                       0                       0
## 23                       1                       0
## 24                       0                       0
## 25                       0                       0
## 26                       2                       1
##    Paracalliope.novizelandiae
## 1                           0
## 2                           0
## 3                           0
## 4                           0
## 5                           0
## 6                           0
## 7                           0
## 8                           1
## 9                           0
## 10                          0
## 11                          0
## 12                          0
## 13                          0
## 14                          0
## 15                          0
## 16                          0
## 17                          1
## 18                          0
## 19                          0
## 20                          0
## 21                          0
## 22                          0
## 23                          0
## 24                          0
## 25                          0
## 26                          1
#detach(FaunaData)
attach(FaunaData)
head(FaunaData)
##   block treatment Edwardsia.neozelanica Abarenicola.affinis
## 1     1     black                     0                   0
## 2     1      blue                     0                   0
## 3     1     green                     0                   0
## 4     1    yellow                     0                   0
## 5     2     black                     0                   0
## 6     2      blue                     0                   1
##   Macroclymenella.stewartensis Family.Orbiniidae Family.Spionidae
## 1                            0                 0                1
## 2                            0                 1                0
## 3                            0                 1                0
## 4                            0                 0                0
## 5                            0                 6                0
## 6                            0                 2                0
##   Family.Nephtytidae Family.Nereididae Family.Opheliidae Family.Syllidae
## 1                  0                 0                 0               0
## 2                  1                 0                 0               0
## 3                  0                 0                 0               1
## 4                  0                 1                 0               0
## 5                  1                 0                 0               0
## 6                  1                 2                 0               0
##   Family.Capitellidae Nucula.hartvigiana Austrovenus.stutchburyi
## 1                   0                  0                       2
## 2                   0                  0                       0
## 3                   0                  0                       0
## 4                   1                  0                       0
## 5                   2                  0                       1
## 6                   0                  0                       0
##   Paphies.australis Perrierina.turneri Arthritica.bifurca
## 1                 0                  6                  0
## 2                 0                 37                  0
## 3                 0                  0                  6
## 4                 0                  0                  0
## 5                 0                  1                  0
## 6                 0                  3                  0
##   Macomona..Tellina..lilliana Micrelenchus.tenebrosus Cantharidus.huttoni
## 1                           0                       0                   0
## 2                           0                       0                   9
## 3                           0                       0                   1
## 4                           0                       0                   1
## 5                           2                       0                   0
## 6                           1                       0                   0
##   Diloma.subrostrata Zethalia.zelandica Cominella.glandiformis
## 1                  0                  0                      0
## 2                  0                  0                      1
## 3                  0                  1                      0
## 4                  0                  0                      0
## 5                  0                  0                      0
## 6                  0                  0                      0
##   Zeacumantus.subcarinatus Notoacmea.sp. Amphibola.crenata
## 1                        0             0                 0
## 2                        0             4                 0
## 3                        0             0                 0
## 4                        0             0                 0
## 5                        0             0                 0
## 6                        0             0                 0
##   ORDER.HARPACTECOIDA Family.Anthuridae Zeuxo.novazealandiae
## 1                   0                 0                    0
## 2                   0                 0                    2
## 3                   0                 0                    0
## 4                  10                 0                    0
## 5                   0                 0                    0
## 6                   0                 3                    0
##   Paracorophium.excavatum Torridoharpinia.hurleyi
## 1                       0                       0
## 2                       0                       1
## 3                       0                       0
## 4                       0                       1
## 5                       0                       0
## 6                       0                       0
##   Paracalliope.novizelandiae
## 1                          0
## 2                          0
## 3                          0
## 4                          0
## 5                          0
## 6                          0
hist(Austrovenus.stutchburyi)

richness <- specnumber(FaunaData[3:32])
richness
##  [1]  3  8  5  5  6  7  7  5  6  6  6  7 11  7  7  9  7  3  4  7  9  5 10
## [24]  8  4  8
black.richness=richness[treatment=="black"]
black.richness
## [1]  3  6  7  6  7  4 10
blue.richness=richness[treatment=="blue"]
blue.richness
## [1] 8 7 5 7 9 7 8
green.richness=richness[treatment=="green"]
green.richness
## [1]  5  6 11  7  9  4
yellow.richness=richness[treatment=="yellow"]
yellow.richness
## [1] 5 6 7 3 5 8
mean.richness= c(mean(black.richness), mean(blue.richness), mean(green.richness), mean(yellow.richness))
mean.richness
## [1] 6.142857 7.285714 7.000000 5.666667
mp<-barplot(mean.richness,axes=FALSE,axisnames=FALSE,ylim=c(0,10),xlab="Treatment",ylab="Taxon Richness", col=c("black", "blue", "green", "yellow"))
axis(1,labels=c("black","blue","green","yellow"),at=mp)
axis(2,at=seq(0,10,by=1))
box()

SE<-matrix(c(std.error(black.richness),std.error(blue.richness),std.error(green.richness),std.error(yellow.richness)),2)
segments(mp,mean.richness-SE,mp,mean.richness+SE,lwd=2)
segments(mp-0.1,mean.richness-SE,mp+0.1,mean.richness-SE,lwd=2)
segments(mp-0.1,mean.richness+SE,mp+0.1,mean.richness+SE,lwd=2)

leveneTest(richness, treatment)
## Levene's Test for Homogeneity of Variance (center = median)
##       Df F value Pr(>F)
## group  3  0.9331 0.4414
##       22
shapiro.test(richness)
## 
##  Shapiro-Wilk normality test
## 
## data:  richness
## W = 0.96941, p-value = 0.608
supermodel<-lm(richness~treatment)
summary(supermodel)
## 
## Call:
## lm(formula = richness ~ treatment)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.1429 -0.9167 -0.1429  0.8571  4.0000 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       6.1429     0.7629   8.052 5.29e-08 ***
## treatmentblue     1.1429     1.0788   1.059    0.301    
## treatmentgreen    0.8571     1.1229   0.763    0.453    
## treatmentyellow  -0.4762     1.1229  -0.424    0.676    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.018 on 22 degrees of freedom
## Multiple R-squared:  0.1079, Adjusted R-squared:  -0.01372 
## F-statistic: 0.8872 on 3 and 22 DF,  p-value: 0.4631
Anova(supermodel)
## Anova Table (Type II tests)
## 
## Response: richness
##           Sum Sq Df F value Pr(>F)
## treatment 10.842  3  0.8872 0.4631
## Residuals 89.619 22
#plot(supermodel)

##Diversity has been difined as H here

H<-diversity(FaunaData[3:32])
black.H=H[treatment=="black"]
blue.H=H[treatment=="blue"]
green.H=H[treatment=="green"]
yellow.H=H[treatment=="yellow"]


##Now plotting for diversity (H)
mean.H=c (mean(black.H),mean(blue.H),mean(green.H),mean(yellow.H))
mean.H
## [1] 1.308470 1.592372 1.493868 1.181951
mp<-barplot(mean.H,axes=FALSE,axisnames=FALSE,ylim=c(0,2), xlab="Treatment",ylab="Taxon Diversity", col=c("black", "blue", "green", "yellow"))
axis(1,labels=c("black","blue","green","yellow"),at=mp)
axis(2,at=seq(0,10,by=0.1))
box()

SE<-matrix(c(std.error(black.H),std.error(blue.H),std.error(green.H),std.error(yellow.H)),2)
segments(mp,mean.H-SE,mp,mean.H+SE,lwd=2)
segments(mp-0.1,mean.H-SE,mp+0.1,mean.H-SE,lwd=2)
segments(mp-0.1,mean.H+SE,mp+0.1,mean.H+SE,lwd=2)

logH<-log(H)

FaunaData2 <- FaunaData[2:32]
summary(FaunaData2)
##   treatment Edwardsia.neozelanica Abarenicola.affinis
##  black :7   Min.   :0.0000        Min.   :0.0000     
##  blue  :7   1st Qu.:0.0000        1st Qu.:0.0000     
##  green :6   Median :0.0000        Median :0.0000     
##  yellow:6   Mean   :0.1154        Mean   :0.1923     
##             3rd Qu.:0.0000        3rd Qu.:0.0000     
##             Max.   :2.0000        Max.   :1.0000     
##  Macroclymenella.stewartensis Family.Orbiniidae Family.Spionidae
##  Min.   :0.0000               Min.   :0.000     Min.   :0.0000  
##  1st Qu.:0.0000               1st Qu.:0.000     1st Qu.:0.0000  
##  Median :0.0000               Median :0.500     Median :0.0000  
##  Mean   :0.3846               Mean   :1.423     Mean   :0.4231  
##  3rd Qu.:0.7500               3rd Qu.:2.000     3rd Qu.:1.0000  
##  Max.   :3.0000               Max.   :6.000     Max.   :2.0000  
##  Family.Nephtytidae Family.Nereididae Family.Opheliidae Family.Syllidae 
##  Min.   :0.0000     Min.   :0.0000    Min.   :0.0000    Min.   :0.0000  
##  1st Qu.:0.0000     1st Qu.:0.0000    1st Qu.:0.0000    1st Qu.:0.0000  
##  Median :0.0000     Median :0.0000    Median :0.0000    Median :0.0000  
##  Mean   :0.5769     Mean   :0.4615    Mean   :0.3462    Mean   :0.2692  
##  3rd Qu.:1.0000     3rd Qu.:0.7500    3rd Qu.:0.0000    3rd Qu.:0.0000  
##  Max.   :4.0000     Max.   :3.0000    Max.   :3.0000    Max.   :3.0000  
##  Family.Capitellidae Nucula.hartvigiana Austrovenus.stutchburyi
##  Min.   :0.0000      Min.   : 0.000     Min.   : 0.000         
##  1st Qu.:0.0000      1st Qu.: 0.000     1st Qu.: 0.000         
##  Median :0.0000      Median : 0.000     Median : 0.000         
##  Mean   :0.1923      Mean   : 2.885     Mean   : 1.115         
##  3rd Qu.:0.0000      3rd Qu.: 4.000     3rd Qu.: 1.000         
##  Max.   :2.0000      Max.   :23.000     Max.   :16.000         
##  Paphies.australis Perrierina.turneri Arthritica.bifurca
##  Min.   :0.00000   Min.   : 0.00      Min.   : 0.000    
##  1st Qu.:0.00000   1st Qu.: 1.50      1st Qu.: 0.000    
##  Median :0.00000   Median : 6.00      Median : 0.000    
##  Mean   :0.07692   Mean   :11.54      Mean   : 1.538    
##  3rd Qu.:0.00000   3rd Qu.:15.50      3rd Qu.: 2.000    
##  Max.   :1.00000   Max.   :58.00      Max.   :10.000    
##  Macomona..Tellina..lilliana Micrelenchus.tenebrosus Cantharidus.huttoni
##  Min.   :0.00                Min.   :0.00000         Min.   :0.000      
##  1st Qu.:0.00                1st Qu.:0.00000         1st Qu.:0.000      
##  Median :0.00                Median :0.00000         Median :0.000      
##  Mean   :0.50                Mean   :0.07692         Mean   :1.038      
##  3rd Qu.:0.75                3rd Qu.:0.00000         3rd Qu.:1.000      
##  Max.   :3.00                Max.   :2.00000         Max.   :9.000      
##  Diloma.subrostrata Zethalia.zelandica Cominella.glandiformis
##  Min.   :0.0000     Min.   :0.0000     Min.   :0.0000        
##  1st Qu.:0.0000     1st Qu.:0.0000     1st Qu.:0.0000        
##  Median :0.0000     Median :0.0000     Median :0.0000        
##  Mean   :0.1154     Mean   :0.1154     Mean   :0.1538        
##  3rd Qu.:0.0000     3rd Qu.:0.0000     3rd Qu.:0.0000        
##  Max.   :2.0000     Max.   :1.0000     Max.   :1.0000        
##  Zeacumantus.subcarinatus Notoacmea.sp.    Amphibola.crenata
##  Min.   :0.0000           Min.   :0.0000   Min.   :0        
##  1st Qu.:0.0000           1st Qu.:0.0000   1st Qu.:0        
##  Median :0.0000           Median :0.0000   Median :0        
##  Mean   :0.1154           Mean   :0.4231   Mean   :0        
##  3rd Qu.:0.0000           3rd Qu.:0.0000   3rd Qu.:0        
##  Max.   :2.0000           Max.   :4.0000   Max.   :0        
##  ORDER.HARPACTECOIDA Family.Anthuridae Zeuxo.novazealandiae
##  Min.   : 0.000      Min.   :0.0000    Min.   :0.00000     
##  1st Qu.: 0.000      1st Qu.:0.0000    1st Qu.:0.00000     
##  Median : 0.000      Median :0.0000    Median :0.00000     
##  Mean   : 1.038      Mean   :0.1538    Mean   :0.07692     
##  3rd Qu.: 0.000      3rd Qu.:0.0000    3rd Qu.:0.00000     
##  Max.   :10.000      Max.   :3.0000    Max.   :2.00000     
##  Paracorophium.excavatum Torridoharpinia.hurleyi
##  Min.   :0.0000          Min.   :0.0000         
##  1st Qu.:0.0000          1st Qu.:0.0000         
##  Median :0.0000          Median :0.0000         
##  Mean   :0.2308          Mean   :0.1154         
##  3rd Qu.:0.0000          3rd Qu.:0.0000         
##  Max.   :2.0000          Max.   :1.0000         
##  Paracalliope.novizelandiae
##  Min.   :0.0000            
##  1st Qu.:0.0000            
##  Median :0.0000            
##  Mean   :0.1154            
##  3rd Qu.:0.0000            
##  Max.   :1.0000
dist.matrix<-vegdist(FaunaData2[,-1])
dist.matrix
##            1         2         3         4         5         6         7
## 2  0.8153846                                                            
## 3  1.0000000 0.9393939                                                  
## 4  1.0000000 0.9428571 0.9166667                                        
## 5  0.8181818 0.9130435 0.9130435 0.9259259                              
## 6  0.7272727 0.8550725 0.9130435 0.9259259 0.6153846                    
## 7  0.5652174 0.8000000 0.5833333 1.0000000 0.6296296 0.5555556          
## 8  1.0000000 0.9696970 0.9000000 1.0000000 0.9130435 0.8260870 0.9166667
## 9  0.8947368 0.8787879 0.8000000 0.9166667 0.4782609 0.6521739 0.7500000
## 10 0.4814815 0.7297297 0.7142857 0.8750000 0.8064516 0.6129032 0.4375000
## 11 0.6666667 0.6144578 0.9459459 0.7073171 0.9500000 0.8000000 0.7560976
## 12 0.5625000 0.6962025 0.6969697 1.0000000 0.7777778 0.7222222 0.4054054
## 13 0.7882353 0.3939394 0.8372093 1.0000000 0.7752809 0.8202247 0.7111111
## 14 0.5757576 0.5000000 0.8823529 1.0000000 0.7837838 0.6756757 0.5263158
## 15 0.4400000 0.8888889 0.9230769 0.8000000 0.8620690 0.7931034 0.6666667
## 16 0.8260870 0.7068966 0.8000000 1.0000000 0.9452055 0.8904110 0.7567568
## 17 0.7368421 0.8823529 1.0000000 0.5813953 0.9523810 0.7619048 0.7674419
## 18 0.4814815 0.8378378 1.0000000 1.0000000 0.8709677 0.8064516 0.6875000
## 19 0.8309859 0.3220339 0.9722222 0.9473684 0.9733333 0.8933333 0.8684211
## 20 0.4666667 0.7922078 0.9354839 0.9428571 0.4117647 0.6470588 0.6571429
## 21 0.6000000 0.5853659 0.7777778 0.9000000 0.6923077 0.7435897 0.6000000
## 22 0.7000000 0.3793103 0.8536585 1.0000000 0.8181818 0.7272727 0.6000000
## 23 0.6956522 0.5268817 0.8723404 0.9215686 0.9600000 0.8400000 0.7254902
## 24 0.7391304 0.9428571 0.9166667 0.8571429 0.7037037 0.7037037 0.7857143
## 25 0.6250000 0.6962025 1.0000000 1.0000000 0.9444444 0.8333333 0.7297297
## 26 1.0000000 0.8356164 0.7777778 0.8709677 0.8666667 0.8666667 0.8709677
##            8         9        10        11        12        13        14
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9  0.9000000                                                            
## 10 1.0000000 0.8571429                                                  
## 11 0.7837838 0.8378378 0.6444444                                        
## 12 0.9393939 0.9393939 0.5121951 0.5200000                              
## 13 0.9767442 0.8139535 0.7659574 0.7087379 0.5757576                    
## 14 0.8823529 0.8823529 0.6666667 0.4117647 0.3617021 0.5600000          
## 15 1.0000000 0.8461538 0.7058824 0.6744186 0.6923077 0.7826087 0.7500000
## 16 0.8285714 0.9714286 0.7179487 0.5632184 0.5662651 0.6470588 0.5714286
## 17 0.6923077 0.9487179 0.7021277 0.4642857 0.7692308 0.9047619 0.7735849
## 18 0.6428571 0.9285714 0.6111111 0.5555556 0.6585366 0.8510638 0.6666667
## 19 1.0000000 0.9166667 0.7750000 0.6404494 0.7411765 0.4637681 0.5813953
## 20 0.9354839 0.5483871 0.6410256 0.6666667 0.5909091 0.6907216 0.6000000
## 21 0.9444444 0.6666667 0.4545455 0.4716981 0.4285714 0.6274510 0.5200000
## 22 0.9512195 0.8536585 0.6326531 0.5172414 0.4444444 0.4392523 0.2727273
## 23 0.8297872 0.8723404 0.6727273 0.3750000 0.4666667 0.5398230 0.3442623
## 24 1.0000000 0.9166667 0.6875000 0.9512195 0.7297297 0.8444444 0.8421053
## 25 0.6969697 0.9393939 0.7073171 0.5200000 0.6086957 0.8181818 0.6170213
## 26 0.4814815 0.7037037 0.7714286 0.6818182 0.9000000 0.9354839 0.9024390
##           15        16        17        18        19        20        21
## 2                                                                       
## 3                                                                       
## 4                                                                       
## 5                                                                       
## 6                                                                       
## 7                                                                       
## 8                                                                       
## 9                                                                       
## 10                                                                      
## 11                                                                      
## 12                                                                      
## 13                                                                      
## 14                                                                      
## 15                                                                      
## 16 0.8684211                                                            
## 17 0.6888889 0.5955056                                                  
## 18 0.7058824 0.5641026 0.3191489                                        
## 19 0.8974359 0.7377049 0.8681319 0.8500000                              
## 20 0.6216216 0.8271605 0.8000000 0.6410256 0.8313253                    
## 21 0.6666667 0.6744186 0.7818182 0.6818182 0.7045455 0.4468085          
## 22 0.7872340 0.5824176 0.8333333 0.7551020 0.4623656 0.6153846 0.4385965
## 23 0.6603774 0.5051546 0.6666667 0.6363636 0.5353535 0.6896552 0.5555556
## 24 0.6666667 0.9729730 0.9069767 0.9375000 0.9473684 0.7714286 0.8500000
## 25 0.7948718 0.5903614 0.4615385 0.2682927 0.8117647 0.6818182 0.5918367
## 26 1.0000000 0.7922078 0.6521739 0.6571429 0.9240506 0.8947368 0.7209302
##           22        23        24        25
## 2                                         
## 3                                         
## 4                                         
## 5                                         
## 6                                         
## 7                                         
## 8                                         
## 9                                         
## 10                                        
## 11                                        
## 12                                        
## 13                                        
## 14                                        
## 15                                        
## 16                                        
## 17                                        
## 18                                        
## 19                                        
## 20                                        
## 21                                        
## 22                                        
## 23 0.3235294                              
## 24 0.9111111 0.8431373                    
## 25 0.7037037 0.6000000 0.9459459          
## 26 0.8750000 0.7407407 0.9354839 0.7000000
mds.data<-metaMDS(dist.matrix)
## Run 0 stress 0.2114047 
## Run 1 stress 0.2135415 
## Run 2 stress 0.2432216 
## Run 3 stress 0.2199 
## Run 4 stress 0.2105724 
## ... New best solution
## ... Procrustes: rmse 0.1019993  max resid 0.4344562 
## Run 5 stress 0.2452305 
## Run 6 stress 0.2147514 
## Run 7 stress 0.2105794 
## ... Procrustes: rmse 0.006938949  max resid 0.02323346 
## Run 8 stress 0.2143602 
## Run 9 stress 0.2572257 
## Run 10 stress 0.2344393 
## Run 11 stress 0.2158026 
## Run 12 stress 0.2538338 
## Run 13 stress 0.2329013 
## Run 14 stress 0.2270163 
## Run 15 stress 0.2395825 
## Run 16 stress 0.220286 
## Run 17 stress 0.2722497 
## Run 18 stress 0.217284 
## Run 19 stress 0.2608365 
## Run 20 stress 0.220808 
## *** No convergence -- monoMDS stopping criteria:
##     20: stress ratio > sratmax
mds.data
## 
## Call:
## metaMDS(comm = dist.matrix) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     dist.matrix 
## Distance: bray 
## 
## Dimensions: 2 
## Stress:     0.2105724 
## Stress type 1, weak ties
## No convergent solutions - best solution after 20 tries
## Scaling: centring, PC rotation 
## Species: scores missing
ordiplot(mds.data,choices=c(1,2),type="p")
## Warning in ordiplot(mds.data, choices = c(1, 2), type = "p"): Species
## scores not available

colvec <- c("blue", "green2", "yellow2", "black")
ordiplot(mds.data, type="n")
## Warning in ordiplot(mds.data, type = "n"): Species scores not available
#text(mds.data, display="sites", col=colvec[treatment])
text(mds.data, col=colvec[treatment]) # labels=FaunaData$block,

#, main="Stressplot\nStress = 0.2488"
stressplot(mds.data,dist.matrix, p.col=colvec[treatment], l.col="red2")

mds.stats<-metaMDS(FaunaData2[,-1],trace=F)
mds.stats
## 
## Call:
## metaMDS(comm = FaunaData2[, -1], trace = F) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     wisconsin(sqrt(FaunaData2[, -1])) 
## Distance: bray 
## 
## Dimensions: 2 
## Stress:     0.2488008 
## Stress type 1, weak ties
## Two convergent solutions found after 20 tries
## Scaling: centring, PC rotation, halfchange scaling 
## Species: expanded scores based on 'wisconsin(sqrt(FaunaData2[, -1]))'