#Introduction

Manakins (Pipridae) are a group of tropical birds well known for their elaborate courtship displays, which involve a combination of complex body movements and vocalizations. In this study, we use high-speed video cameras to record and analyze male display movements in order to better understand the relationship between their acoustic and motor components.

The species of interest performs a sequence of distinctive movements accompanied by different sounds. Although some of these sounds appear to be synchronized with specific movements, the precise timing of sound production in relation to the movements remains unclear. To investigate this relationship, we have classified the sounds into three categories: “Flap,” “Chee,” and “Waah.” Specifically, our objective is to determine whether the “Flap” sound is produced during the “Spock” movement (see attached figure illustrating the different display movements).

#Research question

Is the flap sound produced during the spock movement?

#Hipothesis

The Spock movement is responsible for generating the flap sound and is produced due to the opening of the wings.

#Prediction

The sound is produced only at the begining of the movement and therefore the relationship between sound and movement should be inverse

#Load images

Next images show the display behavior and some of the movements the bird does

knitr::include_graphics("Data_For_my_Final_Project/images/Birds_movement.png")

#My libraries

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)
library(ggplot2)
library(dplyr)
library(readr)
library(tidyr)
library(janitor)
## 
## Attaching package: 'janitor'
## 
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
## Rows: 806 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): LogName, VideoDate, CINEname, Element
## dbl (2): HSVideoID, ElementValue
## 
## ℹ 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: 6 × 6
##   hs_video_id log_name video_date cin_ename        element         element_value
##         <dbl> <chr>    <chr>      <chr>            <chr>                   <dbl>
## 1         103 Chiky    13-Mar-19  13Mar2019_5.cine Twist_StartFra…           -98
## 2         104 Chiky    13-Mar-19  13Mar2019_6.cine Twist_StartFra…          -229
## 3         108 Chiky    14-Mar-19  14Mar2019_4.cine Twist_StartFra…          -422
## 4         110 Chiky    14-Mar-19  14Mar2019_7.cine Twist_StartFra…          -544
## 5         111 Chiky    15-Mar-19  15Mar2019_2      Twist_StartFra…          -764
## 6         112 Chiky    15-Mar-19  15Mar2019_3.cine Twist_StartFra…         -1623
## [1] "hs_video_id"   "log_name"      "video_date"    "cin_ename"    
## [5] "element"       "element_value"
## Rows: 806
## Columns: 6
## $ hs_video_id   <dbl> 103, 104, 108, 110, 111, 112, 113, 117, 120, 122, 123, 1…
## $ log_name      <chr> "Chiky", "Chiky", "Chiky", "Chiky", "Chiky", "Chiky", "C…
## $ video_date    <chr> "13-Mar-19", "13-Mar-19", "14-Mar-19", "14-Mar-19", "15-…
## $ cin_ename     <chr> "13Mar2019_5.cine", "13Mar2019_6.cine", "14Mar2019_4.cin…
## $ element       <chr> "Twist_StartFrame", "Twist_StartFrame", "Twist_StartFram…
## $ element_value <dbl> -98, -229, -422, -544, -764, -1623, -1332, -1559, -1610,…
## Rows: 806
## Columns: 10
## $ hs_video_id   <dbl> 103, 104, 108, 110, 111, 112, 113, 117, 120, 122, 123, 1…
## $ log_name      <chr> "Chiky", "Chiky", "Chiky", "Chiky", "Chiky", "Chiky", "C…
## $ video_date    <chr> "13-Mar-19", "13-Mar-19", "14-Mar-19", "14-Mar-19", "15-…
## $ cin_ename     <chr> "13Mar2019_5.cine", "13Mar2019_6.cine", "14Mar2019_4.cin…
## $ element       <chr> "Twist_StartFrame", "Twist_StartFrame", "Twist_StartFram…
## $ element_value <dbl> -98, -229, -422, -544, -764, -1623, -1332, -1559, -1610,…
## $ Date2         <dttm> 2013-03-19, 2013-03-19, 2014-03-19, 2014-03-19, 2015-03…
## $ day           <int> 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, …
## $ year          <dbl> 2013, 2013, 2014, 2014, 2015, 2015, 2015, 2017, 2017, 20…
## $ month         <dbl> 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,…
## 
## Call:
## lm(formula = FlapDuration_Time ~ Spock_Speed, data = Data_wide)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.08094 -0.02558 -0.01021  0.01711  0.11796 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.066251   0.034363  -1.928 0.060478 .  
## Spock_Speed  0.006237   0.001483   4.206 0.000129 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.04257 on 43 degrees of freedom
## Multiple R-squared:  0.2915, Adjusted R-squared:  0.275 
## F-statistic: 17.69 on 1 and 43 DF,  p-value: 0.0001293
## Analysis of Variance Table
## 
## Response: FlapDuration_Time
##             Df   Sum Sq  Mean Sq F value    Pr(>F)    
## Spock_Speed  1 0.032062 0.032062  17.692 0.0001293 ***
## Residuals   43 0.077927 0.001812                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

## `geom_smooth()` using formula = 'y ~ x'

#Plot description

The plot illustrates the linear regression between Spock position duration, measured in Frames Per Second (FPS) and flap sound duration measured in Hertz (Hz). The results suggest a positive linear relationship between these two variables, indicating that longer Spock position durations are associated with longer flap sound durations.

#Conclusion

The linear regression revealed a positive relationship between Spock speed and flap duration (R² = 0.29, F= 17.69, p = 0.000129). Contrary to our prediction, higher spock speeds were associated with longer flap durations rather than shorter ones. Therefore, these results do not support the predicted relationship under the first hypothesis. These results suggest that the flap sound is not produced during the spock position, and it might be that this sound is simply not associated with any movement performed during the display cortship.