Análisis Multivariado Aplicado al Estudio Ambiental con R-Studio y Software GIS

El Caso

En la presente base de datos se tiene diversas especies de aves durante un muestreo, durante el otoño en un determinado bosque del Perú. Se hizo el muestreo en toda la gradiente de dicho bosque, se conoce por estudios que en dicha gradiente hay 3 zonas muy diferenciadas. El muestreo de cada zona tomó en consideración al menos 5 repeticiones. Cada repetición está codificada con símbolos: m1,m2,m3,m4, ….,m20. Tomando en cuenta esto:

  1. Realizar un análisis de disimilaridad entre todas las 20 repeticiones, usando el índice de Bray-Curtis. La repetición m1 con que repetición posee la mayor diferencia. Explique esos resultados.

  2. Realizar los respectivos análisis de Ordenación: NMDS, PCOA. Crear una base columna en la base de datos original: Zona. Completar la columna Zona con la clasificación en base a los resultados del NMDS y PCOA, llamarlas: Zona 1, Zona 1, ………..Zona 3.

  3. Para confirmar los resultados, realice un cluster jerárquico. Luego para confirmar la hipótesis de las 3 zonas, realice la prueba SIMPROF. En los Cluster usar el método UPGMA y la distancia de Bray Curtis. Analice los resultados de la prueba SIMPROF 4.Aplicar la prueba de Hipótesis Multivariada ANOSIM y PERMANOVA. ¿Se encontraron diferencias significativas? En el caso de Permanova, si hay diferencias significativas, aplicar la comparación por pares. De encontrar diferencias significativas, aplicar la Prueba SIMPER: ¿Qué especies causan dichas diferencias?

1. Análisis de Disimilaridad

library(readxl)
base_de_datos_del_ejercicio <- read_excel("E:/Users/Investigador/iCloudDrive/R/Analiisis_multivariado/base de datos del ejercicio.xlsx")
View(base_de_datos_del_ejercicio)
library(vegan)
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.6-4
distancias1<-base_de_datos_del_ejercicio #EL OBJETO QUE CONTIENE EL ARCHIVO
#Convertimos el archivo a dataframe
distancias<-data.frame(distancias1)
#distancia$zona=NULL

#2do A los nombres de distancias<- asignamos los nombres de la columna Pa?s
rownames(distancias)<-distancias$Sitios
distancias
##     Sitios  spa  spb  spc  spd spe spf spg  sph  spi  spj  spk
## m1      m1 21.0 20.3 15.5 36.2   0   1   0  0.0  1.0  0.0  1.0
## m12    m12 28.9  0.0  0.0  3.0  15  13  39  2.0  0.0  0.0  3.0
## m7      m7 34.9  0.0  2.0  0.0   1  54  95 10.0  1.0  0.0  1.0
## m13    m13 31.8  2.0  3.0  0.0  12  44  16  4.0  5.0  1.0  0.0
## m14    m14 31.0  0.0  3.0  3.0  15  75  66  0.0  3.0  0.0  2.0
## m15    m15 17.5  3.0  2.0  0.0   2   0   3 61.0 12.0 30.0 20.0
## m4      m4  0.0 48.0  0.0 19.0   0   3   0  0.0  3.0  3.0  0.0
## m8      m8 25.9  2.0  1.0  5.0  16  23  77  0.0  0.0  3.0  1.0
## m11    m11 24.1  2.0  1.0  0.0  11  21  41  0.0 11.0  1.0  0.0
## m20    m20 21.5  2.0  0.0  2.0   2   5   1 15.0  9.0 15.7 21.3
## m16    m16 15.3  0.0  1.0  0.0   0   0   2 40.3 11.1 34.7 20.0
## m17    m17 17.9  0.0  3.0  0.0   0   3   0 40.0  9.8  4.8 21.0
## m18    m18 19.6  1.0  0.0 11.0   3   0   4 39.8  5.6 43.7 25.3
## m2      m2 12.0 30.6  0.0 35.0   0   0   0  4.0  0.0  3.0  0.0
## m19    m19 17.8  0.0  1.0  4.0   0   2   0 22.5  7.5 37.3 22.2
## m5      m5 18.0 11.8  9.0 17.7   0   0   0  1.0  0.0  0.0  1.0
## m6      m6 38.8  1.0  0.0  3.0   1  34  45  0.0  1.0  1.0  0.0
## m9      m9 31.9  1.0  0.0  0.0  14  55  34  3.0  1.0  0.0  0.0
## m10    m10 31.5  0.0  1.0  1.0  30  43  46  3.0  0.0  1.0  2.0
## m3      m3 16.0 28.2  4.7 47.0   4   0   3  0.0  2.0  0.0  1.0

A continación aparecen la base de datos que constituye en 20 observaciones con 12 variables.Hallamos las distancia mediante el metodo Bray Curtis: DISIMILARIDAD [,-1] Excluimos la primera columna que contiene los nombres de las zonas

dist.mat <- vegdist(   distancias[, -1 ], method="bray")
dist.mat
##            m1       m12        m7       m13       m14       m15        m4
## m12 0.7398699                                                            
## m7  0.8236690 0.4392338                                                  
## m13 0.7392924 0.3542883 0.3717343                                        
## m14 0.7959184 0.3315667 0.2139078 0.3118687                              
## m15 0.8012170 0.7838050 0.7967945 0.7289268 0.8307030                    
## m4  0.5197674 0.9332963 0.9708985 0.9075975 0.9343066 0.9205298          
## m8  0.7519008 0.2482545 0.2692744 0.4066740 0.2333049 0.8061761 0.8869074
## m11 0.7501201 0.1935185 0.4270096 0.2975314 0.3479523 0.7143945 0.9043062
## m20 0.7060367 0.6320565 0.7239264 0.6108767 0.7504274 0.3289796 0.8475073
## m16 0.8339383 0.8046430 0.8125580 0.7672697 0.8554591 0.1291379 0.9401198
## m17 0.7554987 0.7453294 0.7660858 0.6894182 0.8057143 0.2472000 0.8974359
## m18 0.7301205 0.7306345 0.7919864 0.7233260 0.8028490 0.2164745 0.8427948
## m2  0.2547065 0.8196286 0.8871252 0.8131760 0.8938429 0.8128456 0.3449564
## m19 0.7546362 0.7451879 0.7905492 0.7357357 0.8155620 0.2560423 0.8738833
## m5  0.2556634 0.7167488 0.8290598 0.7292724 0.8050682 0.7655502 0.5613383
## m6  0.7554348 0.2575426 0.2839049 0.2955665 0.2874845 0.8220124 0.9103586
## m9  0.7965240 0.2461034 0.2626919 0.1588713 0.2009470 0.8106061 0.9536823
## m10 0.8035363 0.2309451 0.2921097 0.2246664 0.2201964 0.8090615 0.9573561
## m3  0.2154532 0.7426120 0.8425197 0.7329773 0.7894044 0.7737910 0.4590434
##            m8       m11       m20       m16       m17       m18        m2
## m12                                                                      
## m7                                                                       
## m13                                                                      
## m14                                                                      
## m15                                                                      
## m4                                                                       
## m8                                                                       
## m11 0.2398496                                                            
## m20 0.6980676 0.5982575                                                  
## m16 0.8397413 0.7437632 0.3056190                                        
## m17 0.7955801 0.6909263 0.2711340 0.1880304                              
## m18 0.7614858 0.7419842 0.3276768 0.1535689 0.2942574                    
## m2  0.8155136 0.8474835 0.7431602 0.8181818 0.7935904 0.7390572          
## m19 0.7852349 0.7411661 0.2212644 0.1537495 0.2834425 0.1814441 0.7687280
## m5  0.7457627 0.7538101 0.6862745 0.7998907 0.7101266 0.6973995 0.4060098
## m6  0.2831001 0.2393415 0.6944824 0.8451043 0.7958092 0.7796976 0.8376313
## m9  0.3335602 0.2690476 0.7056314 0.8388195 0.7919799 0.7842267 0.8574610
## m10 0.2644046 0.2675536 0.7114625 0.8282078 0.7837209 0.7842697 0.8601399
## m3  0.7536567 0.7431193 0.7405190 0.8150239 0.7857838 0.7141754 0.2104987
##           m19        m5        m6        m9       m10
## m12                                                  
## m7                                                   
## m13                                                  
## m14                                                  
## m15                                                  
## m4                                                   
## m8                                                   
## m11                                                  
## m20                                                  
## m16                                                  
## m17                                                  
## m18                                                  
## m2                                                   
## m19                                                  
## m5  0.7129630                                        
## m6  0.7925554 0.7599564                              
## m9  0.8127459 0.7983871 0.2225161                    
## m10 0.7961877 0.7972350 0.1987293 0.1588472          
## m3  0.7820163 0.3771290 0.7832683 0.7965826 0.8033283

m1 tiene la mayor diferencia con m7 con un valor de 0.8236, así como m10 con 0.8035

2.1 Análisis de Ordenación: NMDS

##    Sitios  site  spa  spb  spc  spd spe spf spg  sph  spi  spj  spk
## 1      m1 zona1 21.0 20.3 15.5 36.2   0   1   0  0.0  1.0  0.0  1.0
## 2     m12 zona2 28.9  0.0  0.0  3.0  15  13  39  2.0  0.0  0.0  3.0
## 3      m7 zona2 34.9  0.0  2.0  0.0   1  54  95 10.0  1.0  0.0  1.0
## 4     m13 zona2 31.8  2.0  3.0  0.0  12  44  16  4.0  5.0  1.0  0.0
## 5     m14 zona2 31.0  0.0  3.0  3.0  15  75  66  0.0  3.0  0.0  2.0
## 6     m15 zona2 17.5  3.0  2.0  0.0   2   0   3 61.0 12.0 30.0 20.0
## 7      m4 zona1  0.0 48.0  0.0 19.0   0   3   0  0.0  3.0  3.0  0.0
## 8      m8 zona2 25.9  2.0  1.0  5.0  16  23  77  0.0  0.0  3.0  1.0
## 9     m11 zona2 24.1  2.0  1.0  0.0  11  21  41  0.0 11.0  1.0  0.0
## 10    m20 zona3 21.5  2.0  0.0  2.0   2   5   1 15.0  9.0 15.7 21.3
## 11    m16 zona3 15.3  0.0  1.0  0.0   0   0   2 40.3 11.1 34.7 20.0
## 12    m17 zona3 17.9  0.0  3.0  0.0   0   3   0 40.0  9.8  4.8 21.0
## 13    m18 zona3 19.6  1.0  0.0 11.0   3   0   4 39.8  5.6 43.7 25.3
## 14     m2 zona1 12.0 30.6  0.0 35.0   0   0   0  4.0  0.0  3.0  0.0
## 15    m19 zona3 17.8  0.0  1.0  4.0   0   2   0 22.5  7.5 37.3 22.2
## 16     m5 zona1 18.0 11.8  9.0 17.7   0   0   0  1.0  0.0  0.0  1.0
## 17     m6 zona2 38.8  1.0  0.0  3.0   1  34  45  0.0  1.0  1.0  0.0
## 18     m9 zona2 31.9  1.0  0.0  0.0  14  55  34  3.0  1.0  0.0  0.0
## 19    m10 zona2 31.5  0.0  1.0  1.0  30  43  46  3.0  0.0  1.0  2.0
## 20     m3 zona1 16.0 28.2  4.7 47.0   4   0   3  0.0  2.0  0.0  1.0
## Square root transformation
## Wisconsin double standardization
## Run 0 stress 0.07431811 
## Run 1 stress 0.07431811 
## ... New best solution
## ... Procrustes: rmse 2.905134e-06  max resid 7.738834e-06 
## ... Similar to previous best
## Run 2 stress 0.07431811 
## ... Procrustes: rmse 1.450378e-06  max resid 4.899417e-06 
## ... Similar to previous best
## Run 3 stress 0.07431811 
## ... Procrustes: rmse 1.833745e-06  max resid 6.589839e-06 
## ... Similar to previous best
## Run 4 stress 0.07431811 
## ... Procrustes: rmse 5.44743e-06  max resid 1.859633e-05 
## ... Similar to previous best
## Run 5 stress 0.09809811 
## Run 6 stress 0.09809811 
## Run 7 stress 0.07431811 
## ... Procrustes: rmse 2.986029e-06  max resid 9.161931e-06 
## ... Similar to previous best
## Run 8 stress 0.07431811 
## ... Procrustes: rmse 2.565773e-06  max resid 8.68263e-06 
## ... Similar to previous best
## Run 9 stress 0.07431811 
## ... Procrustes: rmse 7.673592e-07  max resid 2.645823e-06 
## ... Similar to previous best
## Run 10 stress 0.07431811 
## ... Procrustes: rmse 1.30685e-06  max resid 3.363504e-06 
## ... Similar to previous best
## Run 11 stress 0.2054935 
## Run 12 stress 0.07431811 
## ... Procrustes: rmse 2.122223e-06  max resid 7.126858e-06 
## ... Similar to previous best
## Run 13 stress 0.2234992 
## Run 14 stress 0.07431811 
## ... Procrustes: rmse 4.96625e-06  max resid 1.679499e-05 
## ... Similar to previous best
## Run 15 stress 0.2176042 
## Run 16 stress 0.07431811 
## ... Procrustes: rmse 2.290646e-06  max resid 7.782475e-06 
## ... Similar to previous best
## Run 17 stress 0.2045138 
## Run 18 stress 0.09809811 
## Run 19 stress 0.07431811 
## ... Procrustes: rmse 3.5622e-06  max resid 1.191072e-05 
## ... Similar to previous best
## Run 20 stress 0.07431811 
## ... Procrustes: rmse 2.087027e-06  max resid 4.930062e-06 
## ... Similar to previous best
## *** Best solution repeated 13 times
## 
## Call:
## metaMDS(comm = bdma[, c(-1, -2)]) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     wisconsin(sqrt(bdma[, c(-1, -2)])) 
## Distance: bray 
## 
## Dimensions: 2 
## Stress:     0.07431811 
## Stress type 1, weak ties
## Best solution was repeated 13 times in 20 tries
## The best solution was from try 1 (random start)
## Scaling: centring, PC rotation, halfchange scaling 
## Species: expanded scores based on 'wisconsin(sqrt(bdma[, c(-1, -2)]))'

Según la prueba de estres: 0.07431811, nos indica que es positiva ya que debe ser menor de 0.20. En la gráfica podemos distinguir tres grupos

aqui podemos percibir la formación de tres grupos con sus respectivos polígonos. El primero está integrado por ejemplo por m2, m4, m1, m3 y m5; el segundo por m5, m6,m7,m8,m9,m10,m11,m12,m13,m14 y el superior por los valores restantes: m15,m16,m17,m18,m19 y m20,

2.2 Análisis de Ordenación: PCOA

##      Eigenvalues   Corr_eig Rel_corr_eig Broken_stick Cum_corr_eig Cum_br_stick
## 1   2.1121460540 2.15727140  0.417855010  0.194172671    0.4178550    0.1941727
## 2   1.4996593102 1.54478466  0.299218730  0.138617115    0.7170737    0.3327898
## 3   0.1981316835 0.24325703  0.047117933  0.110839338    0.7641917    0.4436291
## 4   0.1345666036 0.17969195  0.034805626  0.092320819    0.7989973    0.5359499
## 5   0.1147864897 0.15991184  0.030974296  0.078431930    0.8299716    0.6143819
## 6   0.0982071972 0.14333255  0.027762952  0.067320819    0.8577345    0.6817027
## 7   0.0745715145 0.11969686  0.023184813  0.058061560    0.8809194    0.7397643
## 8   0.0590148668 0.10414021  0.020171551  0.050125052    0.9010909    0.7898893
## 9   0.0376764717 0.08280182  0.016038388  0.043180608    0.9171293    0.8330699
## 10  0.0326726396 0.07779799  0.015069165  0.037007768    0.9321985    0.8700777
## 11  0.0224475563 0.06757290  0.013088607  0.031452212    0.9452871    0.9015299
## 12  0.0162334274 0.06135878  0.011884954  0.026401707    0.9571720    0.9279316
## 13  0.0102417608 0.05536711  0.010724392  0.021772078    0.9678964    0.9497037
## 14  0.0002662568 0.04539160  0.008792176  0.017498574    0.9766886    0.9672023
## 15  0.0000000000 0.04164890  0.008067228  0.013530320    0.9847558    0.9807326
## 16 -0.0034764496 0.03501870  0.006782985  0.009826616    0.9915388    0.9905592
## 17 -0.0101066457 0.02510197  0.004862152  0.006354394    0.9964010    0.9969136
## 18 -0.0200233822 0.01858087  0.003599042  0.003086420    1.0000000    1.0000000
## 19 -0.0265444756 0.00000000  0.000000000  0.000000000    1.0000000    1.0000000
## 20 -0.0451253482 0.00000000  0.000000000  0.000000000    1.0000000    1.0000000

Con la función PCOA podemos advertir las diferencias entre los tres grupos, lo cual coincide con el análisis NMDS

3. Cluster Jerárquico

Se puede apreciar que entree m9 y m10 hay una similariada; lo mismo eentre m2 y m3; m11 y m12, etc. El que más atípico se presenta es el m4 que aparece muy apartado de los clusters.

3.1 Prueba SIMPER

##    Sitios  site  spa  spb  spc  spd spe spf spg  sph  spi  spj  spk
## 1      m1 zona1 21.0 20.3 15.5 36.2   0   1   0  0.0  1.0  0.0  1.0
## 2     m12 zona2 28.9  0.0  0.0  3.0  15  13  39  2.0  0.0  0.0  3.0
## 3      m7 zona2 34.9  0.0  2.0  0.0   1  54  95 10.0  1.0  0.0  1.0
## 4     m13 zona2 31.8  2.0  3.0  0.0  12  44  16  4.0  5.0  1.0  0.0
## 5     m14 zona2 31.0  0.0  3.0  3.0  15  75  66  0.0  3.0  0.0  2.0
## 6     m15 zona2 17.5  3.0  2.0  0.0   2   0   3 61.0 12.0 30.0 20.0
## 7      m4 zona1  0.0 48.0  0.0 19.0   0   3   0  0.0  3.0  3.0  0.0
## 8      m8 zona2 25.9  2.0  1.0  5.0  16  23  77  0.0  0.0  3.0  1.0
## 9     m11 zona2 24.1  2.0  1.0  0.0  11  21  41  0.0 11.0  1.0  0.0
## 10    m20 zona3 21.5  2.0  0.0  2.0   2   5   1 15.0  9.0 15.7 21.3
## 11    m16 zona3 15.3  0.0  1.0  0.0   0   0   2 40.3 11.1 34.7 20.0
## 12    m17 zona3 17.9  0.0  3.0  0.0   0   3   0 40.0  9.8  4.8 21.0
## 13    m18 zona3 19.6  1.0  0.0 11.0   3   0   4 39.8  5.6 43.7 25.3
## 14     m2 zona1 12.0 30.6  0.0 35.0   0   0   0  4.0  0.0  3.0  0.0
## 15    m19 zona3 17.8  0.0  1.0  4.0   0   2   0 22.5  7.5 37.3 22.2
## 16     m5 zona1 18.0 11.8  9.0 17.7   0   0   0  1.0  0.0  0.0  1.0
## 17     m6 zona2 38.8  1.0  0.0  3.0   1  34  45  0.0  1.0  1.0  0.0
## 18     m9 zona2 31.9  1.0  0.0  0.0  14  55  34  3.0  1.0  0.0  0.0
## 19    m10 zona2 31.5  0.0  1.0  1.0  30  43  46  3.0  0.0  1.0  2.0
## 20     m3 zona1 16.0 28.2  4.7 47.0   4   0   3  0.0  2.0  0.0  1.0
## Warning: argument 'parallel' is not used (yet)
## 
## Contrast: zona1_zona2 
## 
##      average       sd    ratio      ava   avb cumsum
## spg  0.19433  0.09664  2.01090  0.60000 46.20  0.237
## spf  0.15102  0.08056  1.87450  0.80000 36.20  0.422
## spd  0.12775  0.04525  2.82310 30.98000  1.50  0.578
## spb  0.11765  0.05838  2.01510 27.78000  1.10  0.721
## spa  0.07298  0.04285  1.70310 13.40000 29.63  0.810
## spe  0.05011  0.03589  1.39620  0.80000 11.70  0.872
## sph  0.03515  0.07551  0.46560  1.00000  8.30  0.915
## spc  0.02478  0.02290  1.08200  5.84000  1.30  0.945
## spj  0.01781  0.03600  0.49480  1.20000  3.70  0.967
## spi  0.01514  0.01822  0.83120  1.20000  3.40  0.985
## spk  0.01215  0.02429  0.50010  0.60000  2.90  1.000
## 
## Contrast: zona1_zona3 
## 
##      average       sd    ratio      ava   avb cumsum
## sph  0.15112  0.05332  2.83400  1.00000 31.52  0.194
## spd  0.13651  0.05541  2.46400 30.98000  3.40  0.369
## spb  0.13613  0.06598  2.06300 27.78000  0.60  0.544
## spj  0.12520  0.06703  1.86800  1.20000 27.24  0.704
## spk  0.10735  0.01280  8.38600  0.60000 21.96  0.842
## spi  0.03809  0.01408  2.70500  1.20000  8.60  0.891
## spa  0.03278  0.03559  0.92100 13.40000 18.42  0.933
## spc  0.02832  0.02625  1.07900  5.84000  1.00  0.969
## spf  0.01023  0.00952  1.07400  0.80000  2.00  0.982
## spg  0.00714  0.00643  1.11100  0.60000  1.40  0.991
## spe  0.00669  0.00715  0.93600  0.80000  1.00  1.000
## 
## Contrast: zona2_zona3 
## 
##      average       sd    ratio      ava   avb cumsum
## spg  0.16747  0.08629  1.94090 46.20000  1.40  0.236
## spf  0.12824  0.06937  1.84860 36.20000  2.00  0.417
## sph  0.11196  0.04482  2.49820  8.30000 31.52  0.576
## spj  0.09422  0.05339  1.76460  3.70000 27.24  0.709
## spk  0.07386  0.02551  2.89510  2.90000 21.96  0.813
## spa  0.04409  0.02179  2.02290 29.63000 18.42  0.875
## spe  0.04268  0.03117  1.36920 11.70000  1.00  0.935
## spi  0.02466  0.01246  1.97880  3.40000  8.60  0.970
## spd  0.01232  0.01183  1.04100  1.50000  3.40  0.988
## spc  0.00471  0.00412  1.14090  1.30000  1.00  0.994
## spb  0.00417  0.00376  1.11110  1.10000  0.60  1.000
## Permutation: free
## Number of permutations: 0

A nivel de zonas, la mayor diferencia se halló primeramente entre la zona 1 y la zona 2 en donde las especies spg (0.19433) y spf (0.15102) constituyeron los mayores contrastes. En segundo lugar, está la diferencia entre la zona 2 y la zona 3 en donde las especies spg (0.16747) y spf (0.12824). En tercer lugar, está la diferencia entre la zona 1 y la zona 3 en donde las especies sph (0.15112) y spd (0.13651), aparecen como las mas importantes.

4. Hipótesis Multivariada ANOSIM y PERMANOVA

## The following objects are masked from datos (pos = 3):
## 
##     site, Sitios, spa, spb, spc, spd, spe, spf, spg, sph, spi, spj, spk
## 
## Call:
## anosim(x = datos[, c(-1, -2)], grouping = site, permutations = 999,      distance = "bray", strata = NULL, parallel = getOption("mc.cores")) 
## Dissimilarity: bray 
## 
## ANOSIM statistic R: 0.8004 
##       Significance: 0.001 
## 
## Permutation: free
## Number of permutations: 999
## 
## Upper quantiles of permutations (null model):
##   90%   95% 97.5%   99% 
## 0.133 0.185 0.236 0.288 
## 
## Dissimilarity ranks between and within classes:
##         0%   25%   50% 75% 100%   N
## Between  1 90.00 122.0 157  190 125
## zona1   11 26.25  52.0  58   61  10
## zona2    4 21.00  38.0  56  163  45
## zona3    2  6.25  25.5  40   46  10

Lo que los datos arrojan son el R que es la significancia. En este caso es del 0.8004 el primero y de 0.001 el segundo. Esto quiere decir que hay diferencias en al menos una zona.

## Warning in (function (z, notch = FALSE, width = NULL, varwidth = FALSE, : some
## notches went outside hinges ('box'): maybe set notch=FALSE

La gráfica nos muestra la mayor diferencia entre zona1 y zona2 con una R=0.8 y P=0.001. A continuación procedemos a realizar la prueba PERMANOVA

##             1          2          3          4          5          6          7
## 2  0.51457317                                                                  
## 3  0.41503750 0.26303441                                                       
## 4  0.45943162 0.45943162 0.23446525                                            
## 5  0.26303441 0.26303441 0.16992500 0.37196878                                 
## 6  0.45943162 0.45943162 0.23446525 0.15200309 0.37196878                      
## 7  0.41503750 0.73696559 0.75899190 0.51457317 0.62148838 0.65207670           
## 8  0.32192809 0.32192809 0.37196878 0.28950662 0.23446525 0.28950662 0.51457317
## 9  0.41503750 0.55254102 0.32192809 0.08246216 0.32192809 0.23446525 0.46948528
## 10 0.37196878 0.23446525 0.28950662 0.21150411 0.28950662 0.21150411 0.41503750
## 11 0.51457317 0.51457317 0.26303441 0.32192809 0.41503750 0.16992500 0.73696559
## 12 0.36257008 0.51457317 0.26303441 0.32192809 0.41503750 0.32192809 0.58496250
## 13 0.45943162 0.32192809 0.37196878 0.28950662 0.37196878 0.15200309 0.51457317
## 14 0.58496250 0.58496250 0.75899190 0.51457317 0.75899190 0.51457317 0.48542683
## 15 0.26303441 0.41503750 0.32192809 0.37196878 0.32192809 0.37196878 0.46948528
## 16 0.29956028 0.46948528 0.51457317 0.55254102 0.51457317 0.41503750 0.71049338
## 17 0.41503750 0.41503750 0.45943162 0.23446525 0.32192809 0.37196878 0.29956028
## 18 0.51457317 0.36257008 0.26303441 0.16992500 0.41503750 0.32192809 0.58496250
## 19 0.45943162 0.16992500 0.23446525 0.28950662 0.23446525 0.28950662 0.65207670
## 20 0.26303441 0.41503750 0.32192809 0.37196878 0.16992500 0.23446525 0.62148838
##             8          9         10         11         12         13         14
## 2                                                                              
## 3                                                                              
## 4                                                                              
## 5                                                                              
## 6                                                                              
## 7                                                                              
## 8                                                                              
## 9  0.23446525                                                                  
## 10 0.21150411 0.28950662                                                       
## 11 0.45943162 0.41503750 0.37196878                                            
## 12 0.45943162 0.41503750 0.37196878 0.19264508                                 
## 13 0.28950662 0.37196878 0.07400058 0.32192809 0.45943162                      
## 14 0.51457317 0.62148838 0.41503750 0.58496250 0.58496250 0.36257008           
## 15 0.37196878 0.45943162 0.28950662 0.26303441 0.09310940 0.37196878 0.46948528
## 16 0.41503750 0.65207670 0.45943162 0.46948528 0.46948528 0.41503750 0.34792330
## 17 0.23446525 0.16992500 0.15200309 0.55254102 0.55254102 0.23446525 0.46948528
## 18 0.45943162 0.26303441 0.23446525 0.51457317 0.51457317 0.32192809 0.58496250
## 19 0.15200309 0.37196878 0.21150411 0.32192809 0.32192809 0.28950662 0.51457317
## 20 0.23446525 0.32192809 0.28950662 0.41503750 0.55254102 0.23446525 0.62148838
##            15         16         17         18         19
## 2                                                        
## 3                                                        
## 4                                                        
## 5                                                        
## 6                                                        
## 7                                                        
## 8                                                        
## 9                                                        
## 10                                                       
## 11                                                       
## 12                                                       
## 13                                                       
## 14                                                       
## 15                                                       
## 16 0.36257008                                            
## 17 0.45943162 0.65207670                                 
## 18 0.55254102 0.62148838 0.26303441                      
## 19 0.23446525 0.41503750 0.37196878 0.45943162           
## 20 0.45943162 0.36257008 0.32192809 0.41503750 0.37196878

El algoritmo nos arroja una matriz usando un índice de diversidad beta

Prueba PERMANOVA

## 'adonis' will be deprecated: use 'adonis2' instead
## $aov.tab
## Permutation: free
## Number of permutations: 200
## 
## Terms added sequentially (first to last)
## 
##           Df SumsOfSqs  MeanSqs F.Model     R2   Pr(>F)   
## site       2    0.5016 0.250799  3.7814 0.3079 0.004975 **
## Residuals 17    1.1275 0.066325         0.6921            
## Total     19    1.6291                  1.0000            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $call
## adonis(formula = betad ~ site, data = datos, permutations = 200)
## 
## $coefficients
## NULL
## 
## $coef.sites
##                    [,1]        [,2]       [,3]       [,4]        [,5]
## (Intercept)  0.37686206  0.42367121  0.3703569  0.3381194  0.36625679
## site1       -0.06434312  0.12053360  0.1835476  0.1444982  0.09934578
## site2        0.04688956 -0.09697783 -0.1150851 -0.1097459 -0.09578468
##                    [,6]        [,7]        [,8]       [,9]       [,10]
## (Intercept)  0.32436902  0.52372313  0.33908601  0.3804905  0.28174411
## site1        0.13074782 -0.07723391  0.06102942  0.1155127  0.10845229
## site2       -0.05184461  0.05675224 -0.08031196 -0.1252187 -0.04819713
##                   [,11]      [,12]       [,13]       [,14]      [,15]
## (Intercept) 0.389640347 0.38144551  0.31471880  0.49169376 0.33213071
## site1       0.154564464 0.12945877  0.08249672 -0.08373356 0.07267062
## site2       0.005160612 0.02855576 -0.01324373  0.09202375 0.05593624
##                   [,16]       [,17]      [,18]       [,19]       [,20]
## (Intercept)  0.43383468  0.36867881  0.4231879  0.33860270  0.36059263
## site1       -0.08972528  0.06293876  0.1210169  0.14401486  0.01312362
## site2        0.08835801 -0.08445635 -0.1254452 -0.08127859 -0.04272739
## 
## $f.perms
##               [,1]
##   [1,]  0.84933004
##   [2,]  1.78082837
##   [3,]  1.36347305
##   [4,]  1.27163201
##   [5,]  0.79734165
##   [6,]  0.16704101
##   [7,]  0.74427568
##   [8,]  1.75568115
##   [9,]  0.40071519
##  [10,]  2.07823450
##  [11,]  0.99384932
##  [12,]  1.04809568
##  [13,]  2.20221539
##  [14,]  1.05971453
##  [15,]  1.24250430
##  [16,]  0.75131888
##  [17,]  0.17169182
##  [18,]  1.47625226
##  [19,]  0.75858202
##  [20,]  1.28124766
##  [21,]  0.60871049
##  [22,]  1.12135962
##  [23,]  0.60870589
##  [24,]  1.51085237
##  [25,]  1.23186850
##  [26,]  1.75221378
##  [27,]  1.55729763
##  [28,]  0.78587474
##  [29,]  0.37921259
##  [30,]  1.09462004
##  [31,]  0.87222927
##  [32,]  0.38286955
##  [33,]  2.04863263
##  [34,]  0.86338177
##  [35,]  0.51706654
##  [36,]  0.74127152
##  [37,]  0.77419727
##  [38,]  0.54381616
##  [39,]  0.78398489
##  [40,]  0.56328721
##  [41,] -0.08183712
##  [42,]  0.63803441
##  [43,]  1.08561408
##  [44,]  1.80761236
##  [45,]  2.32938623
##  [46,]  0.73905501
##  [47,]  0.39978066
##  [48,]  0.72041308
##  [49,]  2.00765977
##  [50,]  0.85896374
##  [51,]  1.05480057
##  [52,]  0.92849537
##  [53,]  1.65285042
##  [54,]  0.79624331
##  [55,]  1.21586609
##  [56,]  1.78529827
##  [57,]  2.01085429
##  [58,]  1.19071370
##  [59,] -0.07523473
##  [60,]  0.93323988
##  [61,]  1.28125336
##  [62,]  0.79926471
##  [63,]  0.54438929
##  [64,]  0.76811824
##  [65,]  0.82458334
##  [66,]  1.65030415
##  [67,]  1.22850351
##  [68,]  1.42525166
##  [69,]  0.62422834
##  [70,]  1.58004213
##  [71,]  0.75584108
##  [72,]  0.94952498
##  [73,]  1.01861238
##  [74,]  0.60425036
##  [75,]  1.94061407
##  [76,]  0.79537380
##  [77,]  0.10672909
##  [78,]  1.69291613
##  [79,]  0.38782323
##  [80,]  1.62258493
##  [81,]  0.43403039
##  [82,]  0.44362465
##  [83,]  0.99711522
##  [84,]  1.27215799
##  [85,]  1.18091157
##  [86,]  1.08625767
##  [87,]  1.88122682
##  [88,]  1.07406377
##  [89,]  0.66685030
##  [90,]  1.03726385
##  [91,]  0.73656595
##  [92,]  1.76608451
##  [93,]  0.40113197
##  [94,]  0.97459568
##  [95,]  0.04842037
##  [96,]  1.81544556
##  [97,]  0.52434845
##  [98,]  1.68907937
##  [99,]  1.31198291
## [100,]  2.08003470
## [101,]  1.04251260
## [102,]  1.05467047
## [103,]  0.55934616
## [104,]  0.81231909
## [105,]  0.92518801
## [106,]  2.01170847
## [107,]  0.52639537
## [108,]  0.70344114
## [109,]  0.22862857
## [110,]  1.55445514
## [111,]  0.60680972
## [112,]  0.91963857
## [113,]  1.08973865
## [114,]  1.55462660
## [115,]  2.35480272
## [116,]  1.23099115
## [117,]  0.79805643
## [118,]  1.16260903
## [119,]  1.94258408
## [120,]  0.50510533
## [121,]  0.71524075
## [122,]  0.51984930
## [123,]  1.54473187
## [124,]  0.44403732
## [125,]  0.45508099
## [126,] -0.03777452
## [127,]  2.54124017
## [128,]  1.57867627
## [129,]  1.97103085
## [130,]  1.43009991
## [131,]  0.25007560
## [132,]  2.33636562
## [133,]  1.98430079
## [134,]  0.22461808
## [135,]  0.70424333
## [136,]  0.66349357
## [137,]  1.34037551
## [138,]  0.43434883
## [139,]  2.04695873
## [140,]  1.19396399
## [141,]  0.72763829
## [142,]  1.35618731
## [143,]  0.93859342
## [144,]  1.04564878
## [145,]  0.88827378
## [146,]  1.17339529
## [147,]  0.96539044
## [148,]  0.95904398
## [149,]  0.93188537
## [150,]  1.04587737
## [151,]  0.99560579
## [152,]  2.32723615
## [153,]  2.10444901
## [154,]  2.00202365
## [155,]  1.26222549
## [156,]  2.74109446
## [157,]  0.55463645
## [158,]  1.10931055
## [159,]  0.51525947
## [160,]  0.20304663
## [161,]  2.27245892
## [162,]  1.05497056
## [163,]  1.09992437
## [164,]  0.58000802
## [165,]  0.97336490
## [166,]  1.24441632
## [167,]  0.58008477
## [168,]  0.36693557
## [169,]  0.31748910
## [170,]  0.89489641
## [171,]  0.98687922
## [172,]  1.15957574
## [173,]  1.70993418
## [174,]  1.53024398
## [175,]  1.38910897
## [176,]  0.52768924
## [177,]  1.18202962
## [178,]  1.82819534
## [179,]  0.95704008
## [180,]  1.32198386
## [181,]  0.23059912
## [182,]  0.50001406
## [183,]  1.25565939
## [184,]  1.26499982
## [185,]  0.78531173
## [186,]  0.73478527
## [187,]  0.54306253
## [188,]  0.37944948
## [189,]  0.37344605
## [190,]  2.95274067
## [191,]  1.17833095
## [192,]  1.47523997
## [193,]  0.72988118
## [194,]  0.87175920
## [195,]  0.51553648
## [196,]  0.51249376
## [197,]  0.95053412
## [198,]  0.68155410
## [199,]  1.19605061
## [200,]  0.23146597
## 
## $model.matrix
##    (Intercept) site1 site2
## 1            1     1     0
## 2            1     0     1
## 3            1     0     1
## 4            1     0     1
## 5            1     0     1
## 6            1     0     1
## 7            1     1     0
## 8            1     0     1
## 9            1     0     1
## 10           1    -1    -1
## 11           1    -1    -1
## 12           1    -1    -1
## 13           1    -1    -1
## 14           1     1     0
## 15           1    -1    -1
## 16           1     1     0
## 17           1     0     1
## 18           1     0     1
## 19           1     0     1
## 20           1     1     0
## 
## $terms
## betad ~ site
## attr(,"variables")
## list(betad, site)
## attr(,"factors")
##       site
## betad    0
## site     1
## attr(,"term.labels")
## [1] "site"
## attr(,"order")
## [1] 1
## attr(,"intercept")
## [1] 1
## attr(,"response")
## [1] 1
## attr(,".Environment")
## <environment: R_GlobalEnv>
## 
## attr(,"class")
## [1] "adonis"

La prueba PERMANOVA halla diferencias significativas entre las zonas, a través de un p-value de 0.004975 **

2DA Parte: Métodos de Ordenación: Análisis de componentes Principales

Para el análisis de componentes pricipales usamos una base de datos libre disponible en R llamada cars

## Rows: 32 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (1): car
## dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## # A tibble: 10 × 12
##      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb car        
##    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>      
##  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4 Mazda RX4  
##  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4 Mazda RX4 …
##  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1 Datsun 710 
##  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1 Hornet 4 D…
##  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2 Hornet Spo…
##  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1 Valiant    
##  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4 Duster 360 
##  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2 Merc 240D  
##  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2 Merc 230   
## 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4 Merc 280

ACRÓNIMOS:

  • mpg: miles per galon
  • cyl: número de cilindros
  • disp: displacement
  • hp: caballos de fuerza
  • drat: rear axel ratio
  • wt: peso en libras
  • qsec: 1/4 mile time
  • vs: motor (0=v-Shape 1=streit)
  • am: transmisión (0=automático, 1=manual)
  • gear: número de velocidades
  • carb: número de carburadores.
##     Comp.1     Comp.2     Comp.3     Comp.4     Comp.5     Comp.6     Comp.7 
## 6.60840025 2.65046789 0.62719727 0.26959744 0.22345110 0.21159612 0.13526199 
##     Comp.8     Comp.9    Comp.10    Comp.11 
## 0.12290143 0.07704665 0.05203544 0.02204441

la información nos muestra los eigenvalues que nos indican la importancia de los componentes en la medida que elige los mayores de la unidad. Destaca el componente 1: 6.60 y componente 2: 2.65

## Importance of components:
##                           Comp.1    Comp.2     Comp.3     Comp.4     Comp.5
## Standard deviation     2.5706809 1.6280258 0.79195787 0.51922773 0.47270615
## Proportion of Variance 0.6007637 0.2409516 0.05701793 0.02450886 0.02031374
## Cumulative Proportion  0.6007637 0.8417153 0.89873322 0.92324208 0.94355581
##                            Comp.6     Comp.7     Comp.8      Comp.9     Comp.10
## Standard deviation     0.45999578 0.36777981 0.35057301 0.277572792 0.228112781
## Proportion of Variance 0.01923601 0.01229654 0.01117286 0.007004241 0.004730495
## Cumulative Proportion  0.96279183 0.97508837 0.98626123 0.993265468 0.997995963
##                            Comp.11
## Standard deviation     0.148473587
## Proportion of Variance 0.002004037
## Cumulative Proportion  1.000000000
## 
## Loadings:
##      Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 Comp.9 Comp.10
## mpg   0.363         0.226         0.103  0.109  0.368  0.754  0.236  0.139 
## cyl  -0.374         0.175               -0.169         0.231        -0.846 
## disp -0.368               -0.257  0.394  0.336  0.214         0.198        
## hp   -0.330  0.249 -0.140         0.540                0.222 -0.576  0.248 
## drat  0.294  0.275 -0.161 -0.855        -0.244                      -0.101 
## wt   -0.346 -0.143 -0.342 -0.246         0.465                0.359        
## qsec  0.200 -0.463 -0.403        -0.165  0.330         0.232 -0.528 -0.271 
## vs    0.307 -0.232 -0.429  0.215  0.600 -0.194 -0.266         0.359 -0.159 
## am    0.235  0.429  0.206                0.571 -0.587               -0.178 
## gear  0.207  0.462 -0.290  0.265         0.244  0.605 -0.336        -0.214 
## carb -0.214  0.414 -0.529  0.127 -0.361 -0.184 -0.175  0.396  0.171        
##      Comp.11
## mpg   0.125 
## cyl   0.141 
## disp -0.661 
## hp    0.256 
## drat        
## wt    0.567 
## qsec -0.181 
## vs          
## am          
## gear        
## carb -0.320

En seguida podemos observar que el componente 1 representa el 60% de la varianza de los datos, mientras que el componente 2 el 24% de la varianza. Ambos explican el 84% de la varianza de los datos.

La gráfica nos muestra que Camaro Z28 y Duster 360 comparten autos con un similar número de hp y cilindraje; Lotus Mazda y Porche comparten en transmisión y Rear axle ratio; Merc 240, Merc 230, Toyota corona, Hornet y Valiant comparten el 1/4 mile time y por último Merc 240, Merc 230, Toyota Corona, Hornet 4 Drive y Valiant coinciden en qsec.

##                      mpg cyl  disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4           21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4
## Mazda RX4 Wag       21.0   6 160.0 110 3.90 2.875 17.02  0  1    4    4
## Datsun 710          22.8   4 108.0  93 3.85 2.320 18.61  1  1    4    1
## Hornet 4 Drive      21.4   6 258.0 110 3.08 3.215 19.44  1  0    3    1
## Hornet Sportabout   18.7   8 360.0 175 3.15 3.440 17.02  0  0    3    2
## Valiant             18.1   6 225.0 105 2.76 3.460 20.22  1  0    3    1
## Duster 360          14.3   8 360.0 245 3.21 3.570 15.84  0  0    3    4
## Merc 240D           24.4   4 146.7  62 3.69 3.190 20.00  1  0    4    2
## Merc 230            22.8   4 140.8  95 3.92 3.150 22.90  1  0    4    2
## Merc 280            19.2   6 167.6 123 3.92 3.440 18.30  1  0    4    4
## Merc 280C           17.8   6 167.6 123 3.92 3.440 18.90  1  0    4    4
## Merc 450SE          16.4   8 275.8 180 3.07 4.070 17.40  0  0    3    3
## Merc 450SL          17.3   8 275.8 180 3.07 3.730 17.60  0  0    3    3
## Merc 450SLC         15.2   8 275.8 180 3.07 3.780 18.00  0  0    3    3
## Cadillac Fleetwood  10.4   8 472.0 205 2.93 5.250 17.98  0  0    3    4
## Lincoln Continental 10.4   8 460.0 215 3.00 5.424 17.82  0  0    3    4
## Chrysler Imperial   14.7   8 440.0 230 3.23 5.345 17.42  0  0    3    4
## Fiat 128            32.4   4  78.7  66 4.08 2.200 19.47  1  1    4    1
## Honda Civic         30.4   4  75.7  52 4.93 1.615 18.52  1  1    4    2
## Toyota Corolla      33.9   4  71.1  65 4.22 1.835 19.90  1  1    4    1
## Toyota Corona       21.5   4 120.1  97 3.70 2.465 20.01  1  0    3    1
## Dodge Challenger    15.5   8 318.0 150 2.76 3.520 16.87  0  0    3    2
## AMC Javelin         15.2   8 304.0 150 3.15 3.435 17.30  0  0    3    2
## Camaro Z28          13.3   8 350.0 245 3.73 3.840 15.41  0  0    3    4
## Pontiac Firebird    19.2   8 400.0 175 3.08 3.845 17.05  0  0    3    2
## Fiat X1-9           27.3   4  79.0  66 4.08 1.935 18.90  1  1    4    1
## Porsche 914-2       26.0   4 120.3  91 4.43 2.140 16.70  0  1    5    2
## Lotus Europa        30.4   4  95.1 113 3.77 1.513 16.90  1  1    5    2
## Ford Pantera L      15.8   8 351.0 264 4.22 3.170 14.50  0  1    5    4
## Ferrari Dino        19.7   6 145.0 175 3.62 2.770 15.50  0  1    5    6
## Maserati Bora       15.0   8 301.0 335 3.54 3.570 14.60  0  1    5    8
## Volvo 142E          21.4   4 121.0 109 4.11 2.780 18.60  1  1    4    2
##                                     car
## Mazda RX4                     Mazda RX4
## Mazda RX4 Wag             Mazda RX4 Wag
## Datsun 710                   Datsun 710
## Hornet 4 Drive           Hornet 4 Drive
## Hornet Sportabout     Hornet Sportabout
## Valiant                         Valiant
## Duster 360                   Duster 360
## Merc 240D                     Merc 240D
## Merc 230                       Merc 230
## Merc 280                       Merc 280
## Merc 280C                     Merc 280C
## Merc 450SE                   Merc 450SE
## Merc 450SL                   Merc 450SL
## Merc 450SLC                 Merc 450SLC
## Cadillac Fleetwood   Cadillac Fleetwood
## Lincoln Continental Lincoln Continental
## Chrysler Imperial     Chrysler Imperial
## Fiat 128                       Fiat 128
## Honda Civic                 Honda Civic
## Toyota Corolla           Toyota Corolla
## Toyota Corona             Toyota Corona
## Dodge Challenger       Dodge Challenger
## AMC Javelin                 AMC Javelin
## Camaro Z28                   Camaro Z28
## Pontiac Firebird       Pontiac Firebird
## Fiat X1-9                     Fiat X1-9
## Porsche 914-2             Porsche 914-2
## Lotus Europa               Lotus Europa
## Ford Pantera L           Ford Pantera L
## Ferrari Dino               Ferrari Dino
## Maserati Bora             Maserati Bora
## Volvo 142E                   Volvo 142E
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse
## Too few points to calculate an ellipse

Esta gráfica nos muestra con mayor claridad las características de los auto con la respectivas marcas. Por ejemplo, gear y am coinciden en Porche y Mada; mpg con Volvo y hp y cyl en CamaroZ28 y Duster 360