###################################
## Q7 — Modo R vs. Modo Q ##
## Autora: Victória Souza ##
###################################
Modo R.: Compara variáveis (colunas): opera sobre a matriz amostras×variáveis e investiga a dependência/associação entre descritores via correlação ou variância–covariância (matriz pxp). O objetivo é sintetizar redundâncias dos descritores em poucos eixos ortogonais (autovetores/autovalores), revelando gradientes ambientais e colinearidade. Exemplo: PCA (rda(amb, scale=TRUE)), que decompõe a matriz de correlações e projeta as amostras nos eixos definidos pelas variáveis (biplot).
# Exemplo R-script pca:
#Lendo os dados:
dados<-read.table("insetos.txt", h=T, sep="\t", dec=".")
dados
## UA Ambiente Gado Temperatura Cobertura.vegetal Proporcao.de.luz
## 1 1 Mata Primaria Presente 21.8 73 53.5
## 2 2 Mata Primaria Presente 21.5 59 61.5
## 3 3 Mata Primaria Ausente 21.7 78 53.0
## 4 4 Mata Primaria Ausente 19.7 74 56.0
## 5 5 Mata Primaria Presente 24.7 48 71.0
## 6 6 Mata Primaria Presente 20.2 75 60.5
## 7 7 Mata Primaria Ausente 23.0 78 57.0
## 8 8 Mata Primaria Presente 27.3 52 70.0
## 9 9 Mata Primaria Presente 23.3 40 70.0
## 10 10 Mata Primaria Ausente 26.7 52 68.0
## 11 11 Mata Primaria Ausente 21.5 69 61.5
## 12 12 Mata Secundaria Presente 29.5 27 82.5
## 13 13 Mata Secundaria Ausente 22.7 56 65.0
## 14 14 Mata Secundaria Ausente 31.2 35 81.5
## 15 15 Mata Secundaria Presente 30.0 36 81.0
## 16 16 Mata Secundaria Ausente 30.0 30 84.0
## 17 17 Mata Secundaria Presente 26.2 49 69.5
## 18 18 Mata Secundaria Ausente 26.2 49 75.5
## 19 19 Mata Secundaria Ausente 25.7 42 77.0
## 20 20 Mata Secundaria Presente 29.7 34 80.0
## Numero.de.flores sp.1 sp.2 sp.3 sp.4 sp.5 sp.6 sp.7 sp.8 sp.9 sp.10 sp.11
## 1 14 4 0 7 2 0 0 3 2 1 1 0
## 2 15 5 0 7 2 1 4 1 2 0 1 0
## 3 24 1 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 5 0 0 3
## 19 2 0 0 0 0 0
## 20 0 0 1 0 0 1
#Conferindo:
str(dados)
## 'data.frame': 20 obs. of 48 variables:
## $ UA : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Ambiente : chr "Mata Primaria" "Mata Primaria" "Mata Primaria" "Mata Primaria" ...
## $ Gado : chr "Presente" "Presente" "Ausente" "Ausente" ...
## $ Temperatura : num 21.8 21.5 21.7 19.7 24.7 20.2 23 27.3 23.3 26.7 ...
## $ Cobertura.vegetal: int 73 59 78 74 48 75 78 52 40 52 ...
## $ Proporcao.de.luz : num 53.5 61.5 53 56 71 60.5 57 70 70 68 ...
## $ Numero.de.flores : int 14 15 24 29 20 5 28 10 8 17 ...
## $ sp.1 : int 4 5 1 0 6 3 4 4 4 4 ...
## $ sp.2 : int 0 0 0 1 4 0 1 0 0 3 ...
## $ sp.3 : int 7 7 2 1 8 3 5 4 7 5 ...
## $ sp.4 : int 2 2 4 3 3 1 2 0 0 0 ...
## $ sp.5 : int 0 1 0 4 0 0 0 0 0 0 ...
## $ sp.6 : int 0 4 3 9 8 0 7 5 1 5 ...
## $ sp.7 : int 3 1 4 2 1 3 6 2 2 0 ...
## $ sp.8 : int 2 2 3 0 1 0 2 2 5 6 ...
## $ sp.9 : int 1 0 0 0 1 0 3 2 2 0 ...
## $ sp.10 : int 1 1 1 0 1 1 1 6 3 3 ...
## $ sp.11 : int 0 0 2 2 0 0 0 0 0 0 ...
## $ sp.12 : int 1 0 2 5 0 0 0 2 1 0 ...
## $ sp.13 : int 3 3 2 1 4 2 3 0 0 1 ...
## $ sp.14 : int 3 5 2 5 8 0 6 4 4 5 ...
## $ sp.15 : int 0 1 0 0 1 0 0 0 0 2 ...
## $ sp.16 : int 3 0 0 0 1 0 0 0 3 4 ...
## $ sp.17 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.18 : int 0 1 3 0 2 0 2 1 0 0 ...
## $ sp.19 : int 0 3 0 2 0 1 2 4 3 0 ...
## $ sp.20 : int 0 0 4 2 0 0 4 0 0 0 ...
## $ sp.21 : int 0 2 1 3 3 2 3 1 3 3 ...
## $ sp.22 : int 1 2 2 2 2 2 2 2 1 1 ...
## $ sp.23 : int 1 1 1 1 2 1 1 1 1 1 ...
## $ sp.24 : int 1 1 2 1 1 1 1 1 0 2 ...
## $ sp.25 : int 0 0 1 0 0 1 2 0 1 2 ...
## $ sp.26 : int 2 1 1 1 1 1 0 1 1 1 ...
## $ sp.27 : int 0 0 0 0 0 0 0 1 0 1 ...
## $ sp.28 : int 1 0 0 0 0 2 0 0 0 0 ...
## $ sp.29 : int 0 1 0 0 0 0 0 0 0 0 ...
## $ sp.30 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.31 : int 1 1 1 0 1 1 0 0 1 1 ...
## $ sp.32 : int 0 1 0 0 1 0 0 0 0 0 ...
## $ sp.33 : int 0 1 0 0 0 0 0 0 0 0 ...
## $ sp.34 : int 0 0 0 0 1 1 0 0 0 0 ...
## $ sp.35 : int 0 3 0 1 0 0 1 0 0 0 ...
## $ sp.36 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.37 : int 0 1 0 0 0 0 0 0 0 0 ...
## $ sp.38 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.39 : int 0 0 3 2 0 1 0 0 0 0 ...
## $ sp.40 : int 0 1 0 0 0 0 1 0 0 0 ...
## $ sp.41 : int 0 0 0 0 0 0 0 0 0 0 ...
#Separando em partes:
amb<-dados[ , 4:7] #Constrói a matriz amostras × variáveis, selecionando 4 variáveis ambientais (colunas)
bio<-dados[ , 8:48]
#Pacotes:
library(vegan)
## Carregando pacotes exigidos: permute
#PCA, na qual o argumento scale=T automaticamente irá padronizar os dados (matriz de correlações pxp): foco na associação entre descritores.
resultado.pca<-rda(amb, scale=T)
#Avaliando os resultados: Partitioning of correlations e autovalores (PC1, PC2, PC3, PC4)
summary(resultado.pca)
##
## Call:
## rda(X = amb, scale = T)
##
## Partitioning of correlations:
## Inertia Proportion
## Total 4 1
## Unconstrained 4 1
##
## Eigenvalues, and their contribution to the correlations
##
## Importance of components:
## PC1 PC2 PC3 PC4
## Eigenvalue 2.9688 0.8603 0.13929 0.031552
## Proportion Explained 0.7422 0.2151 0.03482 0.007888
## Cumulative Proportion 0.7422 0.9573 0.99211 1.000000
#Gráfico
biplot(resultado.pca)
Modo Q.: Compara amostras (linhas): transforma a matriz amostras×variáveis em uma matriz triangular de (dis)similaridade nxn entre linhas e ordena/agrupa as amostras segundo uma métrica ecológica. Base para explorar beta-diversidade e padrões de comunidade. Exemplo: nMDS (non-metric Multidimensional Scaling), que representa as amostras em baixa dimensão preservando a ordem das dissimilaridades (stress como medida de ajuste). Métricas usuais: Bray–Curtis para abundância (ignora duplos zeros e capta diferenças relativas); Jaccard/Sorensen para presença/ausência (não contam dupla ausência).
# Exemplo R-script nmds:
#Lendo od dados:
dados<-read.table("insetos.txt", h=T, sep="\t", dec=".")
#Conferindo:
str(dados)
## 'data.frame': 20 obs. of 48 variables:
## $ UA : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Ambiente : chr "Mata Primaria" "Mata Primaria" "Mata Primaria" "Mata Primaria" ...
## $ Gado : chr "Presente" "Presente" "Ausente" "Ausente" ...
## $ Temperatura : num 21.8 21.5 21.7 19.7 24.7 20.2 23 27.3 23.3 26.7 ...
## $ Cobertura.vegetal: int 73 59 78 74 48 75 78 52 40 52 ...
## $ Proporcao.de.luz : num 53.5 61.5 53 56 71 60.5 57 70 70 68 ...
## $ Numero.de.flores : int 14 15 24 29 20 5 28 10 8 17 ...
## $ sp.1 : int 4 5 1 0 6 3 4 4 4 4 ...
## $ sp.2 : int 0 0 0 1 4 0 1 0 0 3 ...
## $ sp.3 : int 7 7 2 1 8 3 5 4 7 5 ...
## $ sp.4 : int 2 2 4 3 3 1 2 0 0 0 ...
## $ sp.5 : int 0 1 0 4 0 0 0 0 0 0 ...
## $ sp.6 : int 0 4 3 9 8 0 7 5 1 5 ...
## $ sp.7 : int 3 1 4 2 1 3 6 2 2 0 ...
## $ sp.8 : int 2 2 3 0 1 0 2 2 5 6 ...
## $ sp.9 : int 1 0 0 0 1 0 3 2 2 0 ...
## $ sp.10 : int 1 1 1 0 1 1 1 6 3 3 ...
## $ sp.11 : int 0 0 2 2 0 0 0 0 0 0 ...
## $ sp.12 : int 1 0 2 5 0 0 0 2 1 0 ...
## $ sp.13 : int 3 3 2 1 4 2 3 0 0 1 ...
## $ sp.14 : int 3 5 2 5 8 0 6 4 4 5 ...
## $ sp.15 : int 0 1 0 0 1 0 0 0 0 2 ...
## $ sp.16 : int 3 0 0 0 1 0 0 0 3 4 ...
## $ sp.17 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.18 : int 0 1 3 0 2 0 2 1 0 0 ...
## $ sp.19 : int 0 3 0 2 0 1 2 4 3 0 ...
## $ sp.20 : int 0 0 4 2 0 0 4 0 0 0 ...
## $ sp.21 : int 0 2 1 3 3 2 3 1 3 3 ...
## $ sp.22 : int 1 2 2 2 2 2 2 2 1 1 ...
## $ sp.23 : int 1 1 1 1 2 1 1 1 1 1 ...
## $ sp.24 : int 1 1 2 1 1 1 1 1 0 2 ...
## $ sp.25 : int 0 0 1 0 0 1 2 0 1 2 ...
## $ sp.26 : int 2 1 1 1 1 1 0 1 1 1 ...
## $ sp.27 : int 0 0 0 0 0 0 0 1 0 1 ...
## $ sp.28 : int 1 0 0 0 0 2 0 0 0 0 ...
## $ sp.29 : int 0 1 0 0 0 0 0 0 0 0 ...
## $ sp.30 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.31 : int 1 1 1 0 1 1 0 0 1 1 ...
## $ sp.32 : int 0 1 0 0 1 0 0 0 0 0 ...
## $ sp.33 : int 0 1 0 0 0 0 0 0 0 0 ...
## $ sp.34 : int 0 0 0 0 1 1 0 0 0 0 ...
## $ sp.35 : int 0 3 0 1 0 0 1 0 0 0 ...
## $ sp.36 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.37 : int 0 1 0 0 0 0 0 0 0 0 ...
## $ sp.38 : int 0 0 0 0 0 0 0 0 0 0 ...
## $ sp.39 : int 0 0 3 2 0 1 0 0 0 0 ...
## $ sp.40 : int 0 1 0 0 0 0 1 0 0 0 ...
## $ sp.41 : int 0 0 0 0 0 0 0 0 0 0 ...
#Separando em partes:
amb<-dados[ , 4:7]
bio<-dados[ , 8:48] #Matriz amostras × espécies (linhas = sites; colunas = espécies)
bio
## sp.1 sp.2 sp.3 sp.4 sp.5 sp.6 sp.7 sp.8 sp.9 sp.10 sp.11 sp.12 sp.13 sp.14
## 1 4 0 7 2 0 0 3 2 1 1 0 1 3 3
## 2 5 0 7 2 1 4 1 2 0 1 0 0 3 5
## 3 1 0 2 4 0 3 4 3 0 1 2 2 2 2
## 4 0 1 1 3 4 9 2 0 0 0 2 5 1 5
## 5 6 4 8 3 0 8 1 1 1 1 0 0 4 8
## 6 3 0 3 1 0 0 3 0 0 1 0 0 2 0
## 7 4 1 5 2 0 7 6 2 3 1 0 0 3 6
## 8 4 0 4 0 0 5 2 2 2 6 0 2 0 4
## 9 4 0 7 0 0 1 2 5 2 3 0 1 0 4
## 10 4 3 5 0 0 5 0 6 0 3 0 0 1 5
## 11 0 3 5 1 2 7 3 4 0 0 0 3 0 6
## 12 6 0 9 2 3 4 0 3 3 3 3 0 4 6
## 13 5 2 7 8 2 20 4 1 2 2 11 9 6 13
## 14 4 5 10 7 5 14 0 7 5 1 3 2 5 12
## 15 6 0 10 4 2 8 0 4 5 3 4 3 5 9
## 16 4 1 6 5 5 17 0 6 2 0 6 4 4 11
## 17 5 0 4 6 1 8 3 3 2 2 5 1 5 6
## 18 4 1 4 7 4 14 3 5 2 2 8 3 5 9
## 19 6 1 4 8 0 12 0 3 3 0 7 6 7 8
## 20 5 1 4 4 1 2 1 5 6 0 5 0 4 3
## sp.15 sp.16 sp.17 sp.18 sp.19 sp.20 sp.21 sp.22 sp.23 sp.24 sp.25 sp.26
## 1 0 3 0 0 0 0 0 1 1 1 0 2
## 2 1 0 0 1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0 0 3
## 17 0 0 0 2 0 0 0 0 0 0 0 0
## 18 0 0 0 0 1 1 0 0 0 1 0 5
## 19 0 0 3 0 0 0 0 0 0 2 0 0
## 20 0 1 0 0 0 0 0 0 0 0 0 1
## sp.39 sp.40 sp.41
## 1 0 0 0
## 2 0 1 0
## 3 3 0 0
## 4 2 0 0
## 5 0 0 0
## 6 1 0 0
## 7 0 1 0
## 8 0 0 0
## 9 0 0 0
## 10 0 0 0
## 11 0 0 0
## 12 0 0 0
## 13 0 0 0
## 14 0 0 2
## 15 0 0 0
## 16 0 0 7
## 17 0 0 0
## 18 0 0 3
## 19 0 0 0
## 20 0 0 1
#Pacotes:
library(vegan)
#NMDS
#Criando a matriz de distância:
bio.bray<-vegdist(bio, method="bray") #Construção da matriz de (dis)similaridade n×n, a partir da distância entre amostras (Bray-Curtis, abundância)
#Executando a análise
resultado.nmds<-metaMDS(bio.bray)
## Run 0 stress 0.1174905
## Run 1 stress 0.1468697
## Run 2 stress 0.1174905
## ... New best solution
## ... Procrustes: rmse 5.994328e-06 max resid 1.924531e-05
## ... Similar to previous best
## Run 3 stress 0.1173347
## ... New best solution
## ... Procrustes: rmse 0.01085136 max resid 0.03827696
## Run 4 stress 0.1174905
## ... Procrustes: rmse 0.01085182 max resid 0.03825455
## Run 5 stress 0.1474343
## Run 6 stress 0.1174905
## ... Procrustes: rmse 0.01085057 max resid 0.03825196
## Run 7 stress 0.1575512
## Run 8 stress 0.1625869
## Run 9 stress 0.1468697
## Run 10 stress 0.1626549
## Run 11 stress 0.1174905
## ... Procrustes: rmse 0.01085041 max resid 0.03824881
## Run 12 stress 0.1173347
## ... Procrustes: rmse 5.103745e-05 max resid 0.0001633449
## ... Similar to previous best
## Run 13 stress 0.1800777
## Run 14 stress 0.1174905
## ... Procrustes: rmse 0.01085147 max resid 0.03825334
## Run 15 stress 0.1799474
## Run 16 stress 0.1468697
## Run 17 stress 0.1575511
## Run 18 stress 0.1468697
## Run 19 stress 0.1173347
## ... New best solution
## ... Procrustes: rmse 2.985499e-06 max resid 9.699731e-06
## ... Similar to previous best
## Run 20 stress 0.1174905
## ... Procrustes: rmse 0.01085156 max resid 0.03825323
## *** Best solution repeated 1 times
#Visualizando o resultado, gráfico:
plot(resultado.nmds)
## species scores not available
#Melhorando o gráfico, de acordo com contexto:
cores<-c("green4", "red4")
plot(resultado.nmds, type="n")
## species scores not available
points(resultado.nmds, col=cores[dados$Ambiente], pch=16)
ordihull(resultado.nmds, groups=dados$Ambiente, col=cores, lty=2)
text(resultado.nmds, labels = row.names(bio), pos=4)
resultado.envfit<-envfit(resultado.nmds, amb) #envfit projeta gradientes ambientais sobre o modo Q
resultado.envfit
##
## ***VECTORS
##
## NMDS1 NMDS2 r2 Pr(>r)
## Temperatura 0.60649 -0.79509 0.6568 0.001 ***
## Cobertura.vegetal -0.59103 0.80665 0.7202 0.001 ***
## Proporcao.de.luz 0.67408 -0.73866 0.6789 0.001 ***
## Numero.de.flores 0.86447 0.50268 0.8671 0.001 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Permutation: free
## Number of permutations: 999
plot(resultado.envfit) #o gráfico mostra sites (e envoltórios por grupo); as variáveis entram apenas como vetores de interpretação (envfit).