Article

# Cooperation facilitates the colonization of harsh environments

• Nature Ecology & Evolution 1, Article number: 0057 (2017)
• doi:10.1038/s41559-016-0057
Accepted:
Published online:

## Abstract

Animals living in harsh environments, where temperatures are hot and rainfall is unpredictable, are more likely to breed in cooperative groups. As a result, harsh environmental conditions have been accepted as a key factor explaining the evolution of cooperation. However, this is based on evidence that has not investigated the order of evolutionary events, so the inferred causality could be incorrect. We resolved this problem using phylogenetic analyses of 4,707 bird species and found that causation was in the opposite direction to that previously assumed. Rather than harsh environments favouring cooperation, cooperative breeding has facilitated the colonization of harsh environments. Cooperative breeding was, in fact, more likely to evolve from ancestors occupying relatively cool environmental niches with predictable rainfall, which had low levels of polyandry and hence high within-group relatedness. We also found that polyandry increased after cooperative breeders invaded harsh environments, suggesting that when helpers have limited options to breed independently, polyandry no longer destabilizes cooperation. This provides an explanation for the puzzling cases of polyandrous cooperative breeding birds. More generally, this illustrates how cooperation can play a key role in invading ecological niches, a pattern observed across all levels of biological organization from cells to animal societies.

Species breeding in cooperative groups are more commonly found living in hot and unpredictable environments (Fig. 1) 1,​2,​3,​4 . This well-documented relationship has long been taken as evidence for the intuitively satisfying idea that harsh environments favour the evolution of helping behaviour 2,​3,​4,​5,​6 . The theoretical argument is that in harsh environments individuals are better off helping others with whom they share genes, either because independent breeding is likely to fail 5,7,8 , or because helpers provide greater benefits when environmental conditions are worse 9,10 . This idea, often referred to as the ‘ecological constraints hypothesis’ 5,11 , has been supported by a number of within-species studies showing individuals are more likely to breed cooperatively when environmental factors limit independent breeding 3,4,12,​13,​14 , and that helpers provide insurance against breeding failure during poor years, which are frequent in harsh environments 9,10 .

The idea that environmental conditions drive the evolution of cooperative breeding could, however, be incorrect. An alternative explanation is that causation is in the opposite direction, with cooperative breeding allowing individuals to colonize and breed in harsher environments. Another potential explanation is that there is no causal relationship between environmental conditions and cooperative breeding, and that their association is instead explained by a third correlated variable 15 . For example, environmental conditions can influence rates of divorce and female polyandry, both of which determine within group relatedness 16,17 . Relatedness is important because cooperation is more likely to be favoured if it is directed towards relatives that share the genes for cooperation 18 , termed kin selection 19 . In this case, cooperative breeding could occur more often in harsh environments simply because the environment determines rates of female polyandry and relatedness within families, rather than environmental conditions directly selecting for helping behaviour. These competing hypotheses have remained untested because reliably reconstructing the order of evolutionary events for more than two traits simultaneously is a major challenge and requires data on the all relevant variables for a large number of species 20 .

Here we conducted an analysis across birds that allowed us to test the different competing explanations driving the relationship between cooperative breeding behaviour and environmental harshness. We collected data on the breeding system of 4,707 species, defining them as either cooperative (nspecies = 154) or noncooperative (nspecies = 4,553) breeders depending on the presence of one or more non-breeding helpers at 10% or more of nests. This excludes communal breeders (for example, purple swamphen, Porphyrio porphyrio, and greater ani, Crotophaga major) and cooperative polygamists (such as the Galapagos hawk, Buteo galapagoensis, and brown skua, Catharacta lonnbergi), where all adults in the group typically reproduce, since we are concerned with explaining cooperation where individuals forego their own reproduction. This dataset allowed us to identify the points at which transitions to and from cooperative breeding have occurred in birds. We combined these data with information on both the environmental conditions species experience (mean, variance and predictability 21 in temperature and rainfall) and levels of female polyandry (ncooperative species = 45, nnoncooperative species = 263). The environmental variables were highly correlated and so we used phylogenetic principal component analyses to create indices of environmental variation (Supplementary Table 1). The first principal component (environmental PC1) was strongly related to high mean temperature (factor loading = 0.76), low between-year variation in temperature (factor loading = −0.75), and high between-year variation in rainfall (factor loading = 0.69). For consistency with previous research, we refer to environmental PC1 as environmental harshness, where high values indicate hot environments with variable rainfall (referred to simply as ‘harsh’) and low values represent cooler environments with lower variation in rainfall (referred to as ‘benign’) 16,22 . To tease apart the causality of the relationships between environmental conditions, cooperative breeding and polyandry, we estimated phylogenetic correlations, ancestral states and transition rates between variables using a combination of three phylogenetic techniques: multi-response Bayesian phylogenetic mixed models (BPMMs), reverse-jump Markov chain Monte Carlo transition rate models (rjMCMC), and phylogenetic path analysis.

## Results

Our analyses confirm that cooperative breeding in birds is positively correlated with environmental harshness (Fig. 2 and Supplementary Table 2: BPMM phylogenetic correlation (phylo r) = 0.40, credible interval (CI) = 0.18 to 0.68, PMCMC (number of iterations when one level is greater or less than the other level divided by the total number of iterations) = 0.001) and negatively correlated with rates of polyandry (Supplementary Table 2: phylo r = −0.34, CI = −0.53 to −0.03, PMCMC = 0.01). However, there was no apparent correlation between environmental conditions and rates of polyandry (Supplementary Table 2: phylo r = 0.14, CI = −0.21 to 0.44, PMCMC = 0.22). We also found the same patterns using analyses that estimated the evolutionary transition rates between cooperative and noncooperative breeding, environmental conditions, and rates of polyandry, which indicated that cooperative breeding has coevolved with environmental conditions and rates of polyandry, but that polyandry and environmental conditions have evolved independently (rjMCMC models of correlated versus independent evolution: cooperative breeding and environment, Bayes Factor (BF) = 11.12; cooperative breeding and polyandry, BF = 2.96; environment and polyandry, BF = 0.84—where BF > 2 offers positive evidence, >5 provides strong evidence, and >10 is very strong evidence). These analyses demonstrate that the association between cooperative breeding and environmental harshness is not simply a spurious relationship driven by female polyandry.

Next we examined the likely causality of the relationship between cooperative breeding and environmental traits by reconstructing the most likely environmental niches prior to cooperation evolving, and by examining transition rates to cooperative breeding from species with different environmental niches. We found no support for the hypothesis that living in harsh environments selects for cooperative breeding. The ancestral state reconstructions indicated that the ancestors of cooperative species occupied similar environmental niches to ancestors of noncooperative species (Fig. 3 and Supplementary Table 3; BPMM: environment of ancestors of noncooperative species = 0.62, CI = −0.48 to 1.57; environment of ancestors of cooperative species = 0.58, CI = −0.85 to 1.89; difference PMCMC = 0.50). Examining transition rates, we found that the transition from noncooperative to cooperative breeding was higher in species occupying benign rather than harsh environmental niches, where benign and harsh were classified as either the <70% or >70% quartile of environmental PC1, respectively (see the Methods for an explanation and assessment of sensitivity to thresholds; Supplementary Table 4; rjMCMC: benign conditions mean ± SD = 0.02 ± 0.005; percentage of models where transition did not occur, which gives an indication of how likely the transition is to take place (Z) = 1.1%; harsh environments = 0.01 ± 0.02, Z = 44.7%). Importantly, our analyses were not hindered by an inability to reconstruct the environmental niches ancestors occupied, as there was a strong phylogenetic signature in environmental PC1, both when estimating this across all species (Supplementary Table 2; BPMM: phylogenetic heritability = 71%, CI = 51% to 84%) and when estimating this separately for cooperative and noncooperative species (Supplementary Table 5; BPMM: phylogenetic heritability for cooperative species = 68%, CI = 27 to 91%; phylogenetic heritability for noncooperative species = 84%, CI = 65 to 90%).

Although there was no support for harsh environmental conditions explaining the evolution of cooperative behaviour, we found strong support for the hypothesis that cooperative breeding facilitates the transition to living in harsh environments. The transition rate from living in benign environments to living in harsh environments was twice as high in cooperative as opposed to non­cooperative breeders (Fig. 3 and Supplementary Table 4; rjMCMC: cooperative breeders = 0.05 ± 0.03, Z = 2.7%; noncooperative species = 0.02 ± 0.01, Z = 1%). Furthermore, when we conducted a phylogenetic path analysis that tested alternative models of the relationships among cooperative breeding, environmental conditions and polyandry, we found that the best-supported model was one where transitions to cooperative breeding preceded transitions to living in harsh environments (Supplementary Fig. 1 and Supplementary Table 6; best supported model Fisher’s C statistic = 0.25, degrees of freedom (d.f.) = 2, P = 0.88). Taken together, our results strongly suggest that cooperative breeding facilitates living in harsh environments, and not that living in harsh environments favours cooperation (Fig. 3). What, then, explains the transition to cooperative breeding in birds?

Previous research on social insects 23 , mammals 24 and birds 25 has suggested that monogamy or low levels of polyandry has played a key role in the evolution of complex social behaviour. Low levels of polyandry leads to high relatedness within family groups, which increases the kin-selected benefits of helping raise family members 26 . In support of this hypothesis and consistent with previous research, we found that the ancestors of cooperative species had significantly lower levels of polyandry than those of noncooperative species (Fig. 3 and Supplementary Table 3; BPMM: noncooperative species = 0.20, CI = 0.07 to 0.55; cooperative species = 0.04, CI = 0.004 to 0.38; difference PMCMC = 0.03). Similarly to environmental PC1, ancestral levels of rates of polyandry could be estimated due to the high phylogenetic signature in this trait (Supplementary Table 2; phylogenetic heritability = 77.12%, CI = 59.52 to 87.70%).

There are, however, a number of relatively polyandrous cooperative breeders (Fig. 2). For example, 70% of nests of Australian magpies, Gymnorhina tibicen (Supplementary Table 13), and 40% of nests of western bluebirds, Sialia Mexicana (Supplementary Table 13), contain chicks fathered by males outside the social group. There are at least two, non-mutually exclusive, explanations for why cooperative breeding persists in such polyandrous species. One possibility is that cooperative breeding may evolve from polyandrous species if they live in harsh environments. That is, if harsh environments restrict the opportunities for independent breeding, then individuals may be selected to stay and help, even if the breeding female is polyandrous. Another possibility is that cooperative breeders can become more polyandrous if they live in harsh environments where it is difficult for helpers to desert and breed on their own. Although both explanations are based on similar reasoning, there is one key difference: the former hypothesis involves harsh environments facilitating the transition to cooperative breeding when species are polyandrous, whereas the latter hypothesis involves harsh environments ‘trapping’ species as cooperative breeders.

We did not find consistent support for the hypothesis that harsh environments facilitate the evolution of cooperative breeding in polyandrous species. Our transition rate analysis indicated that evolution of cooperative breeding increased from 0.00 ± 0.00 (Z = 100%) in benign environments to 0.02 ± 0.01 (Z = 4%) in harsh environments (Supplementary Table 4), suggesting that cooperative breeding can potentially evolve from polyandrous species when environmental conditions are harsh. However, if this hypothesis is true, then rates of polyandry should be positively associated with harsher environmental conditions in the ancestors of cooperative breeders. We tested this prediction by extending our BPMM models to estimate the correlation between environmental niches and rates of polyandry separately for each of the different transitions to cooperative breeding, and found no support for this prediction (Supplementary Table 7; BPMM: phylo r = −0.23, CI = −0.66 to 0.79, PMCMC = 0.49). Taken together, these results suggest that, although possible, polyandrous species living in harsh environments do not tend to evolve into cooperative breeders.

In contrast, there was clear support for the prediction that rates of polyandry increase after species have become ‘trapped’ as cooperative breeders by harsh environments. We found that transitions from monogamy to polyandry in cooperative breeders were twice as high in harsh relative to benign environments (Fig. 4 and Supplementary Table 4; rjMCMC: harsh environments = 0.05 ± 0.03, Z = 2.5%; benign environments = 0.03 ± 0.03, Z = 2%). This result was not simply due to the effect of the environment on polyandrous behaviour, as there was no difference across noncooperative species (Fig. 4 and Supplementary Table 4; rjMCMC: harsh environments = 0.05 ± 0.04, Z = 2.6%; benign environments = 0.05 ± 0.03, Z = 0%).

The result that harsh environments allow female cooperative breeders to evolve higher rates of polyandry was supported by a series of complementary analyses. We found that polyandrous cooperative breeders inhabit harsher environments than monogamous cooperative breeders, whereas the rates of polyandry in noncooperative species were similar across environments (Fig. 4 and Supplementary Table 8; BPMM, cooperation × polyandry = −0.31, CI = −0.61 to 0.05, PMCMC = 0.05). We then examined variation in the frequency of helping across cooperative species, as measured by the proportion of nests with helpers. We found that species that can cope with harsher environmental conditions had a significantly higher proportion of nests with helpers and higher rates of polyandry (Fig. 4 and Supplementary Table 8: BPMM, cooperation × polyandry = −2.37, CI = −3.40 to −1.14, PMCMC = 0.0002). Using quantile regression, which examines the effect of explanatory variables at different quantiles of the response variable, we found similar results: rates of helping behaviour and polyandry were most strongly and positively related to the upper quantiles of environmental PC1 (Fig. 4c, Supplementary Fig. 2 and Supplementary Tables 9 and 10: quantile regression, 50th percentile regression coefficient ± SE = 0.13 ± 0.17, P = 0.44, 95th percentile regression coefficient ± SE = 0.98 ± 0.40, P = 0.02; see Methods for details). This suggests that species with a higher frequency of helping can occupy the full range of environments, whereas when helping is rare, species are generally only found in benign environments (Fig. 4c). Additionally, it supports the idea that inhabiting harsh environments is associated with higher rates of polyandry (Fig. 4c). Overall, these results indicate that polyandrous cooperative breeders evolve from relatively monogamous cooperative breeders that live in harsh environments. This pattern echoes that observed with eusocial insects where polyandry evolved following the development of sterile workers, most likely because sterile workers are unable to desert and reproduce themselves 23,26 .

Within our dataset of 4,707 species, cooperative breeding has also been lost approximately 82 times (range across 10 different maximum clade credibility trees = 54 to 116). One potential explanation for these losses of cooperation is that female polyandry has increased in species that live in benign environments, causing helpers to desert and breed alone. However, there was no clear evidence to explain why cooperation breaks down, either by jointly modelling the effects of polyandry and the environment using ancestral state reconstruction analyses (Supplementary Table 11) or by estimating the transition rates from cooperative to independent breeding in harsh versus benign environments from monogamous and poly­androus ancestors (Supplementary Table 4). One potential issue is that there is only data on female polyandry for species involved in just 5 out of the 82 losses. As a result, the breakdown of cooperative breeding across birds remains enigmatic for the moment—but, from our analyses, it is clear that in order to resolve this mystery we need more data on cooperative species that are basal to noncooperative breeders, especially information on rates of polyandry and environmental niches (Supplementary Table 12).

## Discussion

Overall, our results overturn the accepted explanation for why cooperative breeding species tend to be found in harsher environments, namely that the benefits of helping are greater when environmental conditions are worse. Instead, our analyses suggest that cooperative breeding evolves from monogamous species in relatively benign environments (Fig. 2 and Fig. 5), which then enables species to colonize harsh environments (Fig. 3 and Fig. 5). More generally, our results illustrate how cooperation can influence evolution at a macro scale, by allowing species to colonize new environments. The idea that cooperation can aid pioneering into environments uninhabitable for individuals may occur at all levels of life. The formation of cooperative associations, such as biofilms, enable bacteria to survive in harsh environments and resist antibiotic attack 27 . The cooperative formation of multicellular organisms, with division of labour between cell types, has allowed exploitation of environments in numerous ways 28,29 . The evolution of sociality in insects and sponge-dwelling shrimps has allowed these diverse organisms to become keystone species in diverse habitats from jungles to oceans 1,30,31 . The acquisition of bacterial symbionts has facilitated the colonization of novel niches, from sap-feeding aphids to worms in deep-sea hydrothermal hot vents 32 . Together these results show how cooperation has played a key role in adaptive breakthroughs that have opened up new ecological niches.

## Methods

### Data collection on breeding system

All species used in the analyses are listed in Supplementary Table 13, which uses Latin names listed in the International Ornithological Congress (IOC) master list v2.3. We categorized species as cooperative or noncooperative across the phylogeny for which there was available data (Supplementary Table 13: nspecies = 4,707, of which 154 were cooperative). We collected data by starting with major review articles that have classified the breeding systems of birds 33,34 , and then subsequently checked the primary literature to determine whether species classed as cooperative met our criteria. We classed species as cooperative when at least 10% of the nests in a population had at least one sexually mature, non-breeding helper, as we are concerned with explaining why individuals give up reproductive success to help others. In the vast majority of species, these constituted retained natal offspring. We excluded species where sample sizes were not given or information was anecdotal.

Categorizing species as cooperative or noncooperative captures large differences and is analytically tractable, but inevitably misses the finer details of species characteristics. Therefore, to gain more precise information on the cooperative behaviour of species, we searched for published data on the number of nests that were provisioned by pairs versus the number of nests assisted by helpers in populations (nspecies = 43). Wherever possible, we used estimates from the same study populations as those where extra-group paternity was measured (Supplementary Table 14).

### Data collection on polyandry

We collected data on female mating behaviour from published studies (see ref. 25 for more details). Two highly correlated statistics (Pearson’s Correlation coefficient = 0.90, confidence interval = 0.88 to 0.92, n = 304, t-test = 36.55, P < 0.0001) are frequently reported in parentage studies with respect to multiple paternity: (i) the percentage of chicks fathered by extra-pair/extra-group fathers; and (ii) the percentage of broods with one or more extra-pair/group chicks. We analysed data on the percentage of broods in the population containing extra-group offspring, which we refer to as ‘polyandry’ (in previous publications we have referred to this as promiscuity 25,35 ). We chose the percentage of broods rather than the percentage of chicks with extra-group paternity as it is less susceptible to extreme values from individual nests, thereby providing a more robust estimate of population levels of female multiple mating. Moreover, we focused on extra-group paternity as we are concerned with behaviour that reduces relatedness between offspring and all individuals caring for offspring. Rates of within-group extra-pair paternity are extremely low in cooperative breeders when defined as ‘species with one or more non-breeding adults helping to raise offspring’, as helpers are typically retained natals 35 . In species without a pair bond (for example, lekking and parasitic species), we have used data on the proportion of nests containing offspring fathered by more than one male.

We compiled data on polyandry by updating the dataset published in ref. 25 to include recently published data (up to and including 15 October 2015). We searched for new studies on extra-group paternity data in birds by entering the following search terms into the Web of Science keywords search: (1) ‘extra-pair paternity OR extra pair paternity OR extra-pair fertilization OR extra pair fertilization OR extra-pair fertilization OR extra pair fertilization OR extrapair’; (2) title ‘parentage’ AND topic ‘birds’; (3) title ‘mating system’ AND ‘birds’; and (4) all references that cite the two major reviews on extra-pair paternity in birds 36,37 . For several species there were multiple studies that measured polyandry, and for these we calculated the mean value of the studies weighted by sample size for use in subsequent analyses (Supplementary Table 14). In some cases there were multiple studies presenting paternity data from the same study population over the same years. To avoid duplication, we only used information from the paper with the largest sample size.

### Data collection on the environment

For each study on paternity, we extracted the geographical coordinates and used these to extract climatic data for the population. Precipitation and temperature data were obtained from the University of East Anglia Climatic Research Unit’s Time series dataset, CRU-TS 3.21 38 . The mean and variances for each environmental parameter were computed annually and then averaged across years at each site. Predictability was measured via Colwell’s P(ref. 21 ), an index that captures among-year variation in onset, intensity and duration of periodic phenomena ranging from 0 (completely unpredictable) to 1 (fully predictable). When multiple studies were available for a given species, environmental variables were first characterized locally and then averaged across sites for the species. Where paternity was measured in multiple populations, we extracted climate data for each population and used this to calculate an average for the species.

### Phylogenetic trees

We used the complete phylogeny of birds (Nspecies = 9,993, 10,000 posterior tree samples) available at www.birdtree.org with the Hackett backbone 39 and pruned it to the 4,707 species for which we had breeding data. Out of the 308 species for which we had complete data, all but 8 were present in the genetically sequenced phylogeny available from ref. 39 .

We accounted for phylogenetic uncertainty in our analyses in two ways. First, for our Bayesian phylogenetic mixed models (BPMMs; see below for details), we used the 10,000 posterior tree samples to create 10 maximum clade credibility (MCC) consensus trees, each constructed from 1,000 different posterior samples, using Tree Annotator v2.0.3 40 . We repeated each analysis 10 times, each time with a different tree, and combined the posterior samples generated from each tree prior to parameter estimation. We used this approach for the BPMMs because at the time of analysing our data we were unaware of any techniques for resampling across a set of trees within a single analysis. Second, for our transition rate analysis using BayesTraits, it was possible to take phylogenetic uncertainty into account by resampling each iteration from a posterior distribution of 1,000 trees for the 4,707 species in our dataset, therefore negating the need to create MCC trees.

### Statistical analyses

Unless otherwise stated, all analyses were conducted in R v3.1.0 41 . All data figures were made in R.

#### Data set construction

Prior to the analyses we created an index of environmental conditions using a phylogenetic principle component analysis (PCA) from the mean, variance and Colwell’s predictability estimates of temperature and precipitation. Separate phylogenetic PCAs were run for each of the 10 MCC trees and used to create 10 datasets that were then used in subsequent analyses. All explanatory variables were Z-transformed (mean centred with standard deviation = 1) prior to analyses. Where polyandry was used as an explanatory variable, it was arcsine square root transformed before the analysis, as it is percentage data.

#### General model settings, model assessments and parameter estimation

##### Bayesian phylogenetic models

. We used the MCMCglmm package v2.20 to implement BPMMs with Markov chain Monte Carlo (MCMC) estimation 42 . We estimated the number of iterations, burn-ins and thinning intervals required for each analysis using the MCGIBBSIT package v1.1.0 43 . Each model was run for 6,000,000 iterations with a 1,000,000 burn-in and chains sampled every 1,000 iterations unless otherwise specified. We examined the convergence of models by repeating each analysis three times and examining the correspondence between chains using the ‘coda’ package version 0.16-1 44 in the following ways: (i) visually inspecting the traces of the MCMC posterior estimates and their overlap; (ii) calculating the autocorrelation and effective sample size of the posterior distribution of each chain; and (iii) using Gelman and Rubin’s convergence diagnostic test that compares within- and between-chain variance using a potential scale reduction factor (PSR) 45 . Values substantially higher than 1.1 indicate chains with poor convergence properties. The PSR was less than 1.1 for all the parameter estimates presented. We modelled the probability of cooperative breeding as a binary trait with a logit link function, environmental PC1 and PC2 as Gaussian traits, and polyandry as a binomial trait with logit link function (number of nests with extra-group chicks, number of nests without extra-group chicks).

The prior settings used for each analysis are specified in the R code in the Supplementary Information. For random effects, we began prior selection by assessing model convergence using inverse-Wishart priors (V = 1, ν = 0.002). If the mixing properties of the MCMC chain were poor, which was often the case for binary response traits, we examined two different parameter expanded priors (Fisher prior: V = 1, ν = 1, α.μ = 0, α.V = 1,000) and (χ2 prior: V = 1, ν = 1,000, α.μ = 0, α.V = 1) 46 . For binary traits, the residual variance cannot be identified and therefore we set the residual variance to 1, otherwise an inverse-Wishart prior was specified for residual variances (V = 1, ν = 0.002). For fixed effects, the default priors in MCMCglmm (independent normal priors with zero mean and large variance (1010)) were used, apart from in models with logit link functions (binary and binomial response variables). In these models we specified a fixed effect prior of μ = 0, V = σ 2 units2/3, which is approximately flat on the probability scale when using logit link functions, and improved the mixing properties of the fixed-effect chains. (μ, mean; σ, standard deviation; V, variance; ν, the degree of belief parameter; α.μ, prior mean; α.V, prior covariance matrix.)

Parameter estimates from models are reported as the posterior modes with 95% lower and upper credible intervals (CIs). P values reported testing differences between levels (for example, cooperative versus non-cooperative breeders) are the number of iterations when one level is greater or less than the other level divided by the total number of iterations. P values reported for correlations (such as environmental conditions and the probability of being a cooperative breeder) are the number of iterations where the correlation is greater or less than 0 divided by the total number of iterations.

### Specific analyses

#### Testing if cooperative breeding, environmental conditions and polyandry are correlated over evolutionary time

##### Estimating phylogenetic correlations using MCMCglmm.

We used multi-response Bayesian phylogenetic mixed models (MR-BPMM) to estimate the phylogenetic and residual correlations between the probability of cooperative breeding, environmental PC1, environmental PC2 and rates of polyandry (Supplementary Table 3). We removed the global intercept to allow trait specific intercepts to be estimated and fitted 4 × 4 unstructured phylogenetic and residual covariance matrices as random effects. Correlations between traits were calculated as covariance between traits xy/√ (variance in trait x × variance in trait y). Since cooperative breeding is a binary trait, the residual variance is not identifiable and so it was not possible to estimate the residual correlations between cooperative breeding and the other traits. We also estimated the amount of variation in each trait explained by shared ancestry between species calculated as phylogenetic heritability (phylo H2 = (phylogenetic variance/residual + phylogenetic variance) × 100) for environmental PC1, environmental PC2 and polyandry, and the intraclass correlation coefficient (phylogenetic variance/(phylogenetic variance + 1) + π2/3) for cooperative breeding—an analogous measure of the amount of variation explained by phylogenetic history appropriate for binary traits.

##### Testing models of dependent versus independent evolution using BayesTraits.

We tested if models that allowed for coevolution between the probability of cooperative breeding, environmental conditions, and polyandry better explained our data than models that assumed independent evolution of each trait using the Multistate module with reverse jump MCMC estimation implemented in BayesTraits v2 47 . We transformed environmental PC1 and polyandry into binary classifications as it is not possible to estimate transition rates using continuous variables. We choose the 30th/70th quantile boundary to split continuous variables into binary traits as this captured large biological differences between species while maintaining sample size in each combination of categories (number of cooperative species, monogamy benign = 12, monogamy harsh = 9, polyandrous benign = 12, polyandrous harsh = 12. Number of noncooperative species monogamy benign = 48, monogamy harsh = 24, polyandrous benign = 143, polyandrous harsh = 48). We examined the sensitivity of our results to different thresholds (50th/50th quantile boundary and 40th/60th quantile boundaries). The results from different thresholds were qualitatively similar supporting the same conclusions (Supplementary Table 4) and so we only presented the results from the 30th/70th quantile boundary.

We used the Multistate module in BayesTraits rather than the Discrete module, which is normally used to examine coevolutionary relationships as it only allows two traits to be modelled. We therefore coded the different combinations of the three traits as different states; for example, non-cooperative breeders living in benign environmental conditions with low rates of polyandry were classified as being in state ‘A’. This resulted in eight different states, which were used to construct a rate matrix that allowed transitions between the two states of each trait against the different backgrounds of the other traits leading to 24 different transition rates being estimated. All other possible transitions between states were restricted to 0 to prevent dual transitions (for example, where there is a state change in two or more traits). The models of independent evolution, on the other hand, estimated transitions between the two states of each trait across the different levels of the two other traits. We used Bayes Factors (2 × (log(likelihood of complex model) – log(likelihood of simple model))) to test the fit of an independent model of evolution against four alternative coevolutionary models: (i) all traits coevolve; (ii) cooperative breeding only coevolves with environmental conditions; (iii) cooperative breeding only coevolves with polyandry; and (iv) only polyandry and environmental conditions evolve (Supplementary Table 4). It is commonly concluded that Bayes factors over 2 offer positive evidence, those over 5 provides strong evidence, and those over 10 is very strong evidence 47 .

We used hyper priors where values were drawn from a uniform distribution with a range 0 to 10 to seed the mean and variance of a exponential prior to reduce uncertainty over prior selection 47 . The prior settings were chosen according to the estimated range of transition rates obtained using analyses with maximum likelihood estimation. We also examined the sensitivity of our models to prior selection by running models with gamma priors seeded using hyper priors and recovered similar results. We only present the results from the models using exponential priors as the mixing properties of the MCMC from these models were better than the other priors. We ran each model three times for a total of 6,000,000 iterations, a burn-in of 1,000,000 iterations and sampled every 5,000 iterations. Assessment of model convergence was carried out as described in the section ‘General model settings, model assessments and parameter estimation’.

##### Estimating phylogenetic heritability of environmental PC1 for cooperative and noncooperative species separately using MCMCglmm.

To accurately reconstruct the environmental conditions that the ancestors of cooperative and noncooperative species occupied, it is important that the environmental niches of cooperative and noncooperative species are equally conserved over evolutionary time. We examined this by quantifying the variation in environmental PC1 explained by phylogenetic history (phylogenetic heritability) separately for cooperative and noncooperative species using a BPMM. We fitted cooperative breeding as a fixed effect and removed the global intercept to allow separate means to be estimated for cooperative and noncooperative species. We fitted interactions between cooperative breeding and phylogenetic and residual variances as random effects using heterogeneous 2 × 2 covariance matrices where phylogenetic and residual variances are estimated separately for cooperative and noncooperative breeders and covariances are set to 0 (see R code in Supplementary Information for more details).

#### Examining the environmental conditions and levels of polyandry that preceded the evolution of cooperative breeding

##### Ancestral state reconstructions using MCMCglmm.

We examined how the environmental conditions and levels of polyandry differed between ancestors of cooperative and noncooperative breeders using a two step approach: first, we reconstructed ancestral breeding states to predict transitions between cooperative and noncooperative breeding, and second, we tested whether transitions in breeding systems differed in their estimated environmental conditions and levels of polyandry. We reconstructed ancestral breeding states using a BPMM of the probability of cooperative breeding as the response variable and a phylogenetic variance-covariance matrix fitted as a random effect. Each model was run for 11,000,000 iterations with a 1,000,000 burn-in and chains sampled every1000 iterations. For each node in the phylogeny, this model produces a posterior probability of being cooperative. We classified nodes as being cooperative if the posterior probability was >0.9 and non-cooperative if it was <0.1, otherwise nodes were considered unknown. This leads to nodes being classified in four ways: (i) noncooperative node whose descendants are all noncooperative; (ii) noncooperative node with at least one descendant that is cooperative; (iii) cooperative node whose descendants are all cooperative; and (iv) cooperative node with at least one descendent that is noncooperative.

We entered the nodal classifications as an explanatory variable (four-level fixed factor) in a multi-response BPMM with environmental PC1 and polyandry as the response traits and a phylogenetic covariance matrix linked to ancestral nodes as a random effect (Supplementary Table 3). We removed the global intercept and fitted interactions between ‘trait’ and node classification to estimate environmental conditions and polyandry preceding the origin (comparison of classifications i versus ii), maintenance (comparison of classifications i versus iii) and loss of cooperative breeding (comparison of classifications iii versus iv). To account for uncertainty in our node classifications, we repeated the analysis 100 times, each time reclassifying nodes by resampling from the posterior distribution of the probability of each node being cooperative or non-cooperative from the original model used to reconstruct ancestral states of cooperative breeding. We then combined posterior samples from across the 100 models and from across the 10 different MCC trees to calculate parameter estimates. Each model was run for 20,000 iterations with a burn-in of 10,000 iterations and thinning interval of 1,000 samples, which across the resamplings and 10 different phylogenetic trees resulted in 10,000 posterior samples (10 trees × 100 resamplings × 10 samples per resampling).

##### Ancestral state reconstructions using MCMCglmm with transition-specific covariances between traits.

The BPMM presented in the section ‘Ancestral state reconstructions using MCMCglmm’ fits a single phylogenetic covariance between environmental PC1 and polyandry that models the relationship between the environment and polyandry across all types of transitions in breeding system. As a result, it does not allow the possibility that the covariance between environmental PC1 and polyandry is different for different transitions. Theoretically, it is possible that cooperation may evolve from polyandrous ancestors when environmental conditions are harsh and independent breeding is constrained, as individuals have no other options of passing on their genes but through helping. In contrast, in benign environments it is predicted that cooperation will only evolve from monogamous ancestors because if breeding females are polyandrous then the indirect fitness benefits will be low and potential helpers will desert to breed on their own. If true, then we would expect the phylogenetic correlation between environmental conditions and polyandry to be significantly higher across the ancestors of cooperative species (nodal classification ii) than ancestors that only gave rise to noncooperative descendents (nodal classification i). We tested this idea by extending the BPMM outlined in the section ‘Ancestral state reconstructions using MCMCglmm’ to include transition specific phylogenetic variances and covariances between traits using the at.level coding in MCMCglmm (see the R code in the Supplementary Information for details). From these models we calculated whether the difference in the phylogenetic covariance between environmental PC1 and polyandry between transitions where cooperation evolved and transitions where noncooperative breeding was maintained (noncooperative ancestors to noncooperative descendents) was significantly greater than 0 (phylo COVenv PC1, polyandry at.level(Non-Coop) - phylo COVenv PC1, polyandry at.level(Non-Non): Supplementary Table 7). These models are extremely computer intensive. As a result we ran them for 25,000 iterations per tree with a burn-in of 5,000 iterations and thinning interval of 200 creating 1,000 posterior samples across the 10 different phylogenetic trees, which still resulted in all convergence criteria being met (see the section ’General model settings, model assessments and parameter estimation’).

##### Calculating evolutionary transition rates using BayesTraits.

We used the model in the section ‘Testing models of dependent versus independent evolution using BayesTraits’ that allowed coevolutionary relationships between all three traits to estimate the transition rates between states of cooperative breeding, environmental conditions and polyandry. We examined whether transitions to cooperative breeding differed according to benign and harsh environmental conditions, as well as in relation to monogamy versus polyandry. We examined the likelihood of transitions occurring by examining the proportion of models visited by the reverse jump MCMC algorithm where the rates were assigned to zero (Supplementary Table 7).

##### Testing alternative evolutionary causal models using phylogenetic path analysis.

We used phylogenetic path analysis to examine alternative models of the causal relationships between cooperative breeding, environmental PC1 and polyandry (Supplementary Fig. 1). The alternative models we compared were constructed based on the correlations revealed by analysis in the section ‘Estimating phylogenetic correlations using MCMCglmm’ and distinguish between the following possibilities: (i) variation in polyandry predicts the probability of cooperative breeding which predicts the environments species occupy; (ii) variation in the environment explains the probability of cooperative breeding that in turn determines levels of polyandry; and (iii) cooperative breeding predicts the rates of polyandry and the environment species inhabit (Supplementary Fig. 1). For these analyses, we treated the probability of being a cooperative breeder as a Gaussian rather than a binary trait, as it has been shown this results in more accurate parameter estimation (see ref. 48 for justification for treating this variable as continuous). We also did not include environment PC2 in these models because there was no evidence from the analyses in section ‘Estimating phylogenetic correlations using MCMCglmm’ that it influenced any of the other variables.

We use the methods described in ref. 49 that integrate phylogenetic generalised least squares (PGLS) models, fitted using the R package ‘Caper’ v0.5.2 50 , with the d-sep test outlined in ref. 51 to identify the model that best explained our data. In brief, a causal model is proposed that specifies how the variables are related in terms of dependent (changes in A cause changes in B) and independent (A and B are conditionally independent given variable C) effects. Each conditional independency is then tested using PGLS models to estimate the probability that the partial regression coefficient is 0 while taking into account the non-independence of data arising due to shared ancestry between species. The probabilities associated with each conditional independency can then be combined using Fisher’s C statistic, which follows a χ2 distribution with degrees of freedom equal to 2*the number of tests conducted. Furthermore, the fit of different models to the data, including non-nested models (as long as the dataset is the same for all models) can be compared using an Information Theory approach based on Fisher’s C statistic (CICc): $CICc = C + 2 q × n / ( n – q – 1 )$

where C is Fisher’s C statistic, n is the sample size and q is the number of parameters used to build models plus the number of relationships linking the parameters. If the proposed causal model fits the data then P > 0.05 for the C statistic and the model with the smallest CICc value represents the best candidate model out of the proposed set of models. For frequentist analyses such as these there is, to our knowledge, no established way of integrating results obtained across different trees to take into account phylogenetic uncertainty. We therefore repeated our analyses across the 10 MCC trees and averaged P values and regression coefficients across the 10 analyses (see ref. 20 for a discussion on averaging across phylogenetic trees).

#### Testing if cooperation and polyandry predict the environments species inhabit

##### Calculating if the invasion of harsh environments is facilitated by cooperative breeding and polyandry using BayesTraits.

We used the model in the section ‘Testing models of dependent versus independent evolution using BayesTraits’ that allowed coevolutionary relationships between all three traits to estimate the transition rates between states of cooperative breeding, environmental conditions and polyandry. We examined whether transitions to harsh environments differed between cooperative and noncooperative breeders and in relation to monogamy versus polyandry. We again examined the likelihood of transitions occurring by examining the proportion of models visited by the reverse jump MCMC algorithm where the rates were assigned to zero (Supplementary Table 4).

##### Testing if cooperative breeding and rates of polyandry predict the environments species inhabit using MCMCglmm.

We tested whether cooperative breeding and rates of polyandry were related to the environmental niches species can occupy using a BPMM with a Gaussian error distribution. We fitted environmental PC1 as the response variable, cooperative breeding (two-level factor: cooperative versus noncooperative), rates of polyandry (covariate) and clade (two-level factor: passerine versus nonpasserine) as fixed effects and a phylogenetic variance–covariance matrix as a random effect. We included all interactions among fixed effects to test whether the effect of cooperative breeding on the environments inhabited by cooperative and noncooperative species differed according to rates of polyandry and between passerines and nonpasserines. We included clade in this analysis because it has been suggested that the link between cooperative breeding and ecology is different for passerines and nonpasserines 2 .

#### Testing if the degree of cooperation (percentage of nests with helpers) across cooperative breeders predicts the environments they inhabit and how polyandrous they are

##### Tests using quantile regression.

Examining the relationship between levels of cooperation and environmental conditions is not straightforward as we expect that species with high levels of cooperation can occur in all environments, whereas less cooperative species will only inhabit more benign environments. We were therefore interested in testing whether levels of cooperation determine the upper environmental limit rather than the mean, which is typically estimated by regression analyses. As a result we used quantile regression implemented in the R package ‘quantreg’ v5.11 52 , which splits the response variable, in this case environmental PC1, into different quantiles and estimates regression coefficients for each explanatory variable for each quantile. This procedure enables the change in regression coefficients and their confidence intervals to be estimated across the whole range of a response variable (Supplementary Fig. 2). If the upper limit of the environmental PC1 species occupy depends on levels of cooperation then we expect that the relationship between environmental niche and percent of cooperative nests will increase as data are restricted to higher quantiles of percent of cooperative nests (Supplementary Fig. 2 and Supplementary Table 10). We also included polyandry and its interaction with percent of cooperative nests in our quantile regression models to examine if polyandry increases when constraints on independent breeding are expected to be greatest (species occupy the most extreme environments and are obligately cooperative).

##### Tests using MCMCglmm.

An important limitation of the currently available programs for performing quantile regression is that they do not allow modelling of phylogenetic relationships between species. We therefore verified our results from the quantile regression analysis by converting our continuous explanatory variables into categories (obligate (>90% nests have helpers) versus facultative (≤90% of nests with helpers) cooperative breeders, and monogamous (≤30% quantile of extra-group paternity) versus polyandrous (>30% quantile of extra-group paternity)) and performing a BPMM with environmental PC1 as the response variable, cooperative breeding and polyandry as two-level fixed factors and a phylogenetic variance-covariance matrix as a random effect. We once again tested if cooperative breeding allows species to occupy more extreme environments, and if this in turn relaxed constraints on female mating behaviour (because it makes independent breeding more difficult), by fitting an interaction between cooperation and polyandry.

##### Testing if increases in female polyandry in cooperative breeders are higher in harsh versus benign environments using BayesTraits.

We extracted the estimated transition rates from monogamy to polyandry for cooperative breeders in benign versus harsh environments from the model in the section ‘Testing models of dependent versus independent evolution using BayesTraits’ that allowed coevolutionary relationships between all traits. We examined the likelihood of transitions occurring by examining the proportion of models visited by the reverse jump MCMC algorithm where the rates were assigned to zero (Supplementary Table 4).

#### Testing if the breakdown of cooperation is explained by increases in polyandry when environmental conditions are benign

##### Estimating the environmental conditions and levels of polyandry in cooperative species with noncooperative descendants using MCMCglmm.

The analysis presented in the section ‘Ancestral state reconstructions using MCMCglmm’ allows environmental conditions and rates of polyandry to be compared between cooperative ancestors that only have cooperative descendants (maintenance of cooperation, nodal classification iii) and those that have noncooperative descendants (breakdown of cooperation, nodal classification iv). We found no evidence that the breakdown of cooperation was associated with differences in estimated environmental conditions or rates of polyandry (Supplementary Table 3). However, in the BPMM used in the section mentioned above, a single phylogenetic variance was fitted for each trait and only a single covariance for each trait combination (for example, environmental PC1:polyandry). This does not allow for the possibility that the covariance between traits is different between the maintenance of cooperation and the breakdown of cooperation. This is particularly important in this context because we predict that cooperation will breakdown when polyandry is high (low r) and environmental conditions are benign (low b:c). We predicted that this would be reflected in the phylogenetic covariance between polyandry and environmental PC1 being significantly more positive when cooperation is maintained (nodal classification iii) versus when cooperation is lost (nodal classification iv).

We used the models specified in the section ‘Ancestral state reconstructions using MCMCglmm with transition specific covariances between traits’ to calculate the differences in phylogenetic covariance between environmental PC1 and polyandry between transitions where cooperation was maintained and where cooperation was lost (phylo COVenv PC1, polyandry at.level(Coop-Coop) – phylo COVenv PC1, polyandry at.level(Coop-Non-coop)) (see Supplementary Table 11).

##### Estimating the rate of breakdown of cooperative breeding in relation to different environmental conditions and levels of polyandry using BayesTraits.

We examined the rates of breakdown of cooperative breeding in relation to rates of polyandry and environmental conditions using the model described in the section ‘Testing models of dependent versus independent evolution using BayesTraits’ that allowed coevolutionary relationships between all traits. We examined the likelihood of transitions occurring by examining the proportion of models visited by the reverse jump MCMC algorithm where the rates were assigned to zero (Supplementary Table 4).

### Code availability

The R code used to conduct analyses is supplied in the Supplementary Information.

### Data availability

All data generated or analysed during this study are included within the paper and in the Supplementary Information.

How to cite this article: Cornwallis, C. K. et al. Cooperation facilitates the colonization of harsh environments. Nat. Ecol. Evol. 1, 0057 (2017).

## References

1. 1.

The Insect Societies (Cambridge Univ. Press, 1971).

2. 2.

& Environmental uncertainty and the global biogeography of cooperative breeding in birds. Curr. Biol. 21, 72–78 (2011).

3. 3.

& Cooperative Breeding in Vertebrates (Cambridge Univ. Press, 2016).

4. 4.

& Temporal environmental variability drives the evolution of cooperative breeding in birds. Curr. Biol. 17, 1414–1419 (2007).

5. 5.

The evolution of helping. I. An ecological constraints model. Am. Nat. 119, 29–39 (1982).

6. 6.

& Cooperative breeding in birds: the role of ecology. Behav. Ecol. 10, 465–471 (1999).

7. 7.

& Towards a unified theory of cooperative breeding: the role of ecology and life history re-examined. Proc. R. Soc. Lond. B 267, 2411–2418 (2000).

8. 8.

& The relationship between ecology and the optimal helping strategy in cooperative breeders. J. Theor. Biol. 354, 25–34 (2014).

9. 9.

, & Helpers in colonial cooperatively breeding sociable weavers Philetairus socius contribute to buffer the effects of adverse breeding conditions. Behav. Ecol. Sociobiol. 63, 103–112 (2008).

10. 10.

Spatiotemporal environmental variation, risk aversion, and the evolution of cooperative breeding as a bet-hedging strategy. Proc. Natl Acad. Sci. USA 108, 10816–10822 (2011).

11. 11.

& Ecological constraints, life history traits and the evolution of cooperative breeding. Anim. Behav. 59, 1079–1086 (2000).

12. 12.

& Sex ratio and habitat limitation promote delayed dispersal in superb fairy-wrens. Nature 348, 541–542 (1990).

13. 13.

Importance of habitat saturation and territory quality for evolution of cooperative breeding in the Seychelles warbler. Nature 358, 493–495 (1992).

14. 14.

, & Helpers in a cooperatively breeding cichlid stay and pay or disperse and breed, depending on ecological constraints. Proc. R. Soc. Lond. B 272, 325–331 (2005).

15. 15.

& Disentangling the Correlated Evolution of Monogamy and Cooperation. Trends Ecol. Evol. 31, 503–513 (2016).

16. 16.

& Fluctuating environments, sexual selection and the evolution of flexible mate choice in birds. PLoS One 7, e32311 (2012).

17. 17.

, & Trading up: The fitness consequences of divorce in monogamous birds. Biol. Rev. 90, 1015–1034 (2015).

18. 18.

The genetical evolution of social behaviour. I & II. J. Theor. Biol. 7, 1–16 (1964).

19. 19.

Group Selection and Kin Selection. Nature 201, 1145–1147 (1964).

20. 20.

Modern Phylogenetic Comparative Methods and Their Application in Evolutionary Biology (Springer, 2014).

21. 21.

, , & Predictability, constancy, and contingency of periodic phenomena. Ecology 55, 1148–1153 (1974).

22. 22.

, , & Environmental harshness is positively correlated with intraspecific divergence in mammals and birds. Mol. Ecol. 23, 259–268 (2014).

23. 23.

, , & Ancestral monogamy shows kin selection is key to the evolution of eusociality. Science 320, 1213–1216 (2008).

24. 24.

& Cooperative breeding and monogamy in mammalian societies. Proc. R. Soc. Lond. B 279, 2151–2156 (2012).

25. 25.

, , & Promiscuity and the evolutionary transition to complex societies. Nature 466, 969–972 (2010).

26. 26.

Kin selection versus sexual selection: why the ends do not meet. Curr. Biol. 17, 673–683 (2007).

27. 27.

, & Bacterial biofilms: from the natural environment to infectious diseases. Nat. Rev. Microbiol. 2, 95–108 (2004).

28. 28.

& The Major Transitions in Evolution (Oxford Univ. Press, 1995).

29. 29.

Principles of Social Evolution (Oxford Univ. Press, 2011).

30. 30.

& Kin structure, ecology and the evolution of social organization in shrimp: a comparative analysis. Proc. R. Soc. Lond. B 277, 575–584 (2010).

31. 31.

et al. Climate-mediated cooperation promotes niche expansion in burying beetles. eLife 2014, 1–15 (2014).

32. 32.

One Plus One Equals One: Symbiosis and the Evolution of Complex Life (Oxford Univ. Press, 2014).

33. 33.

Prevalence of different modes of parental care in birds. Proc. R. Soc. Lond. B 273, 1375–1383 (2006).

34. 34.

Evolutionary routes to non-kin cooperative breeding in birds. Proc. R. Soc. Lond. B 280, 1830–1833 (2013).

35. 35.

, , & Sex. long life and the evolutionary transition to cooperative breeding in birds. Proc. R. Soc. Lond. B 282, 1–7 (2015).

36. 36.

, & Extra pair paternity in birds: a review of interspecific variation and adaptive function. Mol. Ecol. 11, 2195–2212 (2002).

37. 37.

& Extrapair paternity, migration, and breeding synchrony in birds. Behav. Ecol. 15, 41–57 (2004).

38. 38.

, , & Updated high-resolution grids of monthly climatic observations – the CRU TS3.10 Dataset. Int. J. Climatol. 34, 623–642 (2014).

39. 39.

, , , & The global diversity of birds in space and time. Nature 491, 444–448 (2012).

40. 40.

, , & Bayesian phylogenetics with BEAUti and the BEAST 1.7. Mol. Biol. Evol. 29, 1969–1973 (2012).

41. 41.

R Development Core Team R: A Language and Environment for Statistical Computing (R Foundation for Statistical Computing, 2015).

42. 42.

MCMC methods for multi-response generalized linear mixed models: the MCMCglmm R package. J. Stat. Softw. 33, 1–22 (2010).

43. 43.

& Warnes and Raftery’s MCGibbsit MCMC diagnostic (2013);

44. 44.

, , & CODA: convergence diagnosis and output analysis for MCMC. R News 6, 7–11 (2006).

45. 45.

& Inference from iterative simulation using multiple sequences. Stat. Sci. 7, 457–511 (1992).

46. 46.

, & Comparing parent-offspring regression with frequentist and Bayesian animal models to estimate heritability in wild populations: a simulation study for Gaussian and binary traits. Methods Ecol. Evol. 4, 260–275 (2013).

47. 47.

& Bayesian analysis of correlated evolution of discrete characters by reversible-jump Markov chain Monte Carlo. Am. Nat. 167, 808–825 (2006).

48. 48.

& in Modern Phylogenetic Comparative Methods and Their Application in Evolutionary Biology (ed. Garamszegi, L. Z. ) 231–262 (Springer, 2014).

49. 49.

& Disentangling evolutionary cause-effect relationships with phylogenetic confirmatory path analysis. Evolution 67, 378–387 (2013).

50. 50.

et al. CAPER: Comparative Analyses of Phylogenetics and Evolution in R. Methods Ecol. Evol. 3, 145–151 (2012).

51. 51.

Cause and Correlation in Biology: A User’s Guide to Path Analysis, Structural Equations and Causal Inference (Cambridge Univ. Press 2002).

52. 52.

Quantile Regression in R: a Vignette (2015);

## Acknowledgements

We thank the Swedish Research Council (VR), the Knut and Alice Wallenberg foundation, the Royal Society, the US National Science Foundation (IOS-1121435, IOS-1257530 and IOS-1439985) and the European Research Council for funding, and S.-F. Shen for comments.

## Affiliations

1. ### Department of Biology, Lund University, SE-223 62 Lund, Sweden

• Charlie K. Cornwallis
2. ### Department of Biology, Washington University, St Louis, Missouri 63130-4899, USA

• Carlos A. Botero
3. ### Department of Ecology, Evolution and Environmental Biology and Center for Integrative Animal Behavior, Columbia University, New York 10027, USA

• Dustin R. Rubenstein
4. ### Department of Zoology, University of Oxford, South Parks Road, Oxford OX1 3PS, UK

• Philip A. Downing
• , Stuart A. West
•  & Ashleigh S. Griffin

## Authors

### Contributions

C.K.C., S.A., D.R.R. and A.S.G. conceived the study, C.K.C. analysed the data, C.A.B. and P.D. contributed materials, and all authors contributed substantially to writing the paper.

### Competing interests

The authors declare no competing financial interests.

## Corresponding author

Correspondence to Charlie K. Cornwallis.

## PDF files

1. 1.

### Supplementary Information

Supplementary Figures 1, 2

## Text files

1. 1.

### Supplementary Code

Supplementary R code

## Excel files

1. 1.

### Supplementary Tables

Supplementary Tables 1–14