Analysis of Hummingbird Feeders & Zingiber spectabile

Author
Published

April 25, 2024

Source code and data found at https://github.com/ariyanap7/project

Purpose

  • The first goal of this report is to determine the correlation of Territorial species and feeding times.

  • The second goal of this report is to find a difference in feeding behaviors between Router species and Territorial species.

 

 

# Load packages {.unnumbered .unlisted}

::: {.cell}

```{.r .numberLines .lineAnchors .cell-code}
library(sketchy)
load_packages(packages = c("readxl", "ggplot2", "viridis", "ggdist", "gghalves"))

:::

1 Raw data

Code
dat <- read_xlsx("./data/raw/CS Datasheet.xlsx", na = "N/A")
Warning: Expecting numeric in F355 / R355C6: got a date
Warning: Expecting numeric in F374 / R374C6: got a date
Code
head(dat, 4)
Name StationID File Name Date Time Total_Visit_Time (s.ms) Num_Probed_Flowers Time_Probed (s.ms) Visit Behavior Sequence Notes Open_Flowers Closed_Flowers Mammal_Species Hummer_Species Sex Bee Bee Notes
CS Station1 IMG_0141 43661.0 0.6326388888888889 NA 1.0 1.06 Fe, Ho, Le Humming Bird starts on camera, heard chirps in background, fly probs flower 3.0 1.0 NA Phaethornis Guy M N NA
CS Station1 IMG_0142 43661.0 0.6680555555555555 4.65 1.0 1.22 Fe, Unk, Le **video in B&W, Hummingbird goes to flower in back “probes” (Can’t tell because flower is not visible to camera) 4.0 0.0 NA UNK UNK N NA
CS Station1 IMG_0143. AVI 43661.0 0.8076388888888889 0.00 0.0 0.0 NA Mammal appears at beginig of video 2.0 0.0 Opossum NA NA N NA
CS Station1 IMG_0144.AVI 43662.0 0.4701388888888889 16.28 3.0 8.03 Fe, Fly, Unk, Rob, Rob Le Humm Bird goes to flower not visible to camera “probes it” (unsure) 1.0 6.0 NA Amazilia Tzactl UNK N NA

2 Format data

Code
# fix species names
dat$Hummer_Species <- gsub("Phaethornis Guy", "Phaethornis guy", dat$Hummer_Species)

dat <- dat[dat$Hummer_Species != "UNK", ]

dat$Num_Probed_Flowers <- as.numeric(dat$Num_Probed_Flowers)
Warning: NAs introduced by coercion
Code
dat$`Time_Probed (s.ms)` <- as.numeric(dat$`Time_Probed (s.ms)`)
Warning: NAs introduced by coercion
Code
dat$prop.probed <- dat$`Time_Probed (s.ms)` / dat$`Total_Visit_Time (s.ms)`

dat <- dat[dat$prop.probed <= 1, ]

dat <- dat[!is.na(dat$Hummer_Species), ]

dat$strategy <- ifelse(dat$Hummer_Species %in% c("Phaethornis Striigularis", "Phaethornis guy"), "Router", "Territorial")

dat$Hummer_Species <- factor(dat$Hummer_Species, levels = c( "Amazilia Tzactl", "Thalurania Colombica",          "Phaethornis Striigularis", "Phaethornis guy"))

Sample sizes

Code
as.data.frame(table(dat$Hummer_Species))
Var1 Freq
Amazilia Tzactl 57
Thalurania Colombica 3
Phaethornis Striigularis 39
Phaethornis guy 161

3 Exploratory graphs / stats

Proportion of time feeding

Code
cols <- viridis(10)

# raincoud plot:
fill_color <- adjustcolor("#B4DE2C99", 0.6)

ggplot(dat, aes(y = prop.probed, x = Hummer_Species, fill = strategy)) +
    
    # add half-violin from {ggdist} package
  ggdist::stat_halfeye(
    # fill = fill_color,
    alpha = 0.5,
    # custom bandwidth
    adjust = .5,
    # adjust height
    width = .6,
    .width = 0,
    # move geom to the cright
    justification = -.2,
    point_colour = NA
  ) +
    scale_fill_viridis_d(begin = 0.2, end = 0.8) +
  geom_boxplot(
      # fill = fill_color,
    width = .15,
    # remove outliers
    outlier.shape = NA # `outlier.shape = NA` works as well
  ) +
  # add justified jitter from the {gghalves} package
  gghalves::geom_half_point(
    # color = fill_color,
    # draw jitter on the left
    side = "l",
    # control range of jitter
    range_scale = .4,
    # add some transparency
    alpha = .5,
  )  + labs(x = "Species", y = "Proportion of\ntime feeding") + 
    theme(axis.text.x = element_text(angle = 15, hjust = 1)) 

Code
mod <- lm(prop.probed ~ Hummer_Species, dat)

summary(mod)

Call:
lm(formula = prop.probed ~ Hummer_Species, data = dat)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.3922 -0.1837  0.0020  0.1834  0.5529 

Coefficients:
                                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)                             0.39219    0.03259  12.034   <2e-16 ***
Hummer_SpeciesThalurania Colombica     -0.12052    0.14574  -0.827    0.409    
Hummer_SpeciesPhaethornis Striigularis -0.04198    0.05113  -0.821    0.412    
Hummer_SpeciesPhaethornis guy          -0.05266    0.03792  -1.389    0.166    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.246 on 256 degrees of freedom
Multiple R-squared:  0.008735,  Adjusted R-squared:  -0.002881 
F-statistic: 0.752 on 3 and 256 DF,  p-value: 0.5221

Number of flowers probed

Code
ggplot(dat, aes(y = Num_Probed_Flowers, x = Hummer_Species, fill = strategy)) +
    
    # add half-violin from {ggdist} package
  ggdist::stat_halfeye(
    # fill = fill_color,
    alpha = 0.5,
    # custom bandwidth
    adjust = .5,
    # adjust height
    width = .6,
    .width = 0,
    # move geom to the cright
    justification = -.2,
    point_colour = NA
  ) +
    scale_fill_viridis_d(begin = 0.2, end = 0.8) +
  geom_boxplot(
      # fill = fill_color,
    width = .15,
    # remove outliers
    outlier.shape = NA # `outlier.shape = NA` works as well
  ) +
  # add justified jitter from the {gghalves} package
  gghalves::geom_half_point(
    # color = fill_color,
    # draw jitter on the left
    side = "l",
    # control range of jitter
    range_scale = .4,
    # add some transparency
    alpha = .5,
  )  + labs(x = "Species", y = "Number of flowers probed") + 
    theme(axis.text.x = element_text(angle = 15, hjust = 1)) 

Code
mod <- lm(Num_Probed_Flowers ~ Hummer_Species, dat)

summary(mod)

Call:
lm(formula = Num_Probed_Flowers ~ Hummer_Species, data = dat)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.7179 -0.6335  0.0000  0.3684  5.3684 

Coefficients:
                                        Estimate Std. Error t value Pr(>|t|)
(Intercept)                             1.631579   0.173359   9.412   <2e-16
Hummer_SpeciesThalurania Colombica     -0.631579   0.775286  -0.815    0.416
Hummer_SpeciesPhaethornis Striigularis  0.086370   0.271988   0.318    0.751
Hummer_SpeciesPhaethornis guy           0.001961   0.201726   0.010    0.992
                                          
(Intercept)                            ***
Hummer_SpeciesThalurania Colombica        
Hummer_SpeciesPhaethornis Striigularis    
Hummer_SpeciesPhaethornis guy             
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.309 on 256 degrees of freedom
Multiple R-squared:  0.003354,  Adjusted R-squared:  -0.008325 
F-statistic: 0.2872 on 3 and 256 DF,  p-value: 0.8346

Time spent probing

Code
ggplot(dat, aes(y = `Time_Probed (s.ms)`, x = Hummer_Species, fill = strategy)) +
    
    # add half-violin from {ggdist} package
  ggdist::stat_halfeye(
    # fill = fill_color,
    alpha = 0.5,
    # custom bandwidth
    adjust = .5,
    # adjust height
    width = .6,
    .width = 0,
    # move geom to the cright
    justification = -.2,
    point_colour = NA
  ) +
    scale_fill_viridis_d(begin = 0.2, end = 0.8) +
  geom_boxplot(
      # fill = fill_color,
    width = .15,
    # remove outliers
    outlier.shape = NA # `outlier.shape = NA` works as well
  ) +
  # add justified jitter from the {gghalves} package
  gghalves::geom_half_point(
    # color = fill_color,
    # draw jitter on the left
    side = "l",
    # control range of jitter
    range_scale = .4,
    # add some transparency
    alpha = .5,
  )  + labs(x = "Species", y = "Time probed (s)") + 
    theme(axis.text.x = element_text(angle = 15, hjust = 1)) 

Code
mod <- lm(`Time_Probed (s.ms)` ~ Hummer_Species, dat)

summary(mod)

Call:
lm(formula = `Time_Probed (s.ms)` ~ Hummer_Species, data = dat)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.6477 -1.0891 -0.2127  0.7928  7.6923 

Coefficients:
                                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)                              2.6477     0.2097  12.626  < 2e-16 ***
Hummer_SpeciesThalurania Colombica      -1.2544     0.9378  -1.338   0.1822    
Hummer_SpeciesPhaethornis Striigularis  -0.6280     0.3290  -1.909   0.0574 .  
Hummer_SpeciesPhaethornis guy           -1.1921     0.2440  -4.885 1.82e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.583 on 256 degrees of freedom
Multiple R-squared:  0.08867,   Adjusted R-squared:  0.07799 
F-statistic: 8.303 on 3 and 256 DF,  p-value: 2.728e-05

Total visit time

Code
ggplot(dat, aes(y = `Total_Visit_Time (s.ms)`, x = Hummer_Species, fill = strategy)) +
    
    # add half-violin from {ggdist} package
  ggdist::stat_halfeye(
    # fill = fill_color,
    alpha = 0.5,
    # custom bandwidth
    adjust = .5,
    # adjust height
    width = .6,
    .width = 0,
    # move geom to the cright
    justification = -.2,
    point_colour = NA
  ) +
    scale_fill_viridis_d(begin = 0.2, end = 0.8) +
  geom_boxplot(
      # fill = fill_color,
    width = .15,
    # remove outliers
    outlier.shape = NA # `outlier.shape = NA` works as well
  ) +
  # add justified jitter from the {gghalves} package
  gghalves::geom_half_point(
    # color = fill_color,
    # draw jitter on the left
    side = "l",
    # control range of jitter
    range_scale = .4,
    # add some transparency
    alpha = .5,
  )  + labs(x = "Species", y = "Visit time (s)") + 
    theme(axis.text.x = element_text(angle = 15, hjust = 1)) 

Code
mod <- lm(`Total_Visit_Time (s.ms)` ~ Hummer_Species, dat)

summary(mod)

Call:
lm(formula = `Total_Visit_Time (s.ms)` ~ Hummer_Species, data = dat)

Residuals:
    Min      1Q  Median      3Q     Max 
-5.8144 -2.4148 -0.5667  1.9060 10.7556 

Coefficients:
                                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)                              6.2444     0.4119  15.160  < 2e-16 ***
Hummer_SpeciesThalurania Colombica      -1.1411     1.8420  -0.619 0.536170    
Hummer_SpeciesPhaethornis Striigularis  -0.8682     0.6462  -1.344 0.180288    
Hummer_SpeciesPhaethornis guy           -1.6571     0.4793  -3.457 0.000638 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.11 on 256 degrees of freedom
Multiple R-squared:  0.04615,   Adjusted R-squared:  0.03497 
F-statistic: 4.129 on 3 and 256 DF,  p-value: 0.006984

Takeaways

Based on statistical analysis, there is no evidence to conclude that Territorial hummingbird species spend more time feeding than Router hummingbird species. However, P. guy was shown to spend less time visiting Zingiber spectabile and less time feeding. P. Striigularis had a similar trend but nothing of significant finding.

 


 

Session information

R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Guatemala
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gghalves_0.1.4    ggdist_3.3.2      viridis_0.6.5     viridisLite_0.4.2
[5] ggplot2_3.5.1     readxl_1.4.3      sketchy_1.0.3    

loaded via a namespace (and not attached):
 [1] gtable_0.3.5         jsonlite_1.8.8       dplyr_1.1.4         
 [4] compiler_4.3.3       crayon_1.5.2         Rcpp_1.0.12         
 [7] tidyselect_1.2.1     gridExtra_2.3        scales_1.3.0        
[10] yaml_2.3.8           fastmap_1.1.1        R6_2.5.1            
[13] labeling_0.4.3       generics_0.1.3       distributional_0.4.0
[16] knitr_1.46           htmlwidgets_1.6.4    tibble_3.2.1        
[19] munsell_0.5.1        xaringanExtra_0.7.0  pillar_1.9.0        
[22] rlang_1.1.3          utf8_1.2.4           stringi_1.8.3       
[25] xfun_0.43            cli_3.6.2            withr_3.0.0         
[28] magrittr_2.0.3       digest_0.6.35        grid_4.3.3          
[31] rstudioapi_0.16.0    remotes_2.5.0        packrat_0.9.2       
[34] lifecycle_1.0.4      vctrs_0.6.5          evaluate_0.23       
[37] glue_1.7.0           farver_2.1.1         cellranger_1.1.0    
[40] fansi_1.0.6          colorspace_2.1-0     rmarkdown_2.26      
[43] tools_4.3.3          pkgconfig_2.0.3      htmltools_0.5.8.1