DOI: 10.5061/dryad.q83bk3jwq
title: Data and code from: Live birth in lizards: A process-based model for the roles of temperature, behavior, and life-history

description: Life-history traits evolve to optimize fitness trade-offs across an
 organism’s life cycle. Potentially to mediate the trade-off between
 survival and fecundity, multiple animal groups have independently evolved
 live birth (viviparity), including at least 70 transitions in lizards
 alone. In lizards, viviparity is thought to evolve as a mechanism to
 improve embryonic development in cold climates (cold climate hypothesis,
 or CCH), possibly at the expense of the mother’s survival. Past
 comparative studies often align with the CCH’s predictions, but they
 usually treat core features of the hypothesis as implicit and, most
 importantly, infer process from pattern rather than testing causal
 mechanisms. To address this, we developed a process-based model that
 integrates behavior, thermal physiology, life history, and climate to
 predict optimal gestation length in lizards globally. We generated a
 comprehensive trait database of 89 lizard populations that vary in parity
 mode, and we used ecophysiological modelling to test our model’s
 predictive power. Our model produced accurate predictions, strongly
 supporting the hypothesis that cold climates favor the evolution of
 viviparity in lizards and revealing the ecological contexts and underlying
 mechanisms by which this life history strategy evolves.
description: # Data and code for: Live birth in lizards: A process-based model for the
 roles of temperature, behavior, and life history This repository contains
 all data and code used in the manuscript: "Live birth in lizards: A
 process-based model for the roles of temperature, behavior, and life
 history" by Garcia-Costoya et al., published in *Evolution Letters*
 (2025) ## Description of the data and file structure. All supplementary
 files are offered within the compressed folder
 **viviparity-model-supplementary-materials.zip**. Within it, the
 sub-folder `data/`contains all data used in the manuscript. Within it,
 there are five files: 1. `adult_data.csv`: Population-level data on adult
 characteristics. Contains columns for `parity` mode (Oviparity or
 Viviparity), `species` (in Genus_species format), latitude, longitude
 (`lat`, `lon` - in degrees), elevation (`elev` - in meters above sea
 level), adult thermal physiology traits (thermal optimum - `topt_a`,
 critical thermal minimum - `ctmin_a`, critical thermal maximum -
 `ctmax_a` all in ^o^C), life history traits (mass of adults - `za` in
 grams, mass of hatchlings - `ze`  in grams, clutch/litter size - `n`),
 activity hours (`activity` - e.g., Diurnal, Nocturnal or Cathemeral),
 substrate use (`substrate` - Arboreal, Terrestrial, Fossorial, Saxicolous
 etc.), major biome (`biome`), timing of embryonic development (month when
 eggs are first seen in oviducts - `eggs_seen`, month when hatchlings are
 first seen - `hatchlings_seen`), nesting conditions (nest depth in cm -
 `nest_depth`, nest shade as a proportion of sun exposure as a percent -
 `nest_shade`), and source information for adult thermal physiology data
 (`source` - either `b` for Buckley et al. 2023 or `dg` for
 Domínguez-Guerrero et al. 2022) and for life-history trait data
 (`source_lh`, either `dg` for Domínguez-Guerrero et al. 2022 or `sb` for
 the SquamBase in Meiri et al. 2023). Furthermore, the columns `breed_ref`
 and `nest_ref` provide reference numbers for breeding phenology and
 nesting conditions, respectively, which can be correlated with
 `embryo_dev_nest_conditions_citations.xlsx`. For populations where no
 information on breeding phenology was available, we obtained data from the
 species that was both phylogenetically and geographically closest to the
 species of interest, and this species is listed in the column
 `breed_other_species`. All cases where information was missing are
 indicated with `NA`. 2. `embryo_thermal_phys.csv`: Species level data on
 embryonic thermal physiology. Contains columns for `parity` mode,
 `species`, embryonic critical thermal minimum (`ctmin_e`), embryonic
 thermal optimum (`topt_e`), and embryonic critical thermal maximum
 (`ctmax_e`). All cases where information was missing are indicated with
 `NA`. 3. `ecophysiological_data.csv`: Population-level data simulated via
 ecophysiological modelling. Contains and monthly specific information on
 simulated average body temperature during gestation for both adult and
 embryo (`tg` in ^o^C), post-gestation body temperature for the adult
 (`tap` in ^o^C), post-gestation body temperature for the embryo when laid
 in the ground as an egg (`tep `in ^o^C) at different nest depths and shade
 coverage levels. All data is associated with each population's
 information (species -`species`, latitude - `lat`, longitude - `lon`,
 elevation above sea level - `elev` in the same format as in
 `adult_data.csv`) and an estimate of environmental temperature at a
 reference height of 2m under shade (`tenv` in ^o^C). Further, the columns
 `month` (1-12) indicate the month of the year for each record, `shade`
 indicates the assumed proportion of sun exposure for the nest (0-1), and
 `depth` indicates the depth of the nest in cm. 4.`model_test_data.RData`:
 Population and month specific data to test the predictive accuracy of our
 model. This data contains all information also contained on
 `adult_data.csv` and `ecophysiological_data.csv` in addition to columns to
 determine whether or not a month falls within the period of embryonic
 development for that population (`dev_check`, `0` if the month does not
 fall within the period and `1` if it does), for the values of the
 parameters `alpha` and `gamma`, and for the model's prediction
 (`opt_d`) and fitness of that strategy (`fitness`). Note that, due to the
 size of this data set, it is only available in RData format and thus can
 only be accessed using R. ## Sharing/Access information All data and code
 are made publicly available via GitHub at:
 [https://github.com/ggcostoya/viviparity-model](https://github.com/ggcostoya/viviparity-model) Data from the following sources were used in the manuscript: 1. Buckley et al. 2022: [https://datadryad.org/stash/dataset/doi:10.5061/dryad.vhhmgqnwq](https://datadryad.org/stash/dataset/doi:10.5061/dryad.vhhmgqnwq) 2. Domínguez-Guerrero et al. 2022: [https://www.nature.com/articles/s41467-022-30535-w#Sec30](https://www.nature.com/articles/s41467-022-30535-w#Sec30) 3. Meiri et al. 2023 (SquamBase): [https://datadryad.org/stash/dataset/doi:10.5061/dryad.76hdr7t3b](https://datadryad.org/stash/dataset/doi:10.5061/dryad.76hdr7t3b) 4. Pettersen et al. 2023: [https://osf.io/jt28v/](https://osf.io/jt28v/) 5. Noble et al. 2018 (Reptile development database): [https://repdevo.com/database/](https://repdevo.com/database/) ## Code/Software Within the `viviparity-model-supplementar-materials.zip`, the subfolder `scripts/` contains all R scripts used to generate data and figures in the manuscript. There are six scripts: 1. `adult_thermal_phys_life_history_traits_additional_info.R`: Combines data from Buckley et al. 2022, Domínguez-Guerrero et al. 2022 and the SquamBase (Meiri et al. 2023) to produce `adult_data.csv`. 2. `ecophysiological_modelling.R`: Uses `adult_data.csv` and `embryonic_thermal_phys.csv` to perform the ecophysiological modelling using `NicheMapR` and produce `eco_data.csv`. 3. `embryonic_thermal_physiology.R`: Combines data from Pettersen et al. 2023 the reptile development database (Noble et al. 2018) to produce `embryo_thermal_phys.csv`. 4. `fit_model_sensitivity_analysis.R`: Uses `adult_data.csv`, `eco_data.csv` and `embryonic_thermal_phys.csv` to produce `model_test_data.RData`. 5. `plot_figures.R`: Plots all manuscript and supplementary figures using `embryonic_thermal_phys.csv`, `adult_data.csv` and `model_test_data.RData`. 6. `supplementary_tables.R`: Summarizes each data set to produce all tables within the supplementary materials and runs the three models described in the methods of the manuscript. All analysis were performed using R version 4.2.2 (2022-10-31). The required packages are listed at the start of each script.