DOI: 10.5061/dryad.sbcc2frk8
title: Data from: It is better to be choosy in small populations: Drift promotes the evolution of weak female preference for rare phenotypes

description: Evidence from lab and field studies suggests that females sometimes prefer
 males bearing rare phenotypes. Such a finding poses a theoretical
 challenge because preference for a rare phenotype makes that phenotype
 less rare, thereby lowering the fitness of sons bearing it. Further, a
 preference for rarity creates negative frequency-dependent selection,
 which leads to equal representation of male types. This then eliminates
 any benefit to a preference for rarity. It seems paradoxical, then, that
 preference for rarity has been observed across so many taxa. Genetic
 drift, by promoting stochastic fixation or loss of alleles, is a source of
 constant rarity. Here, we ask whether finite population sizes might
 provide the necessary conditions that favour a preference for rarity.
 Indeed, we find that drift, by constantly perturbing male display allele
 frequencies, provides the fuel required to favour a choosy female
 preference allele. Once this preference allele spreads, resultant negative
 frequency-dependent selection at the male display locus can act to
 maintain diversity in male display ornaments. Thus, drift plays an
 atypical role by helping maintain diversity. Further, we show that this
 finding is stronger in multi-patch landscapes. This work provides a novel
 potential explanation for the repeated evolution of female preference for
 rarity.
description: # Data from: It is better to be choosy in small populations: Drift
 promotes the evolution of weak female preference for rare phenotypes
 Dataset DOI: [10.5061/dryad.sbcc2frk8](10.5061/dryad.sbcc2frk8) ##
 Description of the data and file structure Here, we provide a summary of
 the files containing the model code for the manuscript: It’s better to be
 choosy in small populations: drift promotes the evolution of weak female
 preference for rare phenotypes. We provide a set of scripts that will
 allow a user to run a single iteration of our model and then plot both
 display and preference allele frequencies through time. We also provide
 the scripts we used to generate and summarize batches of model runs, as
 well as those that produce the figures presented in the manuscript. We do
 not provide a step by step overview for how to use these latter files, as
 they are relatively self-explanatory. Further questions can be directed to
 corresponding author: Leithen M’Gonigle at lmgonigl@sfu.ca. ### Files and
 variables #### File: model_code.zip **Description:** A set of scripts that
 will allow a user to run a single iteration of our model and then plot
 both display and preference allele frequencies through time. . We do not
 provide a step by step overview for how to use these latter files, as they
 are relatively self-explanatory. Further questions can be directed to
 corresponding author, Leithen M'Gonigle. `single_run.R` contains code
 to run a single iteration of the model and then plot the allele
 frequencies at both loci through time (we used this script to generate the
 model runs shown in Fig. 2). This file will need to source two other
 scripts which, for convenience, we keep in a folder named `src`. These two
 scripts are 1) `prms.R` which sets up our basic model parameters and
 constructs some useful objects such as a recombination matrix and 2)
 `population.R` which contains all of the biology. In this script, the
 function `next.gen` iterates a single generation of our model and
 `single_run` runs the model for multiple generations, storing the output.
 Within `single_run.R`, one must first call the `base.prms` function (found
 in `prms.R`), specifying desired parameter values. If left unspecified, a
 parameter will take a default value, as specified in `prms.R`. Simulation
 parameters are described in the below table. | Name | Description | Name
 in main text | | :------------- |
 :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------- | | `mating.model` | The model of sexual selection (`frp` for fixed relative preference and `best.of.n` for best-of-*N*). | NA | | `n.d.alleles` | Initial number of display alleles. | NA | | `print.every` | Time interval to print updates to console. | NA | | `n.patch` | Number of patches (multi-patch scenario only). | *M* | | `n.males` | Population size at the display locus. Set to -1 for infinite. | *N\_D* | | `n.females` | Population size at the preference locus. Set to -1 for infinite. Note that this locus is referred to as the *C*-locus in the model code but the *P*-locus in the manuscript text. | *N\_P* | | `m` | Dispersal probability (multi-patch scenario only). | *m* | | `beta` | Probability of mating according to preference (this option is only implemented for fixed relative preference). | \beta | | `k` | Lek size (best-of-*N* scenario only). | *k* | | `s` | A vector of length two containing a preference strength for each of the two preference alleles. | s\_x | | `r` | Recombination rate. | *r* | #### File: batch_model_runs.zip **Description:** Scripts we used to generate and summarize batches of model runs. `evolution.R` and `evolution_compile_saved.R` run and compile simulation runs for Figs. 3, 4, 6, 7, 8, S2, S3, S4, S6. `num_crosses.R` runs and compiles model runs for Figs.5 and S5. `single_run_replicates.R` runs and compiles model runs for Fig. S1.  ``` plotting.R:Contains two useful functions used throughout our plots (one to write directly to PDF and one to make a colour transparent). ``` #### File: figure_code.zip **Description:** Scripts that produce the figures presented in the manuscipt. | Figure | Script | | :------ | :------------------------------ | | Fig. 2 | single\_run\_two\_panel.R | | Fig. 3 | vary\_s\_freq\_C\_two\_panel.R1 | | Fig. 4 | finite\_males.pdf | | Fig. 5 | num\_crosses\_fig.R | | Fig. 6 | vary\_s\_freq\_C\_one\_panel.R | | Fig. 7 | recombination.R | | Fig. 8 | vary\_s\_freq\_C\_three\_panel. | | Fig. S1 | quantifying\_drift.R | | Fig. S2 | vary\_s\_freq\_C\_six\_panel.R | | Fig. S3 | finite\_females.R | | Fig. S4 | finite\_males\_beta.R | | Fig. S5 | num\_crosses\_fig.R | | Fig. S6 | finite\_males\_best\_of\_N.R | ## Code/software All of our model code can be run in base R.