Data and code from: Group size dependent selection for cooperation versus freeloading in collective chemical defence
Data files
Apr 24, 2026 version files 232.72 KB
-
Data_MS_group_size_final.xlsx
186.64 KB
-
Groupsize_Sertifer_final.R
30.99 KB
-
README.md
15.09 KB
Abstract
Cooperation in public goods is expected to evolve more rapidly in smaller groups than in larger groups because individuals receive a larger share of the benefits, reducing the benefits of freeloading. However, experimental evidence for this hypothesis remains limited to microorganisms, restricting our understanding of the evolution of cooperative traits. Here, we show that in the collectively defending larvae of Neodiprion sertifer, survival against predation is higher in cooperative groups, with the benefits of cooperation more pronounced in small groups (5 larvae) than in large groups (20 larvae). Individuals also participate less in collective defence in larger groups, not because of higher life-history costs resulting from increased resource competition, but because they adjust their contribution according to group size. These results provide novel empirical evidence that selection for cooperation in collective goods is group size-dependent, promoting cooperation in smaller groups, whereas the relative fitness of freeloaders is higher in larger groups.
Dataset DOI: 10.5061/dryad.jq2bvq8pc
Description of the data and file structure
This dataset contains the experimental data required to replicate statistical analyses from Van Meyel et al. (submitted). The data were collected during two experiments testing how group size influences the selection for cooperation in collective chemical defence in the gregarious pine sawfly (Neodiprion sertifer). The first experiment used larvae of N.sertifer collected in Puumala, Finland in June 2023. Experimental treatments manipulated group size (5 or 20 larvae) and group level of cooperation (control vs. low level of defence) and the larval survival was measured against predation by wood ants. The second experiment conducted in 2017 used F1 generation of N.sertifer from Puumala and Pieksämäki, Finland. Experimental treatments manipulated group size (3, 10, or 20 larvae) and measured the effect of group size on group level defence, individual level defence and individual life history traits. NA represents any missing data.
The dataset is provided as an annotated Excel file (Data_MS_group_size_final.xlsx) with separate sheets corresponding to different research questions. In the last sheet entitled ‘README’, the different questions and column definitions are provided in detail.
A fully annotated R script (Groupsize_Sertifer_final.R) is also provided and corresponds to the statistical analyses described in Van Meyel et al. (submitted).
Results from these analyses show that survival against predation is higher in cooperative groups and that the benefits gained via collective defence are more pronounced in smaller groups. As predicted by theory, individuals participate less in collective defence in larger groups than in smaller ones. This lower contribution is not attributed to higher life-history costs from increased resource competition. Altogether, these results suggest that selection for cooperation in public goods is group size dependent, promoting cooperation in smaller groups whereas the relative fitness of freeloaders is higher in larger groups.
Files and variables
File: Data_MS_group_size_final.xlsx
| Name and definition of sheet | |
|---|---|
| Question I.1 | How group size and levels of cooperation independently and jointly influence larval group defence (U-posture and fluid deployment). Data structured as 1 row per larva within a group. |
| Question I.2 | How group size and levels of cooperation independently and jointly influence survival against ants predation. Data structured as 1 row per larva within a group. |
| Question II.1 | How contributions to collective chemical defence depend on group size, using the probability that larvae within a group perform defensive behaviour. Data structured as 1 row per larva within a group. |
| Question II.2 | How contributions to collective chemical defence depend on group size, using the absolute number of larvae performing defensive behaviour within the group. |
| Question III and IV | How group size affects individual willingness to defend, and how group size and defensive behaviour affect individual performance and life-history traits. |
| Name and definition of column title | |
| Question I.1 | |
| BoxID | Defined as the experimental group identity, to allow double-blind and to test for potential influences of the shared environment of the larval group. This variable is labeled ‘BoxID’ in the dataset and corresponds to ‘GroupID’ in the manuscript. |
| Grp_size | Corresponds to the two group sizes in the experiment: groups of 5 larvae and groups of 20 larvae. |
| Defence | Defined as the treatment name of the group, corresponding to: “control” or “depleted”. |
| Treatment | Defined as the treatment code of the group, corresponding to: “5con”, “5dep”, “20con”, or “20dep”. |
| RegBeh | Corresponds to the binary variable indicating whether larvae within the group deployed the defensive fluid (1 = yes, 0 = no). |
| HeadBeh | Corresponds to the binary variable indicating whether larvae within the group displayed the U-posture (1 = yes, 0 = no). |
| Question I.2 | |
| IndivID | Defined as the identity of each larva in the experiment, to allow double-blind. |
| BoxID | Defined as the larval group identity in the experiment, to allow double-blind and to test for potential influences of the common larval environment. This variable is labeled ‘BoxID’ in the dataset and corresponds to ‘GroupID’ in the manuscript. |
| NestID | Identifier of the ant nest used in the experiment, to account for potential variation in survival due to differences among ant trails or nests. |
| Grp_size | Corresponds to the two group sizes in the experiment: groups of 5 larvae and groups of 20 larvae. |
| Defence | Defined as the treatment name of the group, corresponding to: “control” or “depleted”. |
| Treatment | Defined as the treatment code of the group, corresponding to: “5con”, “5dep”, “20con”, or “20dep”. |
| Prop_surv | Corresponds to the proportion of larvae that survived within the group, calculated by dividing the number of larvae alive by the total number of larvae. |
| Survive | Larval survival recorded by counting the number of larvae in each group at the start of the experiment and again after seven hours. |
| Question II.1 | |
| BoxID | Defined as the experimental group identity, to allow double-blind and to test for potential influences of the shared environment of the larval group. This variable is labeled ‘BoxID’ in the dataset and corresponds to ‘GroupID’ in the manuscript. |
| FamilyID | Defined as the original family from which the larvae originate, to allow double-blind and control for family effects. |
| PopulationID | Indicates the population of origin of the larvae (Puumala or Pieksämäki). |
| Grp_size | Corresponds to the 3 group sizes treatment in the experiment: groups of 3 larvae, groups of 10 larvae, and groups of 20 larvae. |
| RegBeh | Corresponds to the binary variable indicating whether larvae within the group deployed the defensive fluid (1 = yes, 0 = no). |
| HeadBeh | Corresponds to the binary variable indicating whether larvae within the group displayed the U-posture (1 = yes, 0 = no). |
| Question II.2 | |
| BoxID | Defined as the experimental group identity, to allow double-blind and to test for potential influences of the shared environment of the larval group. This variable is labeled ‘BoxID’ in the dataset and corresponds to ‘GroupID’ in the manuscript. |
| FamilyID | Defined as the original family from which the larvae originate, to allow double-blind and control for family effects. |
| PopulationID | Indicates the population of origin of the larvae (Puumala or Pieksämäki). |
| Grp_size | Corresponds to the 3 group sizes treatment in the experiment: groups of 3 larvae, groups of 10 larvae, and groups of 20 larvae. |
| RegBeh | Correspond to the number of larvae in the group deploying the defensive fluid after a simulated pradtor attack. |
| HeadBeh | Correspond to the number of larvae in the group adopting the U-posture after a simulated predator attack. |
| Total_larvae | Represents the total number of larvae within each group. |
| Nb_Males | Represents the number of males within the group, estimated at the end of the experiment. |
| Nb_Females | Represents the number of females within the group, estimated at the end of the experiment. |
| Nb_unknown | Represents the number of individuals in the group whose sex could not be determined (larvae that died before pupation or emergence as adults). |
| Question III and IV | |
| IndividualID | Defined as the identity of each individual in the experiment, to allow double-blind. |
| BoxID | Defined as the experimental group identity, to allow double-blind and to test for potential influences of the shared environment of the larval group. This variable is labeled ‘BoxID’ in the dataset and corresponds to ‘GroupID’ in the manuscript. |
| FamilyID | Defined as the original family from which the larvae originate, to allow double-blind and control for family effects. |
| PopulationID | Indicates the population of origin of the larvae (Puumala or Pieksämäki). |
| Grp_size | Corresponds to the 3 group sizes treatment in the experiment: groups of 3 larvae, groups of 10 larvae, and groups of 20 larvae. |
| Hatching_date | Indicates the date of egg hatching, used to calculate developmental time. |
| Length | Represents the body length of each larva, measured with a digital caliper to the nearest 0.1 mm. |
| Volume_def | Defined as the volume of defensive fluid, measured as the length of liquid sucked into a 5 µL capillary tube using a digital caliper (±0.1 mm). |
| HeadBeh | Indicates whether each larva adopted the U-posture after gentle pressure on the dorsal and ventral sides with a capillary tube. |
| RegBeh | Indicates whether each larva produced a defensive droplet after gentle pressure on the dorsal and ventral sides with a capillary tube. |
| Pupa_date | Corresponds to the date at which the larvae pupated. |
| Pupa_mass | Corresponds to the mass of pupae measured 3–4 days after pupation. |
| Adult_date | Represents the date of adult emergence. |
| Sex | Corresponds to the sex of the individuals, determined morphologically. |
| Death_date | representes la date de mort des individus |
| Est_eggs | Indicates the number of eggs produced by females. |
| Larvae_Number | Represents the number of larvae that emerged from the eggs. |
| ID_mating_partner | Indicates the males' identity used for mating with a female of the same treatment, in order to measure reproductive output. |
| Dev_time_pupa_day | Corresponds to the developmental time (in days) between hatching and pupation |
| Dev_time_adults | Corresponds to the developmental time (in days) between pupation and adult emergence. |
| Growth_rate | Represents weight gain, calculated as pupa mass divided by developmental time. |
File: Groupsize_Sertifer_final.R
Description: R code corresponding to the statistical analyses performed with the above dataset. The code is annotated directly.
Code/software
All statistical analyses were performed in R v4.4.1 (http://www.r-project.org/) with the following packages: car (Fox & Weisberg 2011), lme4 (Bates et al. 2015); ggplot2 (Wickham 2016); DHARMa (Hartig 2016), emmeans (Lenth 2018), brms (Bürkner 2017). The residuals from each model were visually examined for deviations from normality and for heteroscedasticity (Zuur et al. 2010), using the testResiduals() function from the DHARMa package, which performs standard diagnostic checks based on simulated residuals(Hartig 2016). In Bayesian models, convergence was evaluated by ensuring Rhat values were below 1.01 for all parameters and effective sample sizes (ESS) were sufficient, with no divergent transitions detected. Posterior predictive checks confirmed good model fit (Bürkner 2017).
