DOI: 10.5061/dryad.ht76hdrqm
title: Biomimetic robots reveal flexible adjustment of sexual signalling in a wild invertebrate

description: Studies of vocalisations and gestures in primates, birds and fish show
 that signalling behaviour is flexibly adjusted depending on the presence,
 characteristics and behavioural states of others. Such flexibility is
 likely important in competitive social contexts such as sexual signalling,
 where attractiveness is directly affected by rival behaviour. Although
 sexual displays are often sensitive to the presence and proximity of
 rivals, less is known about the effect of changes in rival signalling. In
 this study, we used a biomimetic robot to manipulate rival morphology and
 waving behaviour in a wild population of fiddler crabs (Afruca tangeri)
 and investigated whether males responded flexibly by adjusting their own
 activity and waving. We found that males were less likely to enter their
 burrow when the robotic rival was waving, particularly if that rival had a
 small claw, spending less time in their burrow if they did enter. While
 outside, males produced more waves when the robotic rival was waving fast,
 not by changing their own rate but by prolonging their bouts. These
 results reveal the subtle ways in which an invertebrate flexibly adjusts
 behaviour to remain competitive in a dynamic environment, investing more
 in signalling when it is likely to be most profitable.
description: 1 Study area and species The study was carried
 out between May and July 2022 on a wild population of A. tangeri that
 inhabit the Ria Formosa Natural Park on the south-eastern coast of
 Portugal, between Manta Rota and Cacela Velha (37.16 N, 7.53 W). At low
 tide, this area consists mainly of mudflats, salt marshes and dry sandy
 banks. 2 Robotic stimulus male To
 provide a standardised rival stimulus of different sizes, we used a 3D
 scan of a fiddler crab specimen from a museum collection [47]. The body
 and major claw of this scan were 3D-printed separately by FabLab Devon
 (fablabdevon.org). The major claws were printed in two sizes: one where
 the major claw was 5 cm from manus base to pollex tip (the approximate
 mean length of male <em>A. tangeri</em> major claws in our
 records; see supplementary materials), and one where the major claw
 measured 7 cm (the largest major claw length in our records; see
 supplementary materials). The body was 3D printed in one size: the size of
 the original scan when the major claw was scaled to the mean length (25.8
 mm carapace width). After printing, the models were painted to closely
 resemble male <em>A. tangeri</em> colours to the human eye
 using acrylic paint (figure 1). The printed major claw
 was glued to a mobile joint that allowed vertical movement. This joint was
 then fixed to a plastic base and a length of metal wire passed through the
 plastic base, allowing the printed claw to be joined to a Tower Pro Micro
 Servo SG90. This micro servo was attached to an Arduino Uno Rev3
 microcontroller that controlled the timing of the micro servo movement and
 therefore the vertical movement of the printed claw, emulating the waving
 of a male <em>A. tangeri</em>. The Arduino microcontroller was
 also connected to an HC-05 Bluetooth serial transceiver, allowing the wave
 speed of the robot to be changed remotely via Bluetooth connection to a
 phone. The robotic stimulus male could wave at two speeds: a “Slow” speed
 of one wave every 2 s, simulating low-intensity waving; and a “Fast” speed
 of one wave every 1 s, simulating high-intensity waving (see video in
 supplementary materials). These wave speeds were estimated from videos of
 real males collected in previous field seasons (SKD unpubl.).
 We assume focal male behaviour reflects responses to any rival
 male rather than being specific to the scanned specimen that formed the
 basis of our 3D-printed models. We observed multiple male <em>A.
 tangeri</em> aggressively challenging and physically attacking the
 robotic rival during test trials (see supplementary materials). Given that
 we have only observed A. tangeri fighting with conspecifics, we are
 confident that the focal males perceived the robotic rival as a
 conspecific rival male and our assumption of generalisability is
 justified. 3 Experimental set-up All
 experimental trials were carried out during diurnal low-tide periods,
 between 8:00 and 17:00. Before the trial began, a male who was actively
 waving on the surface next to his burrow was selected as the focal male.
 All burrows within a 60 cm radius of the focal male’s burrow were plugged
 for the duration of the trial (~20 minutes) using bundles of locally
 collected samphire (Salicornia europaea). This prevented any crabs that
 occupied nearby burrows from emerging onto the surface during a trial and
 temporarily removed all but the focal male from the experimental area.
 Crabs are adapted to spending 4–6 hours in their burrow every high tide,
 so it is unlikely that the trapped individuals experienced any negative
 consequences, except for a 20-minute period where food availability was
 restricted. Other males could still walk through the experimental area,
 and this was recorded when it happened. The robotic stimulus male was
 placed on the substrate 30 cm away from the focal male’s burrow entrance
 (approximately the average distance to the nearest neighbouring burrow;
 JAW unpubl.) with either the “small” or “large” claw attached. Each focal
 male was only presented with one claw size (randomised across males) for
 the duration of their trial. Two GoPro Hero 4 cameras were then set up to
 record the behaviour of the focal male, one behind the robotic stimulus
 and one on the other side of the focal male’s burrow, facing the robotic
 stimulus. This camera setup ensured that the frontal view of the focal
 male was always visible. Once all equipment was set up,
 the experimenter (JAW) retreated to a distance at which his presence would
 not affect focal male behaviour (&gt;10 m), and a timer was started.
 If the focal male did not emerge from his burrow within 7.5 minutes, that
 trial was abandoned. If the focal male did emerge, the timer was reset to
 mark the beginning of the first condition of the trial and we moved
 through a sequence of four conditions with that male, each condition
 lasting for 5 minutes: (1) the robotic stimulus was present but not waving
 (“No wave” treatment); (2) the robotic stimulus started waving at one of
 the two wave speeds (either “Slow wave” or “Fast wave” treatment); (3) the
 robot waving was stopped and the focal male experienced another “No wave”
 condition; (4) the robot waved at the speed that the focal male had not
 experienced in condition 2. All changes to robot wave speed were done
 remotely to avoid disturbing the focal male. The time
 at which the trial started was noted, as well as the substrate surface
 temperature (measured using a Magnusson KC-180A1 infrared thermometer,
 ±2°C). The claw size treatment and order of wave speed presentation were
 balanced across focal males using a randomised-blocks design: each ‘block’
 consisted of four trials covering the four possible experimental
 conditions (large, Slow→Fast; small, Slow→Fast; large, Fast→Slow; small,
 Fast→Slow), with these applied to four different males in fully randomised
 order. The same “small” and “large” robot claws were used across all focal
 males in each claw size treatment and the same robot body was used for all
 focal males. 4 Focal male morphometrics
 Once a trial had ended, all apparatus was removed from the area
 and a tube trap was placed in the entrance to the focal male’s burrow. If
 the focal male entered the trap (27 males out of 58 used for the final
 analysis), we measured the distance between the base of his manus and the
 tip of his pollex (claw length) and the widest point of the dorsal side of
 his carapace (carapace width; figure 1) using a Whitworth electronic
 calliper (± 0.01mm) and weighed him using Ohaus Traveller’s scales
 (±0.1g). The captured males were then marked with a non-toxic paint pen on
 the carapace to avoid using the same male twice across trials.<br>If
 the focal male did not enter the trap within 20 minutes (31 males out of
 58 used for the final analysis), the trap was removed and his claw length
 and carapace size were estimated from the GoPro footage using the software
 ImageJ, with a measuring tape placed above his burrow in the video footage
 for scale. Because these males were not caught, they could not be marked
 to avoid reusing them. However, their burrows were avoided when selecting
 males for future trials. Given that individuals of this species occupy
 their burrows for 1–2 weeks and given the large population (many thousands
 of individuals) occupying the mud flats in the study area, the chances of
 accidentally using the same male twice for a trial are very low.
 The experimental trials were carried out on 70 focal males, but
 only 58 were used for the final analysis as some trials were either
 interrupted by human passers-by (5 trials) or the focal male left the
 experimental area during the trial, usually after losing a fight with a
 wandering male (7 trials). Table 1 shows the focal male and trial
 information for each of the four experimental treatments, as well as
 information on the trials not included in the final analysis.
 5 Ethical note This study used biologically
 realistic interventions in a natural environment. Captured individuals
 were returned to their burrow after measurement and neighbouring burrows
 were unplugged after the trial had ended. All work was carried out with
 approval from the University of Exeter's Research Ethics Panel
 (application ID: 513844) and the Instituto da Conservação da Natureza e
 das Florestas (permit ID: 579 / 2022 / CAPT). 6
 Behaviour coding and data For each experimental trial,
 we extracted all time points at which the focal male entered or exited his
 burrow, or performed a wave with his major claw (the definitions for these
 behaviours are in Table 2). We then calculated the proportion of time the
 focal male spent in his burrow during each wave speed treatment. We also
 recorded the number of males in frame that were not the focal male, as
 well as the number of females in a frame (i.e. within a maximum of 60cm of
 the focal male), at each point in the videos.<br>Videos were coded
 once by one of the research team (JAW) who was not blind to the claw size
 or wave speed treatment. A second person, unaware of the aims of the
 study, independently coded 10 percent of the trial videos in which the
 robotic rival was not visible; this person was therefore blind to both the
 claw size and wave speed treatments. All behaviour coding was carried out
 using BORIS. The inter-rater correlation coefficient (also known as the
 intra-class correlation coefficient, ICC; calculated in R using Stan and
 Cmdstan [50-53]) for the total number of waves was 0.87 (89% highest
 density interval (HDI) [0.76, 0.97]), and the ICC for the time spent not
 waving was 0.89 (89% HDI [0.81, 0.98]). The ICC for time spent in the
 burrow was 0.87 (89% HDI [0.77, 0.97]). These values indicate ‘good’ to
 ‘excellent’ reliability for our behavioural measures. 7
 Statistical analyses 7.1 Burrow use<br>We used a
 linear hurdle model to analyse whether males adjusted the time spent in
 their burrows in response to changes in the behaviour and claw size of the
 robotic rival. In this analysis, we asked how the signalling behaviour of
 the biomimetic rival male affected (1) the probability that a male entered
 his burrow and (2) how long he spent there. For each of the 5-minute wave
 speed conditions (“No wave”, “Slow wave” or “Fast wave”), the probability
 that the male entered his burrow at all was modelled using the Bernoulli
 distribution (binary outcome, the ‘hurdle’). For those cases where the
 male did enter his burrow, the proportion of the 5 minutes he spent there
 was modelled using the Beta distribution (ranging between 0 and 1). In
 both parts of the linear hurdle model, the experimentally manipulated
 predictors we included were the wave speed of the robot, the claw size of
 the robot, as well as the interaction between the two. We also included
 treatment order and the following uncontrolled predictor variables: the
 focal male’s carapace width; his claw-length-to-carapace-width ratio; the
 substrate surface temperature at the start of the trial; and the time the
 trial started relative to the lowest tide point. Previous studies have
 found that fiddler crab behaviour is statistically associated with each of
 these variables, so we included them as fixed effects to refine our tests
 of the experimental treatment effects. Occasional visits from females and
 rival males were ignored in these models as they happened on a much
 quicker timescale than the response variable, which is a summary of a
 5-minute period. Random intercepts were included for focal male identity
 to account for non-independence among measurements and capture natural
 variation among males in their overall tendency to enter and spend time in
 the burrow. 7.2 Signalling behaviour<br>To
 analyse the male’s behaviour when he was outside his burrow, the data were
 divided into 5-second time intervals. Any 5-s intervals in which the focal
 male left the field of view of both video cameras at any point were
 discarded. In each of the remaining intervals, we recorded the number of
 times the focal male waved, the number of females in the frame, as well as
 the number of wandering rival males (in view of either of the two GoPro
 cameras). This gave a total of 10,400 5-s intervals across 58 individuals.
 We chose 5 s as the time interval for analysis to balance the amount of
 detail we retain in behavioural sequences (which is highest when the data
 are divided into small intervals) against the computational processing
 time required to analyse the data (which is also highest when the data are
 divided into many small intervals). We analysed the
 resulting data using hidden Markov models (HMMs), a data-driven approach
 that identifies the bout structure of repetitive sexual displays such as
 claw waving, avoiding the pitfalls of researcher-defined bout criteria
 that have been used in the past (discussed in Perry <em>et
 al</em>, 2019). HMMs do this by assuming that an individual is in
 one of several states at any given time. The individual’s current state is
 ‘hidden’ in the sense that it is not directly observable, but the
 expression of observable behaviour is an indicator of that state. In this
 study, we modelled focal males as being in one of two hidden states: a
 signalling state (in which he is actively displaying) and a non-signalling
 state (in which he is visible above ground but is doing anything other
 than actively displaying). We used the number of waves per 5 s as a proxy
 from which to infer the underlying state of the male. By fitting HMMs to
 the full sequence of 5-s time intervals in a trial, we could
 simultaneously estimate the male’s waving rate in the signalling state and
 his probability of transitioning between states (from signalling to
 non-signalling, or vice versa) from one interval to the next. Explicitly
 modelling the rate of waving and the probability of continuing or ending a
 signalling bout allows us to disentangle multiple ways that a male can
 adjust his bout-structured waving behaviour and may reveal flexible
 changes in signalling that would be overlooked by coarser analytical
 techniques. This technique also allows us to treat each focal male’s
 behaviour as a time series, explicitly accounting for the temporal
 autocorrelation between behaviours in successive intervals. Figure 2 is a
 visual representation of how these models work. For more information on
 HMMs see Perry <em>et al</em>. (2019), McClintock <em>et
 al</em>. (2020), and Glennie <em>et al</em>.
 (2023). The HMMs also allow us to estimate how the
 probabilities of transitioning between states and waving rates depend on
 predictor variables characterising the male and his social context. We
 estimated the effect each predictor variable has on (1) the probability a
 focal male stays in the signalling state, (2) the probability he stays in
 the non-signalling state, (3) the rate of waving when in the signalling
 state and (4) the (low) rate of waving when in the non-signalling state.
 The experimentally manipulated predictors we included were the wave speed
 of the robot, the claw size of the robot and their interaction. As before,
 to control for additional sources of variation and refine our tests of the
 experimental treatment effects, we also included the following
 uncontrolled predictor variables known to be associated with fiddler crab
 behaviour: the number of females in view (of either GoPro) in each 5-s
 interval; whether a wandering rival male was in view in each 5-s interval;
 the substrate surface temperature at the start of the trial; the focal
 male’s carapace width; his claw-length-to-carapace-width ratio; and the
 time of the 5-s interval relative to the lowest tide point. Random
 intercepts were included for focal male identity to account for
 non-independence among measurements and capture natural variation among
 males in their average transition probabilities and waving rates. A full
 outline of the models used can be found in equations 1 and 2 in the
 supplementary materials. 7.3 Model fitting<br>All
 models were written in Stan and compiled and run using CmdStanR version
 0.5.3 and CmdStan version 2.30.1 in R version 4.1.2 on the UK Crop
 Diversity high-performance computing platform. Weakly informative priors
 were used for all parameters and checked using prior predictive checks
 (full model information including priors in supplementary materials).
 Model convergence was checked using trace plots, posterior predictive
 checks, and the potential scale reduction factor (R ̂). To increase the
 stability of the reported intervals, and following the convention laid out
 by McElreath (2018), the 89% HDI of effect sizes (unless otherwise stated)
 is reported throughout. We also report the proportion of posterior samples
 indicating an effect in the opposite direction from the reported effect,
 denoted either as Pr(β &gt; 0) if the majority of the posterior
 density mass is negative, or as Pr(β &lt; 0) if the majority of the
 posterior density mass is positive; thus small values of this proportion
 suggest that the reported effect is clearly distinguishable from zero. All
 continuous predictors (temperature, time, carapace width, claw:carapace
 ratio) were converted to z-scores prior to analysis to facilitate model
 convergence and aid interpretation. All effect sizes (β) are reported on
 the link scale. Therefore, effects on transition probabilities represent
 the change in log odds associated with a 1-unit increase in the predictor.
 Effects on wave rates represent the change in the logarithm of the wave
 rate associated with a 1-unit change in the predictor. Because we used a
 Bayesian mixed-modelling framework with weakly informative, regularising
 priors, the risk of Type I errors in these models is lower than in other
 frameworks. A simplified version of this analysis was run without
 non-experimental predictors to ensure the robustness of the full model.
 This simplified model found the same results and is outlined in the
 supplementary materials.
description: # Biomimetic robots reveal flexible adjustment of sexual signalling in a
 wild invertebrate.
 [https://doi.org/10.5061/dryad.ht76hdrqm](https://doi.org/10.5061/dryad.ht76hdrqm) ## Data Description ### Wave signalling behaviour Raw data concerning the wave signalling behaviour, which is analysed via hidden Markov model (HMM): **/HMM/HMM_data.rds** The following is a description of each column in **HMM_data.rds**: 1. *ID* - Focal Male ID, ranges from 1 to 69 (the total number of focal males in the experiment). This is a categorical label and could be replaced with characters, the numbers themselves do not have any meaning beyond being a convenient label. 2. *date* - the date on which that experimental trial took place. In format dd/mm/yyyy. 3. *st_time* - the number of minutes past midnight at which the experimental trial began (e.g. 570 minutes is 9.5 hours, indicating the trial commenced at 09:30am). 4. *temp1* - the substrate surface temperature recorded at the beginning of the trial (degrees celsius). 5. *temp2* - the substrate surface temperature recorded at the end of the trial (degrees celsius). 6. *low_tide* - the number of minutes past midnight at which the tide was at its lowest on that date (same units as st_time, see above). 7. *interval_count* - the index of that 5-second interval (which occurs per row in this dataframe) per ID, once that focal had emerged from their burrow. For example, interval_count for row 1 denotes that that row is the first 5-second interval that occurred once focal male 1 left his burrow. 8. *interval_time* - the number of seconds past the beginning of the trial at which that 5-interval started. For example, in the first row, male 1 emerged from his burrow 485 seconds after the robotic male, GoPros, and other experimental equipment were placed outside his burrow and the experimenter retreated. 9. *wave_count* - the number of major claw waves a male completed during that 5-second interval. 10. *robo_behav* - the behaviour of the robotic rival during each 5-second interval. "No wave" = the robot was not waving, "Slow wave" = the robot was waving at the slow speed, "Fast wave" = the robot was waving at the fast speed. 11. *robo_order* - the order in which that row's wave speed treatment was presented to that male. For example, if robo_behav is "Slow wave" and robo_order is 2, the "Slow wave" treatment was presented as the second robotic wave speed treatment to that focal male. 12. *robo_claw* - the size of the claw presented to the focal male (does not change within focal male data). Labelled as "small" or "large" accordingly. 13. *no_fem* - the number of females in the frame of either GoPro during that 5-second interval. 14. *rival_presence* - the number of rivals in the frame of either GoPro during that 5-second interval. 15. *claw* - the focal male's claw length (millimeters). 16. *cara* - the focal male's carapace width (millimeters). 17. *mass* - the focal male's mass (grams). 18. *esti_mass* - an indicator of whether the claw, cara, and mass variables were measured directly after having successfully trapped the male (0), or whether those variables were estimated based on video footage after the trial ended (1). ### Burrow-use behaviour Raw data concerning the burrow-use behaviour, which is analysed via linear hurdle model (HMM): **/LHM/LHM_data.rds** The following is a description of each column in **LHM_data.rds**: 1. *ID* - Focal Male ID, ranges from 2 to 69 (the total number of focal males in the experiment). This is a categorical label and could be replaced with characters; the numbers themselves do not have any meaning beyond being a convenient label. 2. *st_time* - the number of minutes past midnight at which the experimental trial began (e.g., 570 minutes is 9.5 hours, indicating the trial commenced at 09:30 am). 3. *temp* - the substrate surface temperature recorded at the beginning of the trial (degrees Celsius). 4. *low_tide* - the number of minutes past midnight at which the tide was at its lowest on that date (same units as st_time, see above). 5. *prop* - the proportion of that 5-minute robotic behaviour treatment period that a focal male spent inside his burrow. 6. *robo_behav* - the behaviour of the robotic rival during each 5-minute period. "No wave" = the robot was not waving, "Slow wave" = the robot was waving at the slow speed, "Fast wave" = the robot was waving at the fast speed. 7. *robo_claw* - the size of the claw presented to the focal male (does not change within focal male data). Labelled as "small" or "large" accordingly. 8. *claw* - the focal male's claw length (millimeters). 9. *cara* - the focal male's carapace width (millimeters). 10. *mass* - the focal male's mass (grams). 11. *slow_wave_dummy* - a dummy variable indicating whether the robotic rival was in the "Slow wave" treatment during a 5-minute period (extracted from *robo_behav*). 12. *fast_wave_dummy* - a dummy variable indicating whether the robotic rival was in the "Fast wave" treatment during a 5-minute period (extracted from *robo_behav*). 13. *large_claw_dummy* - a dummy variable indicating whether the robotic rival had the large claw during a male's experimental trials (extracted from *robo_claw*). 14. *ccrat* - the focal male's claw length (*claw*) divided by the carapace width (*cara*). Gives a ratio of claw length to carapace width. 15. *treatment_order* - the order in which that row's wave speed treatment was presented to that male. For example, if robo_behav is "Slow wave" and robo_order is 2, the "Slow wave" treatment was presented as the second robotic wave speed treatment to that focal male. 16. *ID_new* - equivalent to ID, but with numerical labels starting at 1 and running to 58, so as to remove missing focal ID labels for use in the Stan model. ## Folder structure The data and scripts are stored within a zip file (**DRYAD_repo.zip**). Extract this first. Within this, there will be two folders: **/HMM** and **/LHM**. * **HMM** contains the data (**HMM_data.rds**) needed to run the hidden Markov model (run using **run_hidden_Markov_model.R** which will call **hidden_Markov_model.stan** as the actual model) on signalling behaviour. This folder also contains a subfolder called **experimental_model/**, which contains the script necessary to run the experimental-only version of the HMM reported in the paper. * **LHM** contains the data (**LHM_data.rds**) needed to run the linear hurdle model (run using **run_linear_hurdle_model.R** which will call **linear_hurdle_model.stan** as the actual model) on burrow-use. ## Code/Software All code was created using R version 4.1.2, CmdStanR version 0.5.3, and CmdStan version 2.30.1. All R scripts have been fully annotated to aid with interpretation. CmdStanR will be needed to run these models. This can be installed using the following code: ``` install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos"))) library(cmdstanr) check_cmdstan_toolchain(fix = TRUE, quiet = TRUE) install_cmdstan() # On networked PCs, specify a local directory here with the argument dir=path_to_local_directory ``` Other packages (available on CRAN) are: * tidyverse * boot * bayesplot * ggdist * HDInterval * ggpubr