Recursos Varios

Software Necesarios

Textos Opcionales

Clases de Cursos Anteriores

NOTA: Son videos opcionales que pueden ver!

Archivos y Bases de Datos

Pruebas Estadísticas

Anuncio

Artículo de referencia (Datos sobre Consumo de O2 en Peces)

Abrir enlace en nueva ventana

Anuncio

# Peces en tratamiento de temperatura Ambiente
Amb5 <-rnorm(35, 0.134, 0.029)
Amb10 <-rnorm(35, 0.104, 0.031)
Amb15 <-rnorm(35, 0.109, 0.037)
Amb20 <-rnorm(35, 0.179, 0.076)
Amb25 <-rnorm(35, 0.082, 0.03)

# Peces en tratamiento de temperatura Incrementada
IT5 <-rnorm(35, 0.02, 0.008)
IT10 <-rnorm(35, 0.023, 0.006)
IT15 <-rnorm(35, 0.055, 0.021)
IT20 <-rnorm(35, 0.021, 0.008)
IT25 <-rnorm(35, 0.135, 0.078)

# Comenzamos a armar nuestra base de datos
Tratamiento <-c(rep("Ambiente", 175), rep("Incrementada", 175))
Tiempo <-c(rep(5, 35), rep(10, 35), rep(15, 35), rep(20, 35), rep(25, 35), 
           rep(5, 35), rep(10, 35), rep(15, 35), rep(20, 35), rep(25, 35))
ConsumoO2 <- c(Amb5, Amb10, Amb15, Amb20, Amb25,
               IT5, IT10, IT15, IT20, IT25)

Datos <- data.frame(Tratamiento, Tiempo, ConsumoO2)

library(ggplot2)
ggplot(Datos, aes(x = as.factor(Tiempo), y= ConsumoO2, fill = Tratamiento)) + 
  stat_boxplot(alpha = 0.8, colour = "#474747", outlier.colour = 1) + 
  stat_boxplot(geom = "errorbar") + theme_minimal() +
  labs(title = "Consumo de O2 en Peces a distintas temperaturas",
       x = "Tiempo",
       y = "Consumo de O2")  

Amb5 <- Datos[Datos$Tratamiento=="Ambiente" & Datos$Tiempo== "5","ConsumoO2"]
Amb10 <-Datos[Datos$Tratamiento=="Ambiente" & Datos$Tiempo== "10","ConsumoO2"]
Amb15 <-Datos[Datos$Tratamiento=="Ambiente" & Datos$Tiempo== "15","ConsumoO2"]
Amb20 <-Datos[Datos$Tratamiento=="Ambiente" & Datos$Tiempo== "20","ConsumoO2"]
Amb25 <-Datos[Datos$Tratamiento=="Ambiente" & Datos$Tiempo== "25","ConsumoO2"]

IT5 <- Datos[Datos$Tratamiento=="Incrementada" & Datos$Tiempo== "5","ConsumoO2"]
IT10 <-Datos[Datos$Tratamiento=="Incrementada" & Datos$Tiempo== "10","ConsumoO2"]
IT15 <-Datos[Datos$Tratamiento=="Incrementada" & Datos$Tiempo== "15","ConsumoO2"]
IT20 <-Datos[Datos$Tratamiento=="Incrementada" & Datos$Tiempo== "20","ConsumoO2"]
IT25 <-Datos[Datos$Tratamiento=="Incrementada" & Datos$Tiempo== "25","ConsumoO2"]

Datos <- data.frame(Amb5, Amb10, Amb15, Amb20, Amb25,
                    IT5, IT10, IT15, IT20, IT25)


library(MVN)
library(kableExtra)
NORM<-mvn(Datos)
Normalidad<- as.matrix(NORM$univariate_normality)
Normalidad
##       Test               Variable Statistic p.value Normality 
##  [1,] "Anderson-Darling" "Amb5"   "0.528"   "0.166" "✓ Normal"
##  [2,] "Anderson-Darling" "Amb10"  "0.584"   "0.119" "✓ Normal"
##  [3,] "Anderson-Darling" "Amb15"  "0.181"   "0.907" "✓ Normal"
##  [4,] "Anderson-Darling" "Amb20"  "0.328"   "0.506" "✓ Normal"
##  [5,] "Anderson-Darling" "Amb25"  "0.177"   "0.914" "✓ Normal"
##  [6,] "Anderson-Darling" "IT5"    "0.225"   "0.807" "✓ Normal"
##  [7,] "Anderson-Darling" "IT10"   "0.351"   "0.449" "✓ Normal"
##  [8,] "Anderson-Darling" "IT15"   "0.537"   "0.157" "✓ Normal"
##  [9,] "Anderson-Darling" "IT20"   "0.406"   "0.334" "✓ Normal"
## [10,] "Anderson-Darling" "IT25"   "0.252"   "0.720" "✓ Normal"
Descriptiva<- as.matrix(NORM$descriptives)
N3<- data.frame(Descriptiva)
Descriptiva<- kable(N3, format = "markdown")
Descriptiva
Variable n Mean Std.Dev Median Min Max X25th X75th Skew Kurtosis
Amb5 35 0.139 0.028 0.131 0.087 0.212 0.118 0.163 0.432 2.562
Amb10 35 0.099 0.033 0.092 0.041 0.174 0.075 0.118 0.559 2.836
Amb15 35 0.113 0.036 0.115 0.038 0.181 0.093 0.139 -0.083 2.250
Amb20 35 0.143 0.048 0.144 0.041 0.248 0.114 0.166 0.218 2.968
Amb25 35 0.079 0.032 0.080 0.003 0.145 0.058 0.101 -0.095 2.621
IT5 35 0.024 0.010 0.023 0.004 0.047 0.017 0.030 0.260 2.557
IT10 35 0.023 0.008 0.023 -0.001 0.037 0.018 0.028 -0.699 3.966
IT15 35 0.061 0.021 0.063 0.028 0.109 0.044 0.080 0.105 2.057
IT20 35 0.022 0.007 0.020 0.010 0.037 0.017 0.028 0.302 2.235
IT25 35 0.128 0.069 0.126 0.010 0.285 0.081 0.171 0.365 2.508

SIMULACION DE DATOS

### SIMULACION DE DATOS
# Variables

Especie <- c(rep("Carollia perspicillata", 20), rep("Carollia brevicaudum", 20), 
             rep("Carollia castanea", 20))

Edad <- c(rep("Adulto", 10), rep("Juvenil", 10),
             rep("Adulto", 10), rep("Juvenil", 10),
             rep("Adulto", 10), rep("Juvenil", 10))

Sexo<- c(rep("Hembra", 5), rep("Macho", 5),
          rep("Hembra", 5), rep("Macho", 5),
          rep("Hembra", 5), rep("Macho", 5))

Color<-c(rep(0, 40), rep(1, 20))

Cuerpo <-rnorm(60, 45, 0.029)
Antebrazo <-rnorm(60, 45, 0.029)
Trago <-rnorm(60, 45, 0.029)
Orejas <-rnorm(60, 45, 0.029)
Cola <-rnorm(60, 45, 0.029)
Pata <-rnorm(60, 45, 0.029)
Tibia <-rnorm(60, 45, 0.029)
Calcar <-rnorm(60, 45, 0.029)


Datos<-data.frame(Especie, Edad, Sexo, Color, Cuerpo, 
                  Antebrazo, Trago, Orejas, Cola, Pata, Tibia, Calcar)

# Instala y carga paquetes
if (!requireNamespace("ggfortify", quietly = TRUE)) {
  install.packages("ggfortify")
}
library(ggfortify)
library(ggplot2)

# Cargar tus datos simulados
# (Aquí colocas el código que proporcionaste para crear el data frame "Datos")

# Realizar el PCA para el grupo "Adulto"
pca_adulto_result <- prcomp(Datos[Datos$Edad == "Adulto", -(1:3)], scale = TRUE)

# Crear el gráfico interactivo para el grupo "Adulto"
pca_plot_adulto <- autoplot(pca_adulto_result, data = Datos[Datos$Edad == "Adulto", ],
                            colour = 'Especie', shape = 'Sexo', size=2,
                            loadings = TRUE, loadings.colour = 'blue',
                            loadings.label = TRUE, loadings.label.size = 3) +
  theme_minimal() + stat_ellipse(aes(group = Especie, colour = Especie), alpha = 0.5) +
  scale_fill_manual(values = c("red", "green", "blue"))

# Realizar el PCA para el grupo "Juvenil"
pca_juvenil_result <- prcomp(Datos[Datos$Edad == "Juvenil", -(1:3)], scale = TRUE)

# Crear el gráfico interactivo para el grupo "Juvenil"
pca_plot_juvenil <- autoplot(pca_juvenil_result, data = Datos[Datos$Edad == "Juvenil", ],
                             colour = 'Especie', shape = 'Sexo', size=2,
                             loadings = TRUE, loadings.colour = 'blue',
                             loadings.label = TRUE, loadings.label.size = 3) +
  theme_minimal() + stat_ellipse(aes(group = Especie, colour = Especie), alpha = 0.5) +
  scale_fill_manual(values = c("red", "green", "blue"))


# Mostrar los gráficos
pca_plot_adulto

pca_plot_juvenil

Ahora con mis datos

## Cargar base datos
library(readxl)
Datos = read_excel("/Users/yoss/Desktop/Cursos 2025/CursoCoiba2025/Bases.xlsx", sheet= "Murcielagos")
attach(Datos)


# Instala y carga paquetes
if (!requireNamespace("ggfortify", quietly = TRUE)) {
  install.packages("ggfortify")
}
library(ggfortify)
library(ggplot2)

# Cargar tus datos simulados
# (Aquí colocas el código que proporcionaste para crear el data frame "Datos")

# Realizar el PCA para el grupo "Adulto"
pca_adulto_result <- prcomp(Datos[Datos$Edad == "Adulto", -(1:3)], scale = TRUE)

# Crear el gráfico interactivo para el grupo "Adulto"
pca_plot_adulto <- autoplot(pca_adulto_result, data = Datos[Datos$Edad == "Adulto", ],
                            colour = 'Especie', shape = 'Sexo', size=2,
                            loadings = TRUE, loadings.colour = 'blue',
                            loadings.label = TRUE, loadings.label.size = 3) +
  theme_minimal() + stat_ellipse(aes(group = Especie, colour = Especie), alpha = 0.5) +
  scale_fill_manual(values = c("red", "green", "blue"))

# Realizar el PCA para el grupo "Juvenil"
pca_juvenil_result <- prcomp(Datos[Datos$Edad == "Juvenil", -(1:3)], scale = TRUE)

# Crear el gráfico interactivo para el grupo "Juvenil"
pca_plot_juvenil <- autoplot(pca_juvenil_result, data = Datos[Datos$Edad == "Juvenil", ],
                             colour = 'Especie', shape = 'Sexo', size=2,
                             loadings = TRUE, loadings.colour = 'blue',
                             loadings.label = TRUE, loadings.label.size = 3) +
  theme_minimal() + stat_ellipse(aes(group = Especie, colour = Especie), alpha = 0.5) +
  scale_fill_manual(values = c("red", "green", "blue"))


# Mostrar los gráficos
pca_plot_adulto

pca_plot_juvenil

Análisis de diversidad en R

Descripción general

El análisis de diversidad alfa y beta en R permite cuantificar y comparar la biodiversidad dentro y entre comunidades ecológicas. La diversidad alfa evalúa la riqueza y equitatividad de especies en una sola muestra o sitio, usando índices como Shannon, Simpson y riqueza observada. La diversidad beta, en cambio, mide la diferenciación entre comunidades, comúnmente a través de distancias como Bray-Curtis o Jaccard, y se visualiza con métodos como análisis de coordenadas principales (PCoA) o NMDS. En R, paquetes como vegan (el más completo para ecología), phyloseq (para microbiomas), iNEXT (estimación de diversidad extrapolada) y betapart (para particionar diversidad beta) ofrecen herramientas robustas para estos análisis. Estas herramientas permiten no solo calcular métricas, sino también realizar pruebas estadísticas y generar visualizaciones para interpretar patrones de diversidad biológica de manera clara y reproducible.

Recursos:

Paquetes necesarios

Estos son los paquetes que emplearemos en nuestra práctica, es necesario instalarlos, para eso copia el código en R y ejecutalo solo una vez. Importante: Es necesario eliminar el # antes de install.packages

# install.packages(c("kableExtra", "vegan", "ggplot2", "readxl","MASS", "grid", "gridExtra", "iNEXT", "knitr", "pheatmap", "tidyverse"))

Diversidad Alpha

## Diversidad Alpha
library(readxl)
data = read_excel("/Users/yoss/Desktop/Cursos 2025/CursoCoiba2025/Bases.xlsx", 
                  sheet= "DIV")

library(kableExtra)
library(vegan)
library(ggplot2)

Sitios<-data$SITIO
Datos<-data[2:62]
rownames(Datos) <- Sitios

H <- diversity(Datos, index = "shannon")
D <- diversity(Datos, index = "simpson")
S <- specnumber(Datos)
J <- H/log(specnumber(Datos))
indices <- data.frame(S,H,D,J)
Diversidad<- kable(indices, format = "markdown", col.names = c("S, Riqueza", "H, Shannon", "D, Simpson", "J, Igualdad"))
Diversidad
S, Riqueza H, Shannon D, Simpson J, Igualdad
A1PND 30 2.4786328 0.8726869 0.7287530
A2PNOTH 30 2.5483579 0.8921638 0.7492532
A3CA 39 2.7614279 0.9049702 0.7537550
A3CJ 42 2.7186577 0.8957261 0.7273670
A4PNS 35 2.4139310 0.8608707 0.6789577
A5MFCA 22 2.5712088 0.8961546 0.8318258
A6BCI 44 2.4269965 0.8530377 0.6413517
A7EC 6 0.3991046 0.1560208 0.2227445
A7LP 7 1.2316532 0.6257396 0.6329445
A7BA 6 1.2968441 0.6050000 0.7237825
A7P 6 1.0982180 0.5162500 0.6129271
A7J 9 0.7101320 0.2744146 0.3231950
A7LT 7 1.0450646 0.5072544 0.5370570
A7M 7 1.7779756 0.8088643 0.9136987
A8BCI 44 2.4211607 0.8513675 0.6398095
A8CC 44 2.6451590 0.8987074 0.6990028
A9PR 29 3.1132040 0.9457645 0.9245413
A9CC 31 3.1275921 0.9439981 0.9107757
A9SR 28 3.1030164 0.9453352 0.9312203
A10US 15 1.8080025 0.7222577 0.6676399
A11MAN 14 1.4737588 0.6812877 0.5584414
A12TU 22 1.9244618 0.7397816 0.6225931
A13SR 19 2.3513439 0.8605605 0.7985711

Diversidad Beta

## Diversidad Beta
# betadiver(Datos,"w")
# rankindex(scale(Datos), Datos, c("euc","man","bray","jac","kul"))
dis <- vegdist(Datos)
groups <- factor(c(rep("ZonaA", 12), rep("ZonaB", 11)))

# Grafiquemos
library(ggplot2)
library(grid)
mod <- betadisper(dis, groups)
mod
## 
##  Homogeneity of multivariate dispersions
## 
## Call: betadisper(d = dis, group = groups)
## 
## No. of Positive Eigenvalues: 20
## No. of Negative Eigenvalues: 2
## 
## Average distance to median:
##  ZonaA  ZonaB 
## 0.5550 0.5711 
## 
## Eigenvalues for PCoA axes:
## (Showing 8 of 22 eigenvalues)
##  PCoA1  PCoA2  PCoA3  PCoA4  PCoA5  PCoA6  PCoA7  PCoA8 
## 1.9770 1.3418 1.2693 0.6842 0.5458 0.4508 0.3319 0.2762
anova(mod)
## Analysis of Variance Table
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq F value Pr(>F)
## Groups     1 0.001482 0.0014818  0.1608 0.6924
## Residuals 21 0.193477 0.0092132
permutest(mod, pairwise = TRUE, permutations = 99)
## 
## Permutation test for homogeneity of multivariate dispersions
## Permutation: free
## Number of permutations: 99
## 
## Response: Distances
##           Df   Sum Sq   Mean Sq      F N.Perm Pr(>F)
## Groups     1 0.001482 0.0014818 0.1608     99   0.69
## Residuals 21 0.193477 0.0092132                     
## 
## Pairwise comparisons:
## (Observed p-value below diagonal, permuted p-value above diagonal)
##         ZonaA ZonaB
## ZonaA          0.72
## ZonaB 0.69244
plot(mod)

all.mds <- metaMDS(dis)
## Run 0 stress 0.07189239 
## Run 1 stress 0.1083431 
## Run 2 stress 0.108343 
## Run 3 stress 0.07189237 
## ... New best solution
## ... Procrustes: rmse 3.730965e-05  max resid 0.000104109 
## ... Similar to previous best
## Run 4 stress 0.07883568 
## Run 5 stress 0.2609005 
## Run 6 stress 0.07189235 
## ... New best solution
## ... Procrustes: rmse 3.718082e-05  max resid 9.589451e-05 
## ... Similar to previous best
## Run 7 stress 0.1284197 
## Run 8 stress 0.07975911 
## Run 9 stress 0.1063086 
## Run 10 stress 0.07189235 
## ... Procrustes: rmse 2.756981e-05  max resid 6.767794e-05 
## ... Similar to previous best
## Run 11 stress 0.07875407 
## Run 12 stress 0.07189236 
## ... Procrustes: rmse 4.545411e-05  max resid 0.0001322743 
## ... Similar to previous best
## Run 13 stress 0.07189237 
## ... Procrustes: rmse 7.532812e-05  max resid 0.0002104766 
## ... Similar to previous best
## Run 14 stress 0.07875404 
## Run 15 stress 0.07189234 
## ... New best solution
## ... Procrustes: rmse 3.438752e-05  max resid 0.0001167838 
## ... Similar to previous best
## Run 16 stress 0.07875412 
## Run 17 stress 0.1267305 
## Run 18 stress 0.1309886 
## Run 19 stress 0.07189235 
## ... Procrustes: rmse 4.281456e-05  max resid 0.0001441852 
## ... Similar to previous best
## Run 20 stress 0.07189235 
## ... Procrustes: rmse 1.757168e-05  max resid 5.424832e-05 
## ... Similar to previous best
## *** Best solution repeated 3 times
data.scores <- as.data.frame(scores(all.mds))  
data.scores$site <- rownames(data.scores)  

ggplot(data=data.scores) +
  geom_point(aes(x=NMDS1,y=NMDS2,colour=groups),size=3.5) + 
  theme(panel.background = element_rect(fill = "transparent", color = "black", size = 0.5))

Rarefacción

# Rarefaccion
library(readxl)
data = read_excel("/Users/yoss/Desktop/Cursos 2025/CursoCoiba2025/Bases.xlsx", 
                  sheet= "RARE")

attach(data)
Datos<-list(A1PND= A1PND, A2PNOTH=A2PNOTH, A3CA=A3CA, 
            A3CJ =A3CJ , A4PNS=A4PNS , A5MFCA=A5MFCA)

library(iNEXT); library(ggplot2); library(gridExtra)

iNEXT(Datos, q=0, datatype="abundance")
## Compare 6 assemblages with Hill number order q = 0.
## $class: iNEXT
## 
## $DataInfo: basic data information
##   Assemblage   n S.obs     SC f1 f2 f3 f4 f5 f6 f7 f8 f9 f10
## 1      A1PND  31     4 0.9698  1  1  1  0  0  0  0  0  0   0
## 2    A2PNOTH 140     8 0.9859  2  2  1  0  0  0  1  1  0   0
## 3       A3CA  38     5 1.0000  1  0  1  2  0  0  0  0  0   0
## 4       A3CJ 196     9 0.9949  1  1  0  1  1  0  1  0  1   0
## 5      A4PNS  79     4 1.0000  0  0  0  1  0  0  0  0  0   0
## 6     A5MFCA  11     1 1.0000  0  0  0  0  0  0  0  0  0   0
## 
## $iNextEst: diversity estimates with rarefied and extrapolated samples.
## $size_based (LCL and UCL are obtained for fixed size.)
## 
##     Assemblage   m        Method Order.q       qD   qD.LCL    qD.UCL        SC
## 1        A1PND   1   Rarefaction       0 1.000000 1.000000  1.000000 0.6537634
## 10       A1PND  15   Rarefaction       0 3.101224 1.993289  4.209158 0.9121246
## 20       A1PND  31      Observed       0 4.000000 2.499478  5.500522 0.9697581
## 30       A1PND  46 Extrapolation       0 4.300091 2.320038  6.280143 0.9885137
## 40       A1PND  62 Extrapolation       0 4.418432 2.063913  6.772950 0.9959100
## 41     A2PNOTH   1   Rarefaction       0 1.000000 1.000000  1.000000 0.6910586
## 50     A2PNOTH  70   Rarefaction       0 6.371458 4.956091  7.786826 0.9652610
## 60     A2PNOTH 140      Observed       0 8.000000 5.994955 10.005045 0.9859169
## 70     A2PNOTH 206 Extrapolation       0 8.606132 5.975847 11.236418 0.9945145
## 80     A2PNOTH 280 Extrapolation       0 8.858493 5.710939 12.006047 0.9980941
## 81        A3CA   1   Rarefaction       0 1.000000 1.000000  1.000000 0.4836415
## 90        A3CA  19   Rarefaction       0 4.280116 3.366847  5.193384 0.9334383
## 100       A3CA  38      Observed       0 5.000000 3.795697  6.204303 1.0000000
## 110       A3CA  56 Extrapolation       0 5.000000 3.543221  6.456779 1.0000000
## 120       A3CA  76 Extrapolation       0 5.000000 3.372453  6.627547 1.0000000
## 121       A3CJ   1   Rarefaction       0 1.000000 1.000000  1.000000 0.4172161
## 130       A3CJ  98   Rarefaction       0 8.152356 7.152778  9.151934 0.9851780
## 140       A3CJ 196      Observed       0 9.000000 7.558638 10.441362 0.9949498
## 150       A3CJ 289 Extrapolation       0 9.304870 7.266580 11.343160 0.9980449
## 160       A3CJ 392 Extrapolation       0 9.430128 6.891015 11.969240 0.9993165
## 161      A4PNS   1   Rarefaction       0 1.000000 1.000000  1.000000 0.3300876
## 170      A4PNS  39   Rarefaction       0 3.939167 3.626087  4.252247 0.9939147
## 180      A4PNS  79      Observed       0 4.000000 4.000000  4.000000 1.0000000
## 190      A4PNS 116 Extrapolation       0 4.000000 4.000000  4.000000 1.0000000
## 200      A4PNS 158 Extrapolation       0 4.000000 4.000000  4.000000 1.0000000
## 201     A5MFCA   1   Rarefaction       0 1.000000 1.000000  1.000000 1.0000000
## 206     A5MFCA   6   Rarefaction       0 1.000000 1.000000  1.000000 1.0000000
## 211     A5MFCA  11      Observed       0 1.000000 1.000000  1.000000 1.0000000
## 217     A5MFCA  17 Extrapolation       0 1.000000 1.000000  1.000000 1.0000000
## 222     A5MFCA  22 Extrapolation       0 1.000000 1.000000  1.000000 1.0000000
##        SC.LCL    SC.UCL
## 1   0.4326278 0.8748991
## 10  0.8655462 0.9587030
## 20  0.9073216 1.0000000
## 30  0.9516339 1.0000000
## 40  0.9739163 1.0000000
## 41  0.5846665 0.7974507
## 50  0.9515195 0.9790025
## 60  0.9707416 1.0000000
## 70  0.9836338 1.0000000
## 80  0.9906052 1.0000000
## 81  0.2948806 0.6724024
## 90  0.8923307 0.9745460
## 100 0.9637836 1.0000000
## 110 0.9819274 1.0000000
## 120 0.9904213 1.0000000
## 121 0.3424920 0.4919403
## 130 0.9766390 0.9937170
## 140 0.9845329 1.0000000
## 150 0.9910030 1.0000000
## 160 0.9945956 1.0000000
## 161 0.2846285 0.3755467
## 170 0.9854157 1.0000000
## 180 1.0000000 1.0000000
## 190 1.0000000 1.0000000
## 200 1.0000000 1.0000000
## 201 1.0000000 1.0000000
## 206 1.0000000 1.0000000
## 211 1.0000000 1.0000000
## 217 1.0000000 1.0000000
## 222 1.0000000 1.0000000
## 
## NOTE: The above output only shows five estimates for each assemblage; call iNEXT.object$iNextEst$size_based to view complete output.
## 
## $coverage_based (LCL and UCL are obtained for fixed coverage; interval length is wider due to varying size in bootstraps.)
## 
##     Assemblage        SC   m        Method Order.q       qD    qD.LCL    qD.UCL
## 1        A1PND 0.6537654   1   Rarefaction       0 1.000002 0.0000000  2.138472
## 10       A1PND 0.9121245  15   Rarefaction       0 3.101222 1.1164986  5.085945
## 20       A1PND 0.9697581  31      Observed       0 4.000000 1.5659879  6.434012
## 30       A1PND 0.9885137  46 Extrapolation       0 4.300091 1.5378401  7.062341
## 40       A1PND 0.9959100  62 Extrapolation       0 4.418432 1.5136830  7.323180
## 41     A2PNOTH 0.6910586   1   Rarefaction       0 1.000000 0.9046894  1.095311
## 50     A2PNOTH 0.9652610  70   Rarefaction       0 6.371458 4.4742488  8.268667
## 60     A2PNOTH 0.9859169 140      Observed       0 8.000000 5.0358979 10.964102
## 70     A2PNOTH 0.9945145 206 Extrapolation       0 8.606132 4.8947566 12.317508
## 80     A2PNOTH 0.9980941 280 Extrapolation       0 8.858493 4.7353271 12.981659
## 81        A3CA 0.4836478   1   Rarefaction       0 1.000012 0.6805995  1.319424
## 85        A3CA 0.8401129   9   Rarefaction       0 3.160173 1.9973377  4.323009
## 90        A3CA 0.9334384  19   Rarefaction       0 4.280116 3.0431409  5.517091
## 95        A3CA 0.9688478  29   Rarefaction       0 4.749787 3.2269747  6.272600
## 100       A3CA 1.0000000  38      Observed       0 5.000000 3.1510809  6.848919
## 101       A3CJ 0.4172180   1   Rarefaction       0 1.000004 0.9062353  1.093773
## 110       A3CJ 0.9851780  98   Rarefaction       0 8.152356 6.2493480 10.055363
## 120       A3CJ 0.9949498 196      Observed       0 9.000000 6.1065553 11.893445
## 130       A3CJ 0.9980449 289 Extrapolation       0 9.304870 5.9678009 12.641940
## 140       A3CJ 0.9993165 392 Extrapolation       0 9.430128 5.8980864 12.962169
## 141      A4PNS 0.3300876   1   Rarefaction       0 1.000000 0.9408080  1.059192
## 145      A4PNS 0.9738002  18   Rarefaction       0 3.639067 3.1943257  4.083808
## 150      A4PNS 0.9939147  39   Rarefaction       0 3.939167 3.8536926  4.024642
## 155      A4PNS 0.9994569  60   Rarefaction       0 3.997420 3.8787638  4.116077
## 159      A4PNS 1.0000000  79      Observed       0 4.000000 4.0000000  4.000000
## 160     A5MFCA 1.0000000  11      Observed       0 1.000000 1.0000000  1.000000
## 
## NOTE: The above output only shows five estimates for each assemblage; call iNEXT.object$iNextEst$coverage_based to view complete output.
## 
## $AsyEst: asymptotic diversity estimates along with related statistics.
##    Assemblage         Diversity Observed Estimator      s.e.      LCL       UCL
## 1       A1PND  Species richness 4.000000  4.483871 1.7893317 4.000000  7.990897
## 2       A1PND Shannon diversity 1.987909  2.120394 0.4160462 1.304959  2.935830
## 3       A1PND Simpson diversity 1.503912  1.529605 0.2506079 1.038423  2.020788
## 4     A2PNOTH  Species richness 8.000000  8.992857 2.8882294 8.000000 14.653683
## 5     A2PNOTH Shannon diversity 2.103256  2.172040 0.2490093 1.683991  2.660090
## 6     A2PNOTH Simpson diversity 1.442449  1.447055 0.1130699 1.225442  1.668668
## 7        A3CA  Species richness 5.000000  5.000000 0.7717147 5.000000  6.512533
## 8        A3CA Shannon diversity 2.800445  2.963235 0.4178010 2.144360  3.782110
## 9        A3CA Simpson diversity 2.011142  2.067647 0.3569245 1.368088  2.767206
## 10       A3CJ  Species richness 9.000000  9.497449 1.6318716 9.000000 12.695859
## 11       A3CJ Shannon diversity 3.628418  3.713553 0.2649074 3.194344  4.232762
## 12       A3CJ Simpson diversity 2.379879  2.396839 0.1836921 2.036809  2.756869
## 13      A4PNS  Species richness 4.000000  4.000000 0.1714466 4.000000  4.336029
## 14      A4PNS Shannon diversity 3.275886  3.339990 0.2087734 2.930802  3.749179
## 15      A4PNS Simpson diversity 2.953620  3.029499 0.2267408 2.585095  3.473902
## 16     A5MFCA  Species richness 1.000000  1.000000 0.0000000 1.000000  1.000000
## 17     A5MFCA Shannon diversity 1.000000  1.000000 0.0000000 1.000000  1.000000
## 18     A5MFCA Simpson diversity 1.000000  1.000000 0.0000000 1.000000  1.000000
### Extrapolacion
m <- c(1, 5, 20, 50)
out <- iNEXT(Datos, q=c(0,1,2), datatype="abundance", size=m)

# Graficos
out <- iNEXT(Datos, q=0, datatype="abundance", endpoint=300)
ggiNEXT(out, type=1) +
  labs(y="Riqueza", x = "Cantidad de individuos") +
  theme_classic() 

Heatmap

library(readxl)
Datos = read_excel("/Users/yoss/Desktop/Cursos 2025/CursoCoiba2025/Bases.xlsx", 
                   sheet= "Binaria")
Especies<-Datos$ESPECIE
Datos<-Datos[2:7]
rownames(Datos) <- Especies

library(knitr)
library(tidyverse)
library(pheatmap)

knitr::opts_chunk$set(comment="  ", cache=T, warning=F, message=F)
sst.colors <- c(`0`="#fcd000",`1`="#00af42")

pheatmap(Datos, col=sst.colors, legend_breaks=c(0,1), legend_labels=c("Ausencia", "Presencia"))

Asignación

Diversidad Alpha y Beta de Euglossini

Indicaciones en clases

Anuncio