Sex and morph variation in activity from early ontogeny to maturity in ruffs (Calidris pugnax)
Data files
Feb 19, 2025 version files 5.62 GB
-
0_AUE_trex_raw_to_summary.R
21.09 KB
-
1_AUE_mods_winter_manuscript.Rmd
20.44 KB
-
2_AUE_mods_ontogeny_manuscript.Rmd
21.79 KB
-
3_AUE_plot_panel_figure1_manuscript.R
975 B
-
4_AUE_repeatabilities_manuscript.Rmd
34.28 KB
-
5_AUE_rank_stability_manuscript.Rmd
15.27 KB
-
6_AUE_onto_predict_winter.Rmd
12.01 KB
-
arena_size_click_coding.py
3.44 KB
-
click_coordinates.zip
13.03 KB
-
example_videos.zip
2.31 GB
-
mastertable_AUE_info.rds
1.66 KB
-
output_plots.zip
19.87 MB
-
output_tables.zip
3.28 KB
-
README.md
13.03 KB
-
trajectory_plots.zip
20.99 MB
-
trex_output.zip
3.27 GB
-
trex_overview.xlsx
136.38 KB
-
trex_summary_clean_complete_20241112.rds
69.82 KB
-
undistort_csvpng_px.py
6.34 KB
Abstract
Intraspecific variation provides the substrate for the evolution of organisms. Ruffs show exceptional phenotypic variation in physiology, appearance and behaviour linked to variation between sexes and male alternative reproductive tactics (ARTs). The male ARTs are associated with the evolution of separate morphs, which are encoded by an autosomal supergene. However, the effects of the supergene on females and chicks are much less well understood. In particular, it is still unknown, whether females also show morph-specific behavioural variation, when behavioural differences emerge during ontogeny, and whether behavioural differences can be detected outside of the breeding context. To address these knowledge gaps, we repeatedly measured the activity in an unfamiliar environment, also known as exploration behaviour, of 109 hand-raised young ruffs throughout their first two years of life. We used automated tracking in an open field arena, and quantified the distance moved within 10 minutes to examine behavioural differences between sexes, morphs and individuals. After their crouching reflex, which is a response to potential threats, subsided during the first month of life, the activity of young ruffs rapidly increased. Repeatability of individual activity was initially low but increased throughout juvenile ontogeny and was high (R = 0.5) from day 21 onwards. Variation in activity was clearly sex-linked with females moving more than males, indicating potential energetic trade-offs accompanying the strong sexual size dimorphism. In contrast, morph differences in activity remained inconsistent and elusive, both in females and in males. Our results indicate that in species in which much of the known behavioural variation is linked to mating tactics, a non-reproductive behaviour can show between-individual variation and clear sex differences, whereas morph differences appear less pronounced.
Note: AUE stands for “Activity in an Unfamiliar Environment”
Provided files:
Trex.run analysis:
- example_videos.zip: some example raw videos
- trex_overview.xlsx: an excel sheet with manual checks and corrections for each video/trajectory
- trex_output.zip: a zip folder containing:
- all csv files containing the coordinates of the raw (trexsheets_origianls) and undistorted trajectories(trexsheets_undistorted)
- background images created by Trex, raw (bg_images_origianls) and undistorted (bg_images_undistorted)
- undistort_csvpng_px.py: the python script to undistort the trexsheets and bg_images
- arena_size_click_coding.py: the python script to extract the coordinates of the arena borders to determine correct arena size (slight differences in camera hight between rooms and years)
- click_coordinates.zip: a zip folder containing csv files that list the correct arena size for all videos
- 0_AUE_trex_raw_to_summary.R: the R script to process the undistorted trexsheets
- mastertable_AUE_info.rds: R table format, contains extra information on the birds, e.g. sex & morph
- trajectory_plots.zip: a zip folder containing one plot (png files) for each video analysed in this study, each displaying the complete trajectory a bird travelled in one video.
- trex_summary_clean_complete_20241112.rds: R table format, main table for further analysis (main output of R script 0)
Statistical analysis:
Scripts:
- 1_AUE_mods_winter_manuscript.Rmd: models and plotting of the winter data
- 2_AUE_mods_ontogeny_manuscript.Rmd: models and plotting of the ontogeny data
- 3_AUE_plot_panel_figure1_manuscript.R: combining winter and ontogeny plot into Figure 1 of the manuscript
- 4_AUE_repeatabilities_manuscript.Rmd: repeatability analysis
- 5_AUE_rank_stability_manuscript.Rmd: rank stability analysis (supplement)
- 6_AUE_onto_predict_winter.Rmd: predictive ability analysis (supplement)
Output_tables.zip
- mod_w_tab_20241112.csv: results of the winter model in table form
- mod_o_tab_20241112.csv: results of the ontogeny model in table form
- tab_lmer_var_20241112.csv: results of the Life Stage LMMs - Models in table form (supplement)
- tab_normalize_3rd_lagmod_20241112.csv: results of the Rank stability - Model in table form (supplement)
Output_plots.zip
- p_w_gaus_wintersex_20241112.rds: Plot – winter & sex effect
- p_w_gaus_wintermorph_20241112.rds: Plot – winter & morph effect
- p_o_zig_sex_20241112.rds: Plot – winter & sex effect
- p_o_zig_om_20241112.rds: Plot – winter & morph effect
- plot_panel_mp10m_20241112.png: Figure 1, combining all plots above
- Splot_o_mp10m_mod_zig_sa_3rdroot_20241112.png: Figure S2 - conditional and logistic part of the ontogeny model - sex effect
- Splot_o_mp10m_mod_zig_ma_3rdroot_20241112.png: Figure S3 - conditional and logistic part of the ontogeny model - morph effect
- plot_rep_adjusted_matrix_20241112.png: Plot – Repeatability matrix 4 life stages (Figure 2)
- plot_rep_adjusted_matrix_finescale_20241112: Plot – Repeatability matrix finescale (Figure S4)
- plot_mp10m-trial_morph_sex_SE_lines_20241112.png: Plot – raw data for rank stability analysis (Figure S5)
- plot_mp10m-trial_morph_sex_SE_lines_scaled01_Trans_20241112.png: Plot – data for rank stability analysis scaled between 0 & 1 (supplement)
- plot_AUE_scaled01_3rdroot_lag_20241112.png: Final plot – rank stability analysis (Figure S6)
- plot_predict_mp10m_cube_20241112.png: Final plot - predictive ability analysis (Figure S7)
Further descriptions
Naming convention of videos/ trexsheets/ background images
Naming convention: "date_room_order_id-ring_trial", for example: "20220621_3A_d2_G22-0201-B5.5_day3"
- date: yyyymmdd
- room: one of 4 testing rooms (1B, 2A, 2B, 3A)
- order: random order in which the individuals were tested that day. the letter corresponds to the room (ontogeny 2021: a=2A, b=1B; from winter 2021 onwards: a=1B, b=2A, c=2B, d= 3A)
- id_ring: code of the individual's id ring
- trial: number/age of the trial conducted (ontogeny: day3, day9, day15, day21, day27, day33; winter: w1, w2, w3)
For all output files of Trex.run, the labels were extended by "_400_th40_uat_bsr5_fish0". (This extension is the same for all files and has no further meaning, so can be ignored.)
Background images (PNGs) are created automatically, labels start with "average_".
Trexsheets get the extension "_fish0". (Originally Trex.run was often used for the analysis of fish videos.)
The extension "_undist" marks files as being undistorted.
trex_overview.xlsx
- order: consecutive number for sorting
- id: id of the trex output (basically the video number)
- best: ignore (used during project develop, later not relevant anymore)
- in_folder: ignore (used during project develop, later not relevant anymore)
- settings: ignore (used during project develop, later not relevant anymore)
- setting_changes: ignore (used during project develop, later not relevant anymore)
- frames_total: total number of frames in the video (duratioin 10min 1sec). This is important, because not all the videos do have the same number of frames even if they have the same length (Our cameras were not 100% accurate with recording always 25 frames/second)
- first_frame_track: first frame in which the automated tracking worked nicely (rectangle around the individual in focus as soon as the program can distinguish it from the pot)
- nr_blobs_at_first_frame: number of blobs (Trex.run term) detected in the first frame (first_frame_track)
- bad_frames: if the tracking is off in some frames, these can be manually excluded by writing them down here (single frames separated by comma: “1,3,…” , or multiple ones: “5:10,500:507,…”)
- good_frames: if the tracking is off many frames and a late frame is selected for first_frame_track, some single good frames or periods before first_frame_track can be manually included by writing them down here (single frames separated by comma: “1,3,…” , or multiple ones: “5:10,500:507,…”)
- fly_ground_frame: If the bird flies up to far and its track gets very distorted or if it flies even above the camera, also these periods need to be manually excluded. First frame, where the bird starts flying until the last frame before the bird is properly tracked on the ground again: "627:713"
- cm_per_pixel: value to transform pixels to cm
- tdt_trex: total distance travelled, rough estimation based on raw trex tracking, ignore
- x_start_px: if the middle of the pot (bird underneath) is not tracked in the first frame (0), x coordinate is entered here manually
- y_start_px: if the middle of the pot (bird underneath) is not tracked in the first frame (0), y coordinate is entered here manually
- x_start_cm: x_start_px multiplied by cm_per_pixel
- y_start_cm: y_start_px multiplied by cm_per_pixel
- notes: notes made during manual checks and corrections. Contains “no movement” if a bird did not move at all. Contains the string element “check frame 0” in the ideal case, when the first frame (0) has the pot (bird underneath) tracked. Then the R script later chooses frame 0 as the first coordinate (not ideal, but it works).
trexsheets(_undistorted) (folder: trex_output.zip)
- frame: frame number
- X#wcentroid (cm): x coordinate of the body center (based on weighted image/pixel information), raw trex output
- X#undist_centroid: x coordinate of the body center (based on weighted image/pixel information), after correcting distortion
- Y#wcentroid (cm): y coordinate of the body center (based on weighted image/pixel information), raw trex output
- Y#undist_centroid: y coordinate of the body center (based on weighted image/pixel information), after correcting distortion
- time: Time in seconds (floating point) from the start of the video, consistent across individuals.
Other columns can be ignored for all further analysis in this study. The sheets are created by the Trex.run program. For more detail see https://trex.run/docs/formats.html
click_coordinates...csv (folder: click_coordinates.zip)
There are separate files for the ontogeny and winter videos of all three years and the birds that were tested in their 2nd winter in 2022 and 2023.
- file_name: name of the raw background image produced by trex
- x1: x coordinate of the middle of the left arena border
- y1: y coordinate of the middle of the left arena border
- x2: x coordinate of the middle of the right arena border
- y2: y coordinate of the middle of the right arena border
mastertable_AUE_info.rds
- id_ring: code of the individual's id ring
- cohort: birth year
- id_egg: id assigned to the egg the individual hatched from
- sex: sex of the individual (Female or Male)
- morph: morph of the individual (Independent, Satellite or Faeder)
- date_hatch: date of hatching
trex_summary_clean_complete.rds
- subset_label: associated table before merging tables
- cohort: birth year
- nth_winter: individuals 1st or 2nd winter after hatching
- age_class: ontogeny, 1st or 2nd winter
- id_egg: id assigned to the egg the individual hatched from
- sex: sex of the individual (Female or Male)
- morph: morph of the individual (Independent, Satellite or Faeder)
- sex_morph: combine sex and morph
- date_hatch: date of hatching
- date: date the open field test was conducted
- room: one of 4 testing rooms (1B, 2A, 2B, 3A)
- order: random order in which the individuals were tested that day. the letter corresponds to the room (ontogeny 2021: a=2A, b=1B; from winter 2021 onwards: a=1B, b=2A, c=2B, d= 3A)
- order_num: numerical part of order
- id_ring: code of the individual's id ring
- trial: number/age of the trial conducted (ontogeny: day3, day9, day15, day21, day27, day33 (+/-1 day in the real age); winter: w1, w2, w3)
- extra: rest of the csv name file, ignore
- dist_total: raw total distance travelled in cm, before correcting for the real arena size
- time_total: total time analysed
- time_active: time the individual was actively moving
- time_stationary: time the individual was stationary
- time_fly: time the individual was flying/not on the ground
- dist_arena_px: real arena size in px
- conv_factor: conversion factor to correct for slighly different arena size than assumed (all arenas are 200cm wide)
- dist_total_cm: total distance travelled in cm after correction
- cmps: dist_total_cm divided by time total (cm/s)
- cmp10m: cmps multiplied by 600sec (10min) since the total distance travelled in m within 10min is more intuitive for understanding than the average speed cmps
- mp10m: cmp10m converted to meters per 10min
- mp10m_3rdroot: cube root of mp10m, used for further analysis
mod_w_tab_20241112.csv
- effect: intercept, fixed or random effect
- mean: mean extimated value
- 2.5%: 2.5% credible interval
- 50%: 50% credible interval
- 97.50%: 97.5% credible interval
- est_cri: mean estimate and credible interval ready to copy into manuscript
mod_o_tab_20241112.csv
- effect: fixed or random effect
- component: conditional or zero-inflation part of the model
- group: name of the random effect
- term: name of the fixed effect or what part of the random effect
- estimate: estimated mean
- std.error: standard error
- statistic: f statistic
- p.value: p value
- conf.low: lower confidence interval (2.5%)
- conf.high: upper confidence interval (97.5%)
- est_ci: mean estimate and confidence interval ready to copy into manuscript
tab_lmer_var_20241112.csv
- effect: name if fixed/ random effect
- o1: mean estimate and credible interval for the life stage "early ontogeny" (ready to copy into manuscript)
- o2: mean estimate and credible interval for the life stage "late ontogeny" (ready to copy into manuscript)
- w1: mean estimate and credible interval for the life stage "1st winter" (ready to copy into manuscript)
- w2: mean estimate and credible interval for the life stage "2nd winter" (ready to copy into manuscript)
tab_normalize_3rd_lagmod_20241112.csv
- effect: intercept, fixed or random effect
- mean: mean extimated value
- 2.5%: 2.5% credible interval
- 50%: 50% credible interval
- 97.50%: 97.5% credible interval
- est_cri: mean estimate and credible interval ready to copy into manuscript
Code/Software
R is required to run .R and .Rmd scripts and to open .rds files; scripts were created using version 4.1.3.
Annotations are provided throughout the scripts.
Python is required to run .py scripts; scripts were created using version 3.8.10.
Study population
We conducted this study using a captive population of ruffs at the Max Planck Institute for Biological Intelligence in Seewiesen, Germany over three consecutive breeding seasons (2021-2023). The founder individuals (Independents and Satellites) of this population were provided by David Lank who raised ruffs from eggs collected near Oulu, Finland, in 1985, 1989, and 1990 (Lank et al. 2013) and maintained a captive population many years at Simon Fraser University in Burnaby, British Columbia, Canada. Two Faeder males that were captured in the Netherlands were added to the population in 2006 (Lank et al. 2013), before the birds were translocated to Seewiesen in 2019. We supplemented the population with further adult ruffs obtained from ruff breeders and zoological gardens in the Netherlands, Belgium and Germany. We incubated eggs artificially, and hand-raised chicks. After hatching, we collected a blood sample (5-10μl) to determine sex and morph using diagnostic single nucleotide polymorphism markers (see Giraldo-Deck et al. 2020). After hatching, we kept the chicks in small groups of up to 10 individuals in plastic boxes (60 x 40 x 32 cm) with soft fabrics as underground and a hiding place for the first 9-10 days of their lives. Subsequently, we transferred them to larger indoor aviaries (2 x 3 m) housing up to 35 juveniles. In these aviaries hiding places were provided as well and the floor was covered with a combination of artificial grass and thick paper to provide good traction for the chicks while still being easy to clean. At 33 days of age, we introduced the juveniles to the main flock of adult birds in a large aviary (~150 m2), where the birds could experience natural undergrounds such as bare soil, sand and grass. At all stages chicks were housed in mixed sex and morph groups of similar age. Chicks always had access to food and water ad libitum.
Open field test
We designed an open field test to assess individual behavioural responses in a controlled, unfamiliar environment. The experimental arena (2 x 2 m) was a plain, smooth floor marked with a 4 x 4 field grid using 10 mm wide tape, bordered by the white walls of the test room. We tested each individual separately, directly transferring it from the housing environment into the experimental room. Chicks were transferred by hand, older juveniles and adults were caught with a customized landing net and transported in bird bags. Before each trial, we placed the bird under an upside-down black flower pot. At the start of each trial, we raised the pot from outside the room via a wire rope hoist and recorded the individual's movements by a top-view camera for a duration of 10 minutes. The experimental arena presented a novel environment during the initial exposure, and an unfamiliar environment in subsequent repeats.
To capture the development of activity, we tested the chicks every 6 days, from day 3 to day 33 post-hatching, resulting in up to six open field tests during their juvenile ontogeny. The first three trials were carried out during the early juvenile ontogeny, prior to fledging. The subsequent three trials took place during later juvenile ontogeny (Figure S1), extending to almost the end of the physical growth phase (Giraldo-Deck et al. 2020). The testing order was random within the age groups but opportunistic between age groups, for example, depending on other behavioural experiments scheduled on a given day. For 3% of the scheduled trials, we shifted individual tests by one day. Chicks that were temporary unwell (for example those that had substantially lost weight compared to the last day, did not show a flight response when approached) on a test day were not tested meaning that 24% of the 271 test individuals who survived until day 33 did not undergo all six open field tests (see Figure S1 for details). To assess the mature phenotype of activity, we tested the juvenile ruffs three times with a 6- and 7-day interval during the second half of November and early December in their first winter (approx. ½ year old; 24th Nov - 9th Dec in 2021, 15th Nov - 29th Nov in 2022, and 17th Nov - 30th Nov in 2023). During each trial, the random order in which we captured them from their home compartment determined the testing order. We tested all young ruffs that remained at our facility in their second winter (approx. 1½ years old) on the same designated test days. Due to a technical problem with video recordings, we repeated the third trial for 14 of 124 individuals tested (first winter test for 11 individuals, second winter test for 3 individuals) in November 2022 together with 10 additional individuals that served as a control group on the next day. The activity measured in the control group was highly correlated between the repeated and original third trial (Pearson’s correlation, r = 0.68, n = 10) and consequently we included the repeated tests of all 24 individuals for all further analyses.
Automated Tracking & Track Cleaning
Summary:
As a measure of activity, we quantified the distance travelled by birds in each open field test using automated tracking from 109 individuals (Table 1, Figure S1). We aimed for a balanced representation of all sex-morph classes, but we were limited by the number of individuals from the rare Faeder morph and Satellite males that survived juvenile ontogeny. The number of males and females in the analysed sample was overall similar (±10 %). Where possible, we selected individuals that had completed all trials during the juvenile ontogeny (6 trials: 81 %, 5 trials: 10 %, 4 trials: 4 %, <4 trials: 5 %). Besides these criteria chicks were chosen randomly. From the first winter trials, we analysed the tests of the same individuals except for two individuals that had died and one male Satellite that had not been tested during the juvenile ontogeny (day 3 to 33 after hatching). From the second winter trials, we included all previously tested individuals that were still in our study population.
Table 1: Sample sizes of each sex and morph for which the open field tests were analysed. Of the 109 individuals in total, one male Satellite was not tested during juvenile ontogeny. Individuals were tested up to six times during juvenile ontogeny (n = 607 trials), three times during the first winter (n = 321 trials), and three times during the second winter (n = 129 trials), resulting in a total of 1057 analysed open field tests.
|
Juvenile ontogeny |
|
|
|
First winter |
Second winter | |||||
|
Independents |
Satellites |
Faeders |
|
Independents |
Satellites |
Faeders |
|
Independents |
Satellites |
Faeders |
Females |
23 |
22 |
12 |
|
23 |
22 |
11 |
|
4 |
7 |
8 |
Males |
28 |
16 |
7 |
|
27 |
17 |
7 |
|
11 |
10 |
3 |
Total |
108 |
|
|
|
107 |
43 |
We analysed the recorded videos of each trial using the Python-based automated tracking software TRex.run (Walter und Couzin 2021), which was run blind, without the information on bird ID, age, sex or morph information. The software provided the individual’s position (body centre) in each video frame (25 frames/sec). We used the adeHabitatLT package (version 0.3.27, Calenge 2006) in R (version 4.1.3, R Core Team 2022) to compute a smoothed trajectory of the birds walking on the floor, representing the distance travelled. For smoothing, we subsampled the trajectory by taking only the coordinates of every 10th frame and then reduced noise by removing movement distances of less than 1 cm between these subsampled frames (< 1 cm/0.4 sec). While being blind to the individuals’ IDs, we visually inspected the videos and manually excluded frames with tracking errors and periods where the bird flew higher than 0.5 m (flight periods), since the distance covered during these periods could not be determined accurately due to perspective distortion. Individuals flew in 9.7 % of the videos, and the average duration of the time spent flying in these videos was 17.0 sec. Finally, we extracted the average travelling speed as the total distance travelled divided by the time spent on the ground. Based on the average travelling speed, we calculated the final response variable ‘distance travelled (in m) during a 10 min period’ as a proxy for activity, which was the response variable used in all subsequent analyses.
Further details:
1.1 TGrabs - Preprocessing Settings
averaging_method = mode
meta_real_width = 400
threshold = 40
use_adaptive_thresholding = true
blob_size_range = [5,500000]
1.2 TRex - Analysis Settings
ontogeny videos:
blob_size_ranges = [[10,900]]
frame_rate = 25
gui_show_dataset = true
output_format = csv
track_max_individuals = 1
track_max_speed = 500
track_threshold = 60
winter videos:
blob_size_ranges = [[10,900]]
frame_rate = 25
gui_show_dataset = true
output_format = csv
track_max_individuals = 1
track_max_speed = 500
track_threshold = 60
1.3 Manual checks and corrections
The tracking did not always work perfectly, for example, when the camera was shaking a little too much at the beginning of the video or when the bird didn’t move (enough). Consequently, I went through every video manually and noted down in which frames that was the case, or then the bird flew higher than 0.5m above the ground (then distortion became too strong and tracked distances were not realistic anymore. Additionally, the birds could fly higher than the camera and were totally out of view during these periods.) This additional information was stored in the excel sheet “trex_overview.xlsx”. All important columns from this sheet are mentioned beneath, the rest can be ignored.
If a bird did not move at all, I added “no movement” to the “notes” column (trex_overview.xlsx).
The first frame (0) should ideally have the pot (bird underneath) tracked. If not, press “D” to switch to RAW view and select the correct rectangle/a roughly fitting white circle via right click and select it to be the “fish”. → the selected object is tracked in this frame and the following frames get recalculated. Additionally, the “notes” column needs the string element “check frame 0”, then the R script later chooses frame 0 as the first coordinate (also not ideal, but it works).
Alternatively, you can manually extract the coordinates by moving the curser to the chosen spot. In the lower right corner of the window the coordinates of this spot are displayed (in px). Type the x & y coordinate in the “x_start_px” & “y_start_px” column. The “x_start_cm” & “y_start_cm” column are calculated by multiplying by the “cm_per_pixel” value of the same row. In this case the string element “check frame 0” needs to be absent from the “notes” column.
The next step is to find the first frame where the individual is properly tracked (either automatically, or switch to the RAW mode and manually select the rectangle around the individual in focus as soon as the program can distinguish it from the pot. Alternatively, again select a white circle that is roughly in the correct position). The frame number goes to the “first_frame_track” column. In the lower right corner is says how many blobs are detected in the frame, this number goes to the “nr_blobs_at_first_frame” column (not needed for the ananlysis, I noted this down only for me to see how well the tracking works; the lower the
number, the better the tracking).
In videos where the individual moves, and the camera doesn’t shake, the tracking usually works pretty well from this point on. If the tracking is off in some frames, these can be manually excluded by writing them down in the “bad_frames” column (single frames separated by comma: “1,3,…” , or multiple ones: “5:10,500:507,…”).
If the bird flies up to far and its track gets very distorted or if it flies even above the camera, also these periods need to be manually excluded. In the column “fly_ground_frame”, we then put the first frame, where the bird starts flying until the last frame before the bird is properly tracked on the ground again: "627:713".
Column “frames_total” is the total number of frames in the video. This is important, because not all the videos do have the same number of frames even if they have the same length (Our cameras were not 100% accurate with recording always 25 frames/second).
Before closing the window – SAVE the track!!!!!!! By pressing “s”.
The file name always starts with the video name, they are stored in the folder “trexsheets_originals” in the repository. TRex also creates background images (what it thinks that the background is), they are stored in the folder “bg_images_originals”.
The next step then is to undistort the tracking data…
2. Undistort coordinates - Python
The recorded videos are somewhat distorted. Zsombor Fueloep wrote a Python script to undistort the background image (provided by TRex) and the coordinates stored in the raw “trexsheets”.
Code: undistort_csvpng_px.py
Output csvs: trexsheets_undistorted
Outout jpgs: bg_images_undistorted
3. Determine correct arena size
The height and position of the camera above the arena was not 100% identical between different test days and years. Consequently, I manually extracted the arena size for each video from the undistorted background image. Zsombor also wrote a little script for that, which opens the first image, you click on the middle of the left edge of the arena and then on the middle of the right edge, close the image and the next one opens automatically. The clicking coordinates are stored in a csv file.
Script: arena_size_click_coding.py
Output folder: click_coordinates
4. Process Trexsheets - R
Script: 0_exploration_trex_raw_to_summary.R
Input:
- mastertable_AUE_info.rds
- trex_overview.xlsx
- trexsheets_undistorted (folder)
- click_coordinates (folder)
Output summary table: trex_summary_clean_complete_20231221.rds
Output trajectories: trajectory_plots
This script reads in the undistorted trexsheets and the click_coordinates, applies some processing and filtering steps and plots the travelled trajectory for each video and a summary table (trex_summary_clean_complete) containing the total distance travelled in px (dist_total) as well as in cm (dist_total_cm). Correcting for the time when a bird was flying resulted in the average speed in cm per second (cmps). To make it more intuitive, I calculated the distance the bird would have travelled within 10 min based on that speed in cm (cm per 10min = cmp10m) and in m (m per 10min = mp10m). The last column (mp10m_3rdroot) is the mp10m value after cube root transformation, which I used for all following analyses.
Statistical Analyses
Summary:
We conducted all statistical analyses in R (version 4.1.3, R Core Team 2022).
To analyse the development of activity during juvenile ontogeny (< 33 days of age), we implemented a Gamma Hurdle model (GHM) with cube-root transformed distance travelled as the response variable using the glmmTMB package (version 1.1.8, Brooks et al. 2017). GHMs consist of two parts, modelling two separate processes, and can be used to deal with zero-inflation, which we had in our juvenile ontogeny data. First, the hurdle part models the probability of not moving at all during the 10-minute tracking period (zero) vs. moving (one) as a binary process. Second, the conditional part models the non-zero values with a Gamma error distribution. For both parts we used the same fixed-effect structure, including sex (two-level factor: female, male), morph (three-level factor: Independent, Satellite, Faeder) and age (linear and quadratic continuous variable) centred on a mean of zero. We refrained from fitting a sex-morph interaction, because we did not have a clear prediction for it and fitting interactions can increase the risk for type I errors (Forstmeier und Schielzeth 2011; Gelman 2018). Further, we wanted to investigate the basal effects of sex and morph as the two main factors. The conditional part additionally included cohort (three-level factor: 2021, 2022, 2023) and ID (108 levels) as random intercepts. Finally, we included random slopes for ID over age to account for variation in individual developmental trajectories in activity. We extracted the predicted values using the emmeans package (version 1.8.9, Lenth et al. 2023).
For the analysis of the mature phenotype of activity measured during first and second winter, we employed a Linear Mixed Model (LMM) with Gaussian error distribution using the lme4 package (version 1.1-35, Bates et al. 2015), since most birds moved during these trials and there was no zero inflation. Similar to the juvenile ontogeny analysis, we included sex, morph, winter (two-level factor: first, second) and trial number (three levels) as fixed effects, with cohort and ID (107 levels) as random effects.
To examine the developmental changes in the between-individual variation in activity, we calculated the adjusted individual repeatability (between-individual variance divided by the total phenotypic variance after accounting for fixed effects) using the rptR package (version 0.9.22, Stoffel et al. 2017). We classified the trials into four life stages, each consisting of three trials: (I) early (days 3-15) and (II) late (days 21-33) juvenile ontogeny, and (III) first and (IV) second winter (Figure S1). We calculated between individual variation as adjusted repeatability within each life stage as well as between life stages. Additionally, we investigated the “development” of repeatability during the juvenile ontogeny at a finer scale by calculating the repeatability for each combination of two juvenile ontogeny trials, similar to pairwise comparisons (Supplement, Fine scale repeatability development). The formula for all underlying Gaussian LMMs and adjusted repeatabilities included cube-root transformed distance travelled as the response variable, sex, morph and trial as a fixed and cohort and ID as random effects. Furthermore, we used the variance partitioned between ID and the residual variance in the four life-stage LMMs as indicators of changes in between- and within-individual variation, respectively.
We conducted two supplemental analyses regarding the development of behavioural stability. First, we investigated whether individuals establish a stable ranking within sex-morph groups based on the distance travelled throughout the juvenile ontogeny. This allowed us to assess the consistency of individual phenotypes for a trait that changes during juvenile development. High rank stability indicated that more active chicks were consistently more active relative to their peers over consecutive trials, while less active ones consistently stayed less active (Supplement, Rank stability). Second, we examined from which age on the chick behaviour can predict the mature phenotype of activity measured in the first winter (Supplement, Predictive ability). Both analyses confirmed the results of the repeatability analysis.
Further details:
5.1 Winter data
Script: 1_AUE_mods_winter_manuscript.Rmd
Input: trex_summary_clean_complete…rds – latest version
Output:
- Plot – winter & sex effect: p_w_gaus_wintersex_20241112.rds
- Plot – winter & morph effect: p_w_gaus_wintermorph_20241112.rds
- Model results in table: mod_w_tab_20241112.csv
5.2 Ontogeny data
Script: 2_AUE_mods_ontogeny_manuscript.Rmd
Input: trex_summary_clean_complete…rds – latest version
Output:
- Plot – winter & sex effect: p_o_zig_sex_20241112.rds
- Plot – winter & morph effect: p_o_zig_om_20241112.rds
- Figure S2: Splot_o_mp10m_mod_zig_sa_3rdroot_20241112.png
- Figure S3: Splot_o_mp10m_mod_zig_ma_3rdroot_20241112.png
- Model results in table: mod_o_tab_20241112.csv
5.3 Combine Panel - Figure 1
Script: 3_AUE_plot_panel_figure1_manuscript.R
Input:
- Plot – winter & sex effect: p_w_gaus_wintersex_20241112.rds
- Plot – winter & morph effect: p_w_gaus_wintermorph_20241112.rds
- Plot – winter & sex effect: p_o_zig_sex_20241112.rds
- Plot – winter & morph effect: p_o_zig_om_20241112.rds
Output: plot_panel_mp10m_20241112.png
5.4 Repeatabilities and Life Stage LMMs
Script: 4_AUE_repeatabilities_manuscript.Rmd
Input: trex_summary_clean_complete…rds – latest version
Output:
- Plot – R matrix 4 life stages (Figure 2): p_o_zig_sex_20241112.rds
- Plot – R matrix finescale (Figure S4): p_o_zig_om_20241112.rds
- Life Stage LMMs - Model results in table: tab_lmer_var_20241112.csv
5.5 Rank Stability (Supplement)
Script: 5_AUE_rank_stability_manuscript.Rmd
Input: trex_summary_clean_complete…rds – latest version
Output:
- Plot – Raw data: plot_mp10m-trial_morph_sex_SE_lines_20241112.png
- Plot – Scaled between 0 & 1: p_o_zig_om_20241112.rds
- Plot – Rank Stability: p_o_zig_om_20241112.rds
- Rank stability - Model results in table: tab_normalize_3rd_lagmod_20241112.csv
5.6 Predictive Ability (Supplement)
Script: 6_AUE_onto_predict_winter.Rmd
Input: trex_summary_clean_complete…rds – latest version
Output: Plot: plot_predict_mp10m_cube_20241112.png