aves<-read.delim2("E:/Mazar -Guarumales - Mazar_2018/Base de Datos/aves.txt", header = T, row.names = 1)
env<-read.delim2("E:/Mazar -Guarumales - Mazar_2018/Base de Datos/env2.txt", header = T, row.names = 1)
attach(env)
Distancia <- vegdist(aves)
str(Distancia)
## 'dist' num [1:861] 0.765 0.44 0.377 0.558 0.433 ...
## - attr(*, "Size")= int 42
## - attr(*, "Labels")= chr [1:42] "CA1" "CA2" "CA4" "CA5" ...
## - attr(*, "Diag")= logi FALSE
## - attr(*, "Upper")= logi FALSE
## - attr(*, "method")= chr "bray"
## - attr(*, "call")= language vegdist(x = aves)
MDS <- isoMDS(Distancia)
## initial value 22.025697
## iter 5 value 13.412296
## iter 10 value 12.950772
## iter 15 value 12.795710
## iter 15 value 12.784736
## iter 15 value 12.784120
## final value 12.784120
## converged
MDS$stress
## [1] 12.78412
stressplot(MDS,Distancia)
0.3 proporciona una representacion deficiente.
Mi_MDS <- metaMDS(aves, trace = F)
Mi_MDS
##
## Call:
## metaMDS(comm = aves, trace = F)
##
## global Multidimensional Scaling using monoMDS
##
## Data: wisconsin(aves)
## Distance: bray
##
## Dimensions: 2
## Stress: 0.251721
## Stress type 1, weak ties
## No convergent solutions - best solution after 20 tries
## Scaling: centring, PC rotation, halfchange scaling
## Species: expanded scores based on 'wisconsin(aves)'
Ajuste <- envfit (Mi_MDS, env, perm=1000, na.rm = T)
Ajuste
##
## ***FACTORS:
##
## Centroids:
## NMDS1 NMDS2
## CentralesMazar -0.3160 0.0615
## CentralesMolino 0.1223 -0.0558
## CentralesSopladora 0.4820 0.0903
##
## Goodness of fit:
## r2 Pr(>r)
## Centrales 0.3287 0.000999 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Permutation: free
## Number of permutations: 1000
ordiplot(Mi_MDS, type = "n",xlim= c(-0.4, 0.4), ylim= c(-1, 1))##grafico en blanco
ordiellipse(Mi_MDS, env$Centrales, display = "sites", conf=0.95, label = T)
points(scores(Mi_MDS)[c(1:16),1:2],pch=17,cex=1.5,col= "blue")
points(scores(Mi_MDS)[c(17:32),1:2],pch=16,cex=1.5,col= "dark green")
plot(Ajuste, p.max= 0.15, col= "black")#Solo variables significativas