DOI: 10.5061/dryad.8w9ghx419
title: Data and code from: Quantifying feedback among traits in coevolutionary models

description: Phenotypic traits rarely evolve in isolation. Instead, multiple traits
 typically interact to influence fitness, resulting in complex
 coevolutionary dynamics. Such dynamics can be predicted using mathematical
 frameworks such as adaptive dynamics and quantitative genetics. Selection
 gradients play a crucial role in these frameworks, describing the
 direction and strength of selection and thus predicting evolutionary
 trajectories and potential endpoints. Current theory focuses mainly on
 analysing how traits change in response to selection, which changes over
 time as traits evolve. However, the extent to which changes in each trait
 contribute to changes in the selection environment remains unquantified,
 leaving much of our understanding of trait coevolution reliant on verbal
 reasoning. To advance a more comprehensive and quantitative understanding
 of coevolutionary dynamics, we develop a general framework that examines
 how trait changes feed back to influence the selection environment. This
 framework enables a fine-grained and systematic investigation of
 coevolutionary feedback between traits and selection gradients by
 quantifying the pathways through which they influence one another. Our
 framework can be applied both to adaptive-dynamic models and to
 quantitative-genetic models under the weak selection limit. We illustrate
 our approach with three examples that showcase its potential to deepen our
 understanding of established models.
description: # Data and code from: Quantifying feedback among traits in coevolutionary
 models Dataset DOI:
 [10.5061/dryad.8w9ghx419](https://doi.org/10.5061/dryad.8w9ghx419) ##
 Description of the data and file structure This repository contains
 Mathematica scripts used to perform the feedback analysis in Examples 1
 and 2 of this study, along with the data generated by running the code.
 **Example 1**: We investigate the evolution of a single trait: offspring
 size (e.g., the size of eggs at laying or offspring at birth in species
 with no further parental care), building on the framework established by
 Smith and Fretwell (1974). The larger the offspring, the higher its
 probability of survival, but the fewer offspring the parents will produce.
 **Example 2**: We next demonstrate the application of our feedback
 analysis to a model with two coevolving traits: the anisogamy model of
 Lehtonen and Kokko (2011). ### Files and variables #### File:
 Supplementary_Materials_Mathematica_scripts.nb **Description:** The
 Mathematica scripts were used to perform the feedback analysis shown in
 Examples 1 and 2 of this study. Running the code generates Figures 5 and 6
 and two CSV files provided in `data.zip`. Figure 5. Application of
 feedback analysis to the evolution of a single trait, offspring size.
 (A) Evolutionary trajectory following the canonical equation, (B)
 selection gradient and (C) feedback over evolutionary time.  Figure 6.
 Application of feedback analysis to the evolution of anisogamy. Based on
 the model of Lehtonen and Kokko (2011), gamete sizes of two mating types
 coevolve. (A~1~, B~1~) Evolutionary trajectories following the canonical
 equation of adaptive dynamics. (A~2~, B~2~) Selection gradients over
 evolutionary time. (A~3~, B~3~) Within-trait feedback (blue lines) on each
 selection gradient. (A~4~, B~4~) Cross-trait feedback (green lines) on
 each selection gradient. #### File:
 Supplementary_Materials_Mathematica_scripts.pdf **Description:** We also
 provide our Mathematica notebook file in PDF format to ensure the data is
 universally readable and ready for analysis. #### File: data.zip
 **Description:** Two CSV files are provided: `one_trait_evolution.csv` for
 Example 1 and `anisogamy_evolution.csv` for Example 2.
 `one_trait_evolution.csv` * generation: current generation time *
 offspring_size: offspring size of the resident population *
 selection_gradient: selection gradient measuring the direction and
 strength of selection acting on offspring size. * feedback: within-trait
 feedback  `anisogamy_evolution.csv` * Generation: current generation time
 * xSize: gamete size of mating type mx * ySize: gamete size of mating type
 my * SelGraX: selection gradient measuring the direction and strength of
 selection acting on gamete size of mating type mx. * SelGraY: selection
 gradient measuring the direction and strength of selection acting on
 gamete size of mating type my. * FeedbackXWithinX: within-trait feedback,
 i.e., direct selection on the mx affects selection on mx *
 FeedbackXCrossY: cross-trait feedback, i.e., direct selection on the my
 affects selection on mx * FeedbackYWithinY: within-trait feedback, i.e.,
 direct selection on the my affects selection on my * FeedbackYCrossX:
 cross-trait feedback, i.e., direct selection on the mx affects selection
 on my ## Files and variables Code/Software The data were generated and
 analyzed using Wolfram Mathematica (14.0.0). No additional packages beyond
 the standard Mathematica installation were required. The workflow consists
 of running the provided Mathematica scripts, which reproduce the feedback
 analyses shown in Figures 5 & 6, and two CSV files stored in
 `data.zip`. The scripts include code for generating evolutionary
 trajectories, selection gradients, and feedback components. While
 Mathematica itself is not open-source, all scripts are provided with this
 submission to allow reproduction of the results by users with access to
 the software.