DOI: 10.5061/dryad.zgmsbccjj
title: Data from: How density dependence, genetic erosion, and the extinction vortex impact evolutionary rescue

description: Following severe environmental change that reduces mean population fitness
 below replacement, populations must adapt to avoid eventual extinction, a
 process called evolutionary rescue. Models of evolutionary rescue
 demonstrate that initial size, genetic variation, and degree of
 maladaptation influence population fates. However, many models feature
 populations that grow without negative density dependence or with constant
 genetic diversity despite precipitous population decline, assumptions
 likely to be violated in conservation settings. We examined the
 simultaneous influences of density-dependent growth and erosion of genetic
 diversity on populations adapting to novel environmental change using
 stochastic, individual-based simulations. Density dependence decreased the
 probability of rescue and increased the probability of extinction,
 especially in large and initially well-adapted populations that previously
 have been predicted to be at low risk. Increased extinction occurred
 shortly following environmental change, as populations under density
 dependence experienced more rapid decline and reached smaller sizes.
 Populations that experienced evolutionary rescue lost genetic diversity
 through drift and adaptation, particularly under density dependence.
 Populations that declined to extinction entered an extinction vortex,
 where small size increased drift, loss of genetic diversity, and the
 fixation of maladaptive alleles, hindered adaptation, and kept populations
 at small densities where they were vulnerable to extinction via
 demographic stochasticity.
description: Data enclosed is generated from individual-based stochastic
 simulation; code to generate and analyze this data is included with the
 repository.
description: # How density dependence, genetic erosion, and the extinction vortex
 impact evolutionary rescue
 [https://doi.org/10.5061/dryad.zgmsbccjj](https://doi.org/10.5061/dryad.zgmsbccjj) Simulation code and data from the simulated experiment in the manuscript "How density dependence, genetic erosion, and the extinction vortex impact evolutionary rescue." Data is in `.csv` format and code is in `.R` format. ## Description of the data and file structure There are two main types of `.csv`s with results for main text and a third type `.csv` for the robustness analysis. These files are described below: #### `alldata_n{20/100}_a{000/035}_{hi/low}var.csv` These files are the "main" batch of simulations with all relevant variables recorded. There are 4000 per parameter combination. All trials were run for up to 15 timesteps. The name implies the treatment: initial size (`n`) 20 or 100, alpha (`a`) 0 or 0.0035, and genetic variation (`var`) high or low. Columns: * `trial` trial number (replicate) 1 through 4000 within that treatment * `gen` generation (time step); here presented as 1-16 because the initial generation is recorded as `1`; our analysis makes the processing step of subtracting 1 from the `gen` column such that populations are initialized at step zero and simulations run until at most time step 15 * `n` population size at that time step * `gbar` mean genotype in the population * `zbar` mean phenotype in the population * `wbar` mean intrinsic fitness within the population * `pfem` proportion of the population that is female * `p.fix.pos` proportion of loci that are at fixation for the positive allele * `p.fix.neg` proportion of loci that are at fixation for the negative allele * `v` additive genetic variance within the population * `n.pop0` initial size treatment (20/100) * `alpha` density dependence parameter (0/0.0035) * `low.var` boolean for if the population is in the low genetic variance treatment * `ext.gen` the generation at which the population went extinct; populations that did not go extinct have value `15` here * `extinct` boolean for if the population went extinct during the simulation or not Note that in this data file, data for a trial is truncated at extinction. That is, the time step in which they went extinct (went to size zero) is not included, and neither are time steps after that. For analysis that treated extinct populations as size zero, we added this data to the data frame. #### `longsim_n{20/100}_a{000/035}_{hi/low}var.csv` The "long" simulations lasting up to 50 generations. There are 1000 simulated trials per treatment here. Naming conventions are the same here as for the main simulation output described above. The fields are the same as above, but without the columns `ext.gen` and `extinct`. #### `{variable}_robust_check.csv` Output data for the robustness checks. One file for each of the six variables tested (`sig2e`, `theta`, `w_max`, `wfitn`, `nloci`, and `bholt` \- the final of these, `bholt` is the Beverton-Holt density dependence). Each file contains the eight-treatment simulated experiment, run at several levels of the specified variables. Fields: * `gen` generation/time step (as specified above) * `n` population size * `alpha` density dependence parameter (0/0.0035) * `n.pop0` initial size treatment (20/100) * `low.var` boolean for if the population is in the low genetic variance treatment * `trial` trial number - note that unlike in the `alldata` scripts, the `trial` is *not* repeated across treatments here * `sig.e` (file `sig2e_robust_check.csv` only) standard deviation of environmental contribution to phenotypic variance in the trial * `theta` (files `theta_robust_check.csv` and `w_max_robust_check.csv` only) value of environmental change used in the trial * `w.max` (file `w_max_robust_check.csv` only) value of w\_max (W\_{max} in the manuscript) (maximum intrinsic fitness) used in the trial * `wfitn` (file `wfitn_robust_check.csv` only) value of `wfitn` (w in manuscript), the variable quantifying the width of the selection surface used in the trial * `n.loci` (file `nloci_robust_check.csv` only) value of number of loci (m in manuscript) used in the trial * `delta` (file `bholt_robust_check.csv` only) value of delta, the degree of overcompensation used in the trial * `beta` (file `bholt_robust_check.csv` only) value of beta, measuring strength of density dependence in Beverton-Holt model (see Supporting Information) used in the trial ## Code/Software All simulations were run in `R` version 4.1.2. Simulations and analysis use the packages `dplyr` (v. 1.0.7), `tidyr` (1.1.3), and analysis additonally uses `rstanarm` (v. 2.21.2) for the Bayesian modeling. Plots are generated with `ggplot2` (v. 3.3.4) and `cowplot` (v. 1.1.1) . The robustness analysis was run with the package `parallel` (v. 4.1.2) but can be run in serial with modification to the code (changing `mclapply` to `lapply`). Each of the `.csv` files above is generated by a single R script. Each script begins by sourcing a file (`sim_functions.R`) with wrapper functions for implementing the simulations. The scripts then generate a mesh of parameter combinations for the simulations, runs a large batch of simulations, and then aggregates the output into a summary data frame for exporting. The files take the following forms: * The main batch of simulations (starting with `alldata_`) are run by the files `sim_alldata_n{20/100}_a{000/035}_{hi/low}var.R` * The batch of longer (up to 50 generation) simulations are run by the files `longsim_n{20/100}_a{000/035}_{hi/low}var.R` * The robustness checks are run by the files `robust_check_{varname}.R` ## Sharing/Access information All associated data and code can also be found on GitHub at the following address: [https://github.com/melbourne-lab/evo_rescue_ndd_erosion](https://github.com/melbourne-lab/evo_rescue_ndd_erosion). The files for analyzing this data are also stored here. ## Contact information Scott Nordstrom (scottwatsonnordstrom@gmail.com)