DOI: 10.5061/dryad.cc2fqz6gt
title: Data and R script from: Females prioritize future over current offspring in wild seasonally breeding Assamese macaques

description: Classical work on birds by Lack was foundational to life history theory
 when it uncovered a trade-off between offspring quantity and quality.
 Evidence for a similar trade-off was later found in singleton-bearing
 mammals, but its extent and underlying mechanisms are not fully
 understood. Here, we explore the role of adaptive reproductive scheduling
 and maternal energy depletion as the basis of the trade-off with data on
 410 births by 104 mothers recorded over 18 years in a wild Assamese
 macaque (Macaca assamensis) population with seasonal reproduction. In any
 given mating season and after controlling for maternal age effects, the
 probability for a female to conceive was strongly predicted by the
 presence of a dependent offspring. The younger the current infant was, the
 less likely mothers invested in a new reproductive event possibly to avoid
 stacked investment into nursing and unborn offspring. An inverse
 relationship between current infant survival and the conception of a new
 sibling points toward a shift in maternal resource allocation to future
 offspring. However, to avoid the energetic drain of shorter birth
 intervals, mothers delayed their reproductive timing within the mating
 season by 49 days with negative downstream effects for the next
 reproductive opportunity.
description: This dataset comprises demographic data collected from a wild
 population of Assamese macaques (<em>Macaca assamensis</em>)
 from 2006–2024. The dataset is presented in raw form with minimal
 processing. Binary variables (e.g., 1 for survival and 0 for death) have
 been coded directly based on observed events. Detailed descriptions of
 variables, dataset structure, and any additional processing steps are
 provided in the accompanying README file. 
description: # Data from: Females prioritize future over current offspring in wild
 seasonally breeding Assamese macaques
 [https://doi.org/10.5061/dryad.cc2fqz6gt](https://doi.org/10.5061/dryad.cc2fqz6gt) ## Description of the data and file structure This file provides an overview of the datasets and R code associated with the manuscript, "Females prioritize future over current offspring in wild seasonally breeding Assamese macaques." The analysis is based on demographic data collected from a wild population of Assamese macaques (*Macaca assamensis*) from 2006–2024. ### **Datasets** ##### **File:** Data.zip **File structure**: The datasets are provided in the "**DATA**" subfolder in '.csv' (Comma-Separated Values) format. Below are the included files: #### **List of Files** 1\. data_age.csv 2\. data_infant.csv 3\. data_post.csv 4\. data_supp.csv 5\. data_syb.csv ### Files and variables #### File: data\_age.csv **Description:** Dataset to analyse the effect of age of previous offspring on conception ##### Variables * Conception: Indicates if a female conceived or not (Binary variable, 0 for no conception, 1 for conception) * max.age.older_mon: Maximum possible age of the previous offspring in months, including the error margin * min.age.older_mon: Minimum possible age of the previous offspring in months, including the error margin * Mother_age: Age of the adult female/mother in years * z.mother_age: Standardized age of adult female * GroupID: Anonymized identifier for social groups * Mother_ID: Anonymized identifier for individual females #### File: data\_infant.csv **Description:** Dataset to analyse the effect of preceding and subsequent sibling on infant survival ##### Variables * Infant_survived_1Year: Indicates the survival of an infant till 1 year of age (Binary variable, 0 for death, 1 for survival) * Sibling_last_year: Indicates the birth of a sibling in the preceding year surviving till 6 months (binary variable, 0 for no birth, 1 for birth) * Sibling_next_year: Indicates the conception of a sibling in the same year (binary variable, 0 for no conception, 1 for conception) * Mother_age: Age of the adult female/mother in years * z.mother_age: Standardized age of adult female * GroupID: Anonymized identifier for social groups * Mother_ID: Anonymized identifier for individual females #### File: data\_post.csv **Description:** Dataset to analyse the effect of interbirth interval on birth timing  ##### Variables * Num_days: Number of days into the year, calculated from January 1st * IBI: Interbirth interval in years * GroupID: Anonymized identifier for social groups * Mother_ID: Anonymized identifier for individual females #### File: data\_supp.csv **Description:** Dataset for supplementary analysis after relaxing criterion for survival for preceding sibling ##### Variables * Infant_survived_1Year: Indicates the survival of an infant till 1 year of age (Binary variable, 0 for death, 1 for survival) * Sibling_next_year: Indicates the conception of a sibling in the same year (binary variable, 0 for no conception, 1 for conception) * Sibling_last_year: Indicates the birth of a sibling in the preceding year (binary variable, 0 for no birth, 1 for birth) * Mother_age: Age of the adult female/mother in years * z.mother_age: Standardized age of adult female * GroupID: Anonymized identifier for social groups * Mother_ID: Anonymized identifier for individual females #### File: data\_syb.csv **Description:** Dataset to analyse the effect of same year birth on subsequent conception ##### Variables * Conception: Indicates if a female conceived or not (Binary variable, 0 for no conception, 1 for conception) * same_yr_birth: Indicates the birth of an offspring earlier the same year a female conceived again (binary variable, 0 for no birth, 1 for birth) * same_yr_birth.1: Mean-centered version of same_yr_birth, where the values are adjusted by subtracting the mean of the variable * Mother_age: Age of the adult female/mother in years * z.mother_age: Standardized age of adult female * GroupID: Anonymized identifier for social groups * Mother_ID: Anonymized identifier for individual females ## Code/software **R Code** The provided R script replicates all analyses and figures from the manuscript and supplementary materials. **Script Overview** '**Code_submit.R**': This script includes all steps for loading libraries, importing data, processing data, running Bayesian models, and reproducing results. Sections: * Data loading and processing - Bayesian model fitting * Model diagnostics and results visualization - Generating plots for all figures in the manuscript and supplementary files The script can be run as-is without additional manipulation. Sometimes, models may encounter a small number of divergent transitions during the MCMC sampling process, if these occur, please rerun the model or adjust the MCMC settings (e.g., iterations, chains, thinning). These adjustments will make sure the model converges and will ensure the robustness of the results. Users may also adjust file-saving options as needed for plots. The script includes detailed comments for ease of understanding by users but if any further details are needed, please feel free to reach out. **Dependencies** The following R packages are required to run the code: * **dplyr:** For data manipulation - **tidyr**: For data tidying - **brms**: For Bayesian modeling - **tidybayes**: For working with Bayesian models - **ggplot2**: For data visualization - **cowplot**: For combining plots - **patchwork**: For arranging multiple plots To install these following packages, run this command in R: ``` install.packages(c("dplyr", "tidyr", "ggplot2", "cowplot", "patchwork")) ``` ``` install.packages("brms") ``` ``` install.packages("tidybayes") ```