Skip to main content

R script: Species coexist more easily if reinforcement is based on habitat preferences than on species recognition

Cite this dataset

Kyogoku, Daisuke; Kokko, Hanna (2020). R script: Species coexist more easily if reinforcement is based on habitat preferences than on species recognition [Dataset]. Dryad.


1. Maladaptive hybridization selects for prezygotic isolation, a process known as reinforcement. Reinforcement reduces gene flow and contributes to the final stage of speciation. Ecologically, however, coexistence of the incipient species is difficult if they initially use identical resources.

2. Habitat segregation offers an alternative to species discrimination as a way to reduce gene flow: production of unfit hybrids is reduced if mate encounters become rare due to differing habitat choice. Using a modelling approach, we show that hybridization avoidance alone can select for habitat specialization, even if neither of the species is intrinsically better at using a specific niche.

3. While habitat segregation and species discrimination both reduce the risk of producing unfit hybrids, these two isolation mechanisms differ from each other with respect to their effects on resource competition. Our model shows that, as a consequence of such differences, reinforcement evolves much more easily if hybridization is avoided based on habitat segregation than if the mechanism involves species recognition (mate choice traits).

4. We also examine the outcomes when both isolation mechanisms evolve jointly. The establishment of one isolation mechanism a priori weakens selection for the other. However, an asymmetry persists here too. The net effect of habitat segregation on species discrimination was typically facilitative, but not vice versa. This asymmetry arises because habitat segregation, by enhancing coexistence, secures time for the subsequent evolution of species discrimination in a mate choice context (still relevant if habitat use is not perfectly segregated). Species discrimination does not have such a stabilizing effect on coexistence.

5. Our results emphasize the importance of habitat segregation in reinforcement, and offer a way to interpret findings where closely related taxa show similar performance on different resources or in different habitats. Studies of ecological generalization and specialization should therefore take into account that niche differences can be initiated and/or maintained by hybridization avoidance.


An R script for individual based simulation models of reinforcement. There can be two incipient species. Maladaptive hybridization can occur between them. Either species recognition (based on male signal and female mate preference) or habitat segregation (based on habitat preference) or both can evolve. Demographic dynamics is also explicitly modelled. The two parental species (and matured hybrids) are ecologically identical.

Usage notes

Simulation runs for the publication were made using Windows computers. The simulation with the default settings (preferences [habitat.pref, mate.pref.1, mate.pref.2] ranged from 1, 2, 4, 8, ..., 1024, and hybrid survival [s.hybrid] ranged from 0.00, 0.05, 0.10, 0.15, ..., 0.95, and each parameter combination replicated for 100 times) takes a few days with 64-cored computeres. When you try this code with fewer CPUs, you are advised to start with smaller replications and fewer parameter combinations.


Japan Society for the Promotion of Science, Award: 16J03061, 19K16222