DOI: 10.5061/dryad.3xsj3txvb
title: Data from: Sex-biased cooperation among immature peers: It matters who helps whom

description: Our understanding of sex-biased helping has progressed from a historical
 emphasis on relatedness differences caused by haplodiploidy to an
 understanding of the role played by the rarer-sex effect. Theory to date
 typically assumes that offspring help their mother. We show that an
 alternative, peer-to-peer cooperation, can shed light on the interaction
 of helpers and the recipients of help. In pine sawfly (Diprion pini)
 larvae, larval peer-to-peer cooperation takes the form of collective, and
 individually costly, antipredator behaviour. Larvae typically occur in
 mixed-sex groups, but females can lay unfertilized eggs that develop into
 haploid males, which produce male-only broods. Female-biased sex ratios
 typically select for female-biased helping, and our model here matches
 empirical findings. Alternative scenarios provide insight too: (1) if
 genetic constraints permit no sex-specificity in behaviour beyond haploid
 males expressing all alleles while helping in females can be recessive or
 dominant, then the sex difference in helping simply reflects the effects
 of dominance. (2) Female-biased helping can also emerge under male-biased
 sex ratios, if males are mostly produced in single-sex broods by unmated
 mothers. While this last example remains hypothetical for D. pini, it
 highlights an underappreciated point: the rarer-sex effect impacts
 solutions not only by modifying fitness prospects of the helper, but also
 of the recipient of help.
description: # Data from: Sex-biased cooperation among immature peers: It matters who
 helps whom Dataset DOI: [10.5061/dryad.3xsj3txvb](10.5061/dryad.3xsj3txvb)
 ## Description of the data and file structure This dataset contains
 simulation and analysis code used to study an alternative, peer-to-peer
 cooperation, which can shed light on the interaction of helpers and the
 recipients of help. The models track the proportion of defenders among
 males, females, and the total population under different genetic
 assumptions. Code used to generate the `.csv` data files and analysis
 notebooks is included, along with supplementary data from pine sawfly
 populations. Detailed information about all the parameters of the model
 are present in the supplementary. ### Files and variables #### File:
 Closed_model.m **Description:** MATLAB script for a **closed model** for
 the coevolution of sex ratio and sex-specific defence. This model is
 included in the supplementary analyses. #### File: Model_1_datagen.ipynb
 **Description:** Jupyter notebook for the **constrained model**, where
 males and females share the defense locus. * Produces 6 `.csv` files of
 defender proportions: * `BM_f_dom_u_r` – female
 defender proportion (dominant allele case). *
 `BM_m_dom_u_r` – male defender proportion
 (dominant). * `BM_t_dom_u_r` – total defender
 proportion (dominant). * `BM_f_rec_u_r` – female
 defender proportion (recessive). *
 `BM_m_rec_u_r` – male defender proportion
 (recessive). * `BM_t_rec_u_r` – total defender
 proportion (recessive). #### File: Model_2_datagen.ipynb
 **Description:** Jupyter notebook for the **unconstrained model**, where
 males and females have separate defense loci. * Produces 6 `.csv` files of
 defender proportions: * `ML_f_dom_u_r` – female
 defender proportion (dominant allele case). *
 `ML_m_dom_u_r` – male defender proportion
 (dominant). * `ML_t_dom_u_r` – total defender
 proportion (dominant). * `ML_f_rec_u_r` – female
 defender proportion (recessive). *
 `ML_m_rec_u_r` – male defender proportion
 (recessive). * `ML_t_rec_u_r` – total defender
 proportion (recessive). #### File: Data_analysis.ipynb
 **Description:** Jupyter notebook to analyze the `.csv` outputs from
 Model1 and Model2. Generates the main figures used in the manuscript. ####
 File: DataFigS1_D.pini_sex_ratio_natural_populations.xlsx
 **Description:** Spreadsheet of sex ratio data from pine sawfly
 populations. Used in Figure S1. * Columns: `population`, `group ID`,
 `number of females`, `number of males`, `sex ratio`. ## Code/software *
 MATLAB is needed to run the `Closed_model.m` * Julia is required for
 `Model_1_datagen.ipynb`, and `Model_2_datagen.ipynb` * Python is required
 to run `Data_analysis.ipynb` All the required dependencies are mentioned
 in the code files. ## Usage 1. Open `Model_1_datagen.ipynb` or
 `Model_2_datagen.ipynb` in Jupyter and run all cells to generate `.csv`
 output files. 2. Open `Data_analysis.ipynb` to process the `.csv` files
 and recreate the manuscript figures. 3. The `.xlsx` file can be opened in
 Excel or any spreadsheet program for reference. ## Access information
 Other publicly accessible locations of the data: *
 [https://github.com/AbhayGupta115/PineSawflyModel](https://github.com/AbhayGupta115/PineSawflyModel)