Complete database

All individuals are included

library(readxl)
library(MASS)
library(ggplot2)
library(rstatix)
library(dplyr)
library(ggrepel)
library(viridis)
library(tidyverse)

data = read_excel("/Users/yoss/Desktop/ITD_Euglossini.xlsx", sheet= "BASE")

Complete database

All individuals are included

num_ind <- 23
Color <- viridis(num_ind)

df_ITD <- data %>%
  group_by(Specie) %>%
  summarise_at(vars(ITD), list(mean=mean, sd=sd)) %>%
  as.data.frame()

colnames(df_ITD) <-c("SPECIE", "ITD_MEAN", "STD_ITD")

df_MG <- data %>%
  group_by(Specie) %>%
  summarise_at(vars(dryweight), list(mean=mean, sd=sd)) %>%
  as.data.frame()

colnames(df_MG) <-c("SPECIE", "MG_MEAN", "STD_MG")

data_cross <- inner_join(df_ITD, df_MG, by="SPECIE")
Genus<-c(rep("Eufrisea",4), rep("Euglossa",15), rep("Eulaema",3), rep("Exaraete",1))

data_cross<-data_frame(Genus, data_cross$SPECIE, data_cross$ITD_MEAN, data_cross$STD_ITD,
                            data_cross$MG_MEAN,data_cross$STD_MG)
colnames(data_cross) <-c("Genus","SPECIE", "ITD_MEAN", "STD_ITD", "MG_MEAN", "STD_MG")

library(kableExtra)
DataA<- kable(data_cross, format = "markdown", col.names = c("Genus", "Specie", "ITD_Mean", "ITD_SD", "DryWeight_Mean", "DryWeight_SD"))
DataA
Genus Specie ITD_Mean ITD_SD DryWeight_Mean DryWeight_SD
Eufrisea Eufrisea anisochlora 4.866000 0.2023648 0.0926000 0.0109909
Eufrisea Eufrisea machroglossa 6.015200 0.0281549 0.1312000 0.0214639
Eufrisea Eufrisea pulchra 6.187400 0.0623602 0.1534000 0.0432296
Eufrisea Eufrisea surinamensis 5.729200 0.0534154 0.1614000 0.0244499
Euglossa Euglossa asarophora 4.195200 0.1207506 0.0570000 0.0106536
Euglossa Euglossa cognota 3.980200 0.1699109 0.0442000 0.0106864
Euglossa Euglossa cybella 4.075200 0.0492768 0.0482000 0.0059749
Euglossa Euglossa dadsoni 3.557800 0.0493477 0.0336000 0.0043932
Euglossa Euglossa despecta 3.460400 0.3272939 0.0256000 0.0055946
Euglossa Euglossa imperiallis 4.145400 0.0696118 0.0676000 0.0094499
Euglossa Euglossa maculilabris 3.692000 0.1514034 0.0363333 0.0056862
Euglossa Euglossa mixta 3.731200 0.1403627 0.0346000 0.0051769
Euglossa Euglossa purpurea 3.542000 0.0420000 0.0423333 0.0083865
Euglossa Euglossa sapphirrina 3.043800 0.0360375 0.0234000 0.0060663
Euglossa Euglossa tridentata 3.804600 0.1427806 0.0410000 0.0067454
Euglossa Euglossa turbinifex 3.300667 0.0773649 0.0280000 0.0095394
Euglossa Euglossa variabilis 3.142333 0.1014413 0.0280000 0.0072111
Euglossa Euglossa villosa 3.390200 0.2044228 0.0328000 0.0074967
Euglossa Euglossa villosiventris 3.552333 0.0490748 0.0436667 0.0056862
Eulaema Eulaema cirgulata 6.468000 0.0626259 0.2124000 0.0439010
Eulaema Eulaema meriana 7.733000 0.1623946 0.4058000 0.0306953
Eulaema Eulaema nigrita 5.043800 0.0592427 0.1552000 0.0145671
Exaraete Exaerete smragdina 4.848000 0.0959557 0.1552000 0.0188600

Power regression between dry body mass and ITD (mm). AVERAGE

model_power_cross <- nls(ITD_MEAN ~ a * MG_MEAN^b, data = data_cross, start = list(a = 1, b = 1))
model1 <- lm (log (ITD_MEAN) ~ log (MG_MEAN), data = data_cross)

Coefficients

summary(model_power_cross)
## 
## Formula: ITD_MEAN ~ a * MG_MEAN^b
## 
## Parameters:
##   Estimate Std. Error t value Pr(>|t|)    
## a 10.18147    0.43194   23.57  < 2e-16 ***
## b  0.31425    0.01711   18.36 2.05e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3227 on 21 degrees of freedom
## 
## Number of iterations to convergence: 8 
## Achieved convergence tolerance: 4.979e-06

Adjusted R-squared and p-value

summary(model1)
## 
## Call:
## lm(formula = log(ITD_MEAN) ~ log(MG_MEAN), data = data_cross)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.15215 -0.03977  0.01427  0.03821  0.11582 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.31006    0.04938   46.78  < 2e-16 ***
## log(MG_MEAN)  0.31097    0.01719   18.09 2.77e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06482 on 21 degrees of freedom
## Multiple R-squared:  0.9397, Adjusted R-squared:  0.9368 
## F-statistic: 327.2 on 1 and 21 DF,  p-value: 2.768e-14

Graphic

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.1
ggplot(data_cross, aes(x = MG_MEAN, y = ITD_MEAN))  +
  geom_smooth(method = "nls", formula = y ~ a * x^b, se = FALSE, color = "blue", method.args = list(start = list(a = 1, b = 1))) +  
  labs(x = "Dry body mass (g)", y = "Intertegular distance (mm)") +
  geom_errorbar(aes(ymin = ITD_MEAN - STD_ITD, ymax = ITD_MEAN + STD_ITD))  +  
  theme_classic() + geom_point(aes(shape=Genus, color=Genus),size=3)

Power regression between dry body mass and ITD (mm) ALL INDIVIDUALS

model_potencial <- nls(ITD ~ a * dryweight^b, data = data, start = list(a = 1, b = 1))
model2 <- lm (log (ITD) ~ log (dryweight), data = data)

Coefficients

summary(model_potencial)
## 
## Formula: ITD ~ a * dryweight^b
## 
## Parameters:
##   Estimate Std. Error t value Pr(>|t|)    
## a 9.952767   0.227917   43.67   <2e-16 ***
## b 0.303193   0.009388   32.30   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3864 on 103 degrees of freedom
## 
## Number of iterations to convergence: 8 
## Achieved convergence tolerance: 3.641e-07

Adjusted R-squared and p-value

summary(model2)
## 
## Call:
## lm(formula = log(ITD) ~ log(dryweight), data = data)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.179061 -0.053562  0.007899  0.050463  0.206432 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    2.280855   0.026771   85.20   <2e-16 ***
## log(dryweight) 0.297740   0.009425   31.59   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07903 on 103 degrees of freedom
## Multiple R-squared:  0.9065, Adjusted R-squared:  0.9055 
## F-statistic:   998 on 1 and 103 DF,  p-value: < 2.2e-16

Graphic

ggplot(data, aes(x = dryweight, y = ITD))  +
  geom_smooth(method = "nls", formula = y ~ a * x^b, se = FALSE, color = "blue", method.args = list(start = list(a = 1, b = 1))) + 
  labs(x = "Dry body mass (g)", y = "Intertegular distance (mm)") + 
  theme_classic() + geom_point(aes(shape=Genus, color=Genus),size=3) 

Power regression between dry body mass and ITD (mm). EUGLOSSA INDIVIDUALS ONLY

library(readxl)
dataE = read_excel("/Users/yoss/Desktop/ITD_Euglossini.xlsx", sheet= "Euglossa")
model_potencialE <- nls(ITD ~ a * dryweight^b, data = dataE, start = list(a = 1, b = 1))
modelE <- lm (log (ITD) ~ log (dryweight), data = dataE)

Coefficients

summary(model_potencialE)
## 
## Formula: ITD ~ a * dryweight^b
## 
## Parameters:
##   Estimate Std. Error t value Pr(>|t|)    
## a  8.04247    0.54069   14.88   <2e-16 ***
## b  0.23955    0.02069   11.58   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2124 on 63 degrees of freedom
## 
## Number of iterations to convergence: 10 
## Achieved convergence tolerance: 3.775e-08

Adjusted R-squared and p-value

summary(modelE)
## 
## Call:
## lm(formula = log(ITD) ~ log(dryweight), data = dataE)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.119818 -0.044036  0.008616  0.037251  0.130009 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     2.08703    0.06922   30.15   <2e-16 ***
## log(dryweight)  0.24076    0.02093   11.50   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.059 on 63 degrees of freedom
## Multiple R-squared:  0.6774, Adjusted R-squared:  0.6723 
## F-statistic: 132.3 on 1 and 63 DF,  p-value: < 2.2e-16

Graphic

ggplot(dataE, aes(x = dryweight, y = ITD))  +
  geom_smooth(method = "nls", formula = y ~ a * x^b, se = FALSE, color = "blue", method.args = list(start = list(a = 1, b = 1))) + 
  labs(x = "Dry body mass (g)", y = "Intertegular distance (mm)") + 
  theme_classic() + geom_point(aes(shape=Genus, color=Genus),size=3)