
==== Front
Sci Rep
Sci Rep
Scientific Reports
2045-2322
Nature Publishing Group UK London

39294211
72405
10.1038/s41598-024-72405-z
Article
Species interactions drive continuous assembly of freshwater communities in stochastic environments
Tabi Andrea a.tabi@uva.nl

123
Siqueira Tadeu 2
Tonkin Jonathan D. 23
1 https://ror.org/04dkp9463 grid.7177.6 0000 0000 8499 2262 Computational Science Lab, Informatics Institute, University of Amsterdam, Amsterdam, The Netherlands
2 https://ror.org/03y7q9t39 grid.21006.35 0000 0001 2179 4063 School of Biological Sciences, University of Canterbury, Christchurch, New Zealand
3 https://ror.org/00wtgbr91 0000 0005 0272 9142 Te Pūnaha Matatini, Centre of Research Excellence in Complex Systems, Auckland, New Zealand
18 9 2024
18 9 2024
2024
14 2174713 3 2024
6 9 2024
© The Author(s) 2024
2024
https://creativecommons.org/licenses/by-nc-nd/4.0/ Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
Understanding the factors driving the maintenance of long-term biodiversity in changing environments is essential for improving restoration and sustainability strategies in the face of global environmental change. Biodiversity is shaped by both niche and stochastic processes, however the strength of deterministic processes in unpredictable environmental regimes is highly debated. Since communities continuously change over time and space—species persist, disappear or (re)appear—understanding the drivers of species gains and losses from communities should inform us about whether niche or stochastic processes dominate community dynamics. Applying a nonparametric causal discovery approach to a 30-year time series containing annual abundances of benthic invertebrates across 66 locations in New Zealand rivers, we found a strong negative causal relationship between species gains and losses directly driven by predation indicating that niche processes dominate community dynamics. Despite the unpredictable nature of these system, environmental noise was only indirectly related to species gains and losses through altering life history trait distribution. Using a stochastic birth-death framework, we demonstrate that the negative relationship between species gains and losses can not emerge without strong niche processes. Our results showed that even in systems that are dominated by unpredictable environmental variability, species interactions drive continuous community assembly.

Keywords

Biodiversity maintenance
Causal inference
Body size scaling
Stochastic modeling
Community assembly
Subject terms

Ecology
Systems biology
Royal Society Te AparangiRDF-18-UOC-007 Tonkin Jonathan D. issue-copyright-statement© Springer Nature Limited 2024
==== Body
pmcIntroduction

Understanding the mechanisms underlying the long-term maintenance of biodiversity is essential for improving conservation efforts and preventing further biodiversity loss1,2. Ecological communities change over time and through space as a function of numerous internal and external processes3. In this continuous assembly process some species persist while others disappear (species losses) and (re)appear (species gains) over time4,5 while maintaining local diversity. Various internal and external factors shape community assembly, therefore observing compositional changes over time might shed light on what factors drive assembly processes as well as how biodiversity is maintained in the face of environmental change5.

The combination of two major mechanisms can lead to continuous community assembly; dispersal-assembly, whereby stochastic processes such as dispersal, random birth and death events dominate6, and selection- or niche-based assembly7, whereby species interactions drive community assembly. Ecological communities are on the spectrum between niche-based and dispersal-based regimes, where their relative positions according to analytic arguments depend on population sizes and the variability of the environment8. Under highly stochastic environmental conditions, such as in river ecosystems driven by cycles of flood and drought disturbances, community assembly is often assumed to be dominated by external factors such as hydrologic variability that override biotic control of communities9,10. However, empirical evidence suggests that species interactions in stream communities, such as competition, predation and herbivory, exert important effects on population and community dynamics11–13. Species traits such as average body size, voltinism and feeding habits (e.g. predation) have been extensively shown to influence the dynamics of benthic communities14. In particular, benthic predators often influence the evolution of prey trait distributions. Predatory effects include increase in prey body size and change in body shape, increase in movement speed15,16, or change in voltinism such that prey species grow more slowly in the presence of predators17.

In order to empirically detect the driving force of ecological communities, we investigate the temporal relationship between species (re)appearances (gains) and disappearances (losses) in the community. Community assembly driven primarily by stochastic processes should render species gains and losses independent, uncorrelated events. However, it is possible that the same external factors drive local population disappearances or (re)appearances, potentially leading to correlated gain-loss processes—also known as the confounding effect18. By contrast, niche-based assembly theory asserts that species diversity arises from ecological selection (i.e. partially or non-overlapping niches). Species fitness differences and interactions are the main drivers of assembly that hypothetically might lead to not only correlated but causally-related species gain-loss events19. To test this cause-effect relationship, we use time-series data of benthic invertebrate communities from 66 locations across New Zealand recorded between 1990 and 2019 (Fig 1a). River flow regimes are a dominant external force in regulating stream biodiversity20–22. Therefore, we couple these community data with continuously monitored river flow data and species traits to generate causal linkages. Due to its maritime climate, New Zealand running waters are highly unpredictable and aseasonal relative to continental systems23,24. First, we establish our causal hypothesis for how species gains and losses are related and how external processes, in the form of highly dynamic river flow regimes, regulate this connection. To discover these causal hypotheses, we employed a nonparametric causal discovery approach based on conditional independence testing18,25. Since observational data are often confounded, they fail to establish cause-effect relationships. In this line, causal inference tools have been developed that allow us to infer causation from observational data18,25. Then, based on the discovered causal links we use a stochastic dynamic model combined with scaling theory26 to theoretically investigate what processes can potentially generate the observed cause-effect relationship between species gains and losses.

Results

Empirical results and causal hypothesis

Despite the highly unpredictable river flow regimes observed in these systems, we found clear evidence of deterministic forces structuring the benthic macroinvertebrate communities. The signal-to-noise ratio of river flow indicates that macroinvertebrate communities experience a highly stochastic environment in most rivers (Fig 1b,c). However, benthic communities showed relatively stable biodiversity patterns over time (Fig 2a–c)—we found that relative species richness increased only slightly, while species evenness and species turnover remained constant during the entire time period.

Species gains and losses—defined as the relative number of species gained and lost from one time period to the next27,28—showed strong negative associations and high mutual dependence in all locations (Fig 2d, e). However, to gain cause-effect knowledge about the relationship between species gains and losses that could potentially point towards the importance of species interactions, a context must first be established. Specifically, we assume that this context incorporates stochastic processes such as environmental noise and dispersal along with other species traits that potentially affect species gains and losses in relation to assembly processes. Because species traits are naturally not independent of each other, but rather inter-related, graphical models are needed to establish causal relationships and accurately estimate effect sizes. This graphical model—also called as a causal hypothesis—can be constructed using expert knowledge or intuition or by means of causal discovery algorithms18. Here we applied a causal discovery algorithm29 on concatenated time series of each variable from all sampling sites in order to obtain a reliable average estimate of each causal link. Environmental noise was calculated from river flow data30 and species traits were measured as the community weighted mean (CWM) of body size, voltinism, dispersal, and predation (for details see Methods). The direct structural causal effects between two variables were quantified as partial Spearman’s correlation coefficients18. The causal analysis indicated that species gains and losses are causally related, describing a fluctuating behavior (Fig. 3), which was partly driven by predation. The removal of predation from the causal analysis disconnects gains and losses from the rest of the graph, which indicates that predation is the only community trait directly connected to gain-loss cycles. Body size was strongly connected to all other species traits with similar effect sizes confirming its importance of body size in structuring communities. As expected, predation and dispersal affected body size distributions in opposite directions; predation led to larger average body sizes, while better dispersal abilities caused smaller average body sizes in the community. In turn, larger-bodied communities resulted in longer average generation time. Surprisingly, environmental noise from river flow was not directly related to species gains and losses, but slightly increased the average generation time in the community. We also tested the role of environmental noise in a causal model including species turnover (the sum of species gains and losses) to complement our analysis. The analysis showed no causal link between environmental noise and any other variable (Supporting Information Fig S6).

Theoretical results

Based on the findings of the causal inference analysis, we can now establish a simple theoretical investigation in order to determine how the observed patterns between species gains and losses were generated given the relative strength of biotic interactions and stochastic processes. We generated synthetic communities combining a stochastic dynamic model with metabolic scaling theory26,31. Specifically, we defined stochastic population dynamics as a birth-death process, where new individuals are gained by B(ni)=qi+ni·λi·(1-ni/Ki), where qi is density-independent immigration rate and λi is the intrinsic growth rate. Species lose individuals as D(ni)=di·ni+ni·Σ(aij·nj/Ki), where di is death rate, Ki is the carrying capacity and aij is the interaction coefficient including competitive and predator-prey interactions (see Methods for details). First, we randomly generated interaction matrices, where predation and competition coefficients were determined based on body size scaling32,33. Second, dispersal processes were mimicked by the immigration rate (qi), which was set according to the discovered relationship between body size and dispersal in the causal analysis. The intrinsic growth rates (λi=Gi-1, G generation time) were also set according to the discovered relationship between size and voltinism. Based on our empirical analysis, environmental noise affected only voltinism, which was incorporated as external noise (σi) added to the intrinsic growth rates (λi) at each time step. All other parameters including immigration rate, death rate, carrying capacity and interaction coefficients were kept constant in the model (see Methods and Fig S5). Then, each community was sampled over 30 times by equal intervals under different levels of average interaction strengths, μ={0,0.1,0.5,1,1.5}, defined as the mean value of all interspecific interaction coefficients. Note that interaction matrices contain both positive and negative coefficients and pairwise interactions are asymmetric. The carrying capacity (Ki) was also scaled with body size and we assumed the same death rate (di) for each species stemming from external sources such as flooding. All community started from a regional species pool with 55 species that is median value of empirical observations (Fig S4). The theoretical analysis confirmed that the observed empirical patterns are driven by strong species interactions. When the average interaction strengths are higher, the relationship between species gain and losses are stronger compared to very low level of interspecific interactions (Fig 4a, b). Relative richness, evenness and turnover approached the observed values when interactions were stronger (Fig 4c, d). Stochasticity alone, i.e. where the average interactions strength is zero, leads to the correlation between species gains and losses approaching zero as well as to high relative richness, highly-even species distributions with low species turnover. As expected, imposing stronger interactions reduces local species richness and species evenness and increases species turnover moving all metrics closer to the observed values.

Discussion

Both empirical and theoretical findings suggest that species gains and losses are causally-related driven by strong biotic interactions in these stochastic environments. Species gains and losses empirically showed negative association, similarly to previous observations28,34. The relationship between species gains and losses is the product of the combination of interaction structure and stochastic processes, whereby a small fraction of species persisted over time, another fraction of species had an intermediate temporal presence and the remainder species rarely appeared potentially resulting from stochastic processes and weak competitive abilities. Our theoretical predictions based on body size scaling relationships also supported that biotic interactions are needed to reconstruct the observed fluctuating relationship between species gains and losses. The role of biotic interactions in the dynamics of river ecosystems have been long debated because of the strong external forcing from cycles of floods and droughts9,10 and are therefore deemed to be highly-context dependent14. For instance, while previous work found that flow variability breaks down competitive hierarchies11 and predator–prey interactions35, benthic predators have been suggested to have cascading effects on altering prey abundance, size or age structure, behavior, and morphology14. Our causal inference analysis identified predatory effects to be partly responsible for the observed continuous community assembly reflected by species gains and losses. Second, the synthetic analysis strongly supported the role of predator-prey and competitive interactions shaping community dynamics closely matching the empirical observations.

We showed that environmental stochasticity affects the number of generations per year (voltinism), i.e. communities under higher environmental noise comprised more species with longer generation time. However, more precise information on changes in voltinism in low and high environmental noise requires further investigation with measured species trait distributions. We observed a limited effect of environmental noise on the communities in these dynamic rivers. This weak influence is expected in living systems due to species adapting to the fluctuation structure of their environment (e.g. variances and correlations) given that it remains constant over evolutionary timescales36. In our case, the highly autocorrelated noise with relatively small or in some cases nonexistent characteristic signal present in stream flow measurements (Fig. 1b) suggests that species will have developed adaptive strategies such as bet hedging37. For instance, most predatory species in our analysis were also generalists suggesting an adaptive feeding behavior to a constantly-changing environment. Due to its maritime climate and unpredictable flow regimes, New Zealand stream communities are a case in point of such adaptation, being highly generalist and opportunistic23.

Our synthetic analysis generated predictions tightly coupled to the observed metrics. As expected, increasing internal constraints reduced the number of species present from the regional pool and reduced evenness due to stronger predation and competitive exclusion within the communities. The presence of internal structure led some species to persist and some species to disappear and reappear according to stochastic events, which creates the observed fluctuations of species gains and losses. When species weakly interact, more species were included in the local communities from the regional species pool leading to highly even species distributions and low species turnover, which rendered species disappearances and (re)appearances independent events confirming previous expectations19. The synthetic analysis also revealed that the discovered causal relationships among species traits in stochastic model communities can be utilized to closely reproduce observed biodiversity patterns, without directly inferring species interactions coefficients from empirical data. In our theoretical investigation, we assumed that biological rates and interactions vary as a function of species body sizes. Body size, as a master trait, is known to scale with other species traits such as dispersal ability38, predation39, and voltinism40. Here we empirically demonstrated that body size not only correlates with, but is causally-related to other species traits and biological processes in stream communities. Predation and dispersal changed body size distribution in benthic communities corroborating previous observations15,38. The increase in average body sizes can be explained by size-selective predation of smaller-bodied prey species. Therefore, we assumed that macroinvertebrate communities are size-structured and likely governed primarily by predator-prey and competitive interactions, however, other interactions types such as facilitation might have an important role in macroinvertebrate communities41. For instance, aggregation, a form of facilitation, reduces the individual risk of predation and can benefit individuals by recycling each other’s byproducts42. Nevertheless, the causal association between predators and gains and losses, and the lack of any other direct association, indicates a dominant role of antagonistic interactions in structuring these communities.

In this work, we showed that species occurrence information allow the detection of mechanisms driving community dynamics by combining causal inference analysis with theoretical models. Following a causal discovery approach, we identified causal links between species traits, environmental noise and internal processes. Then, we used the information obtained from causal discovery to calibrate and parameterize a stochastic trait-based dynamical model. Given the high match between the theoretical results and observations, we believe that our work provides a future avenue towards a data-driven general framework to investigate continuous community assembly.

Methods

Data

Overall, we analyzed 1795 communities from 66 geographical sites (Fig. 1) across New Zealand comprising population abundance data from more than 114 macroinvertebrate taxa sampled from 1990 to 2019. These surveys were conducted for New Zealand’s National River Water Quality Network (NRWQN)43. Samples were collected following standardized protocols43 and under baseflow conditions. Seven Surber samples (0.1m2 and 250 μm mesh net) were collected on all sampling occasions during which macroinvertebrates were removed from a 0.1 m2 area in the sampler down to a depth of ca. 10 cm and from as many substrate types as possible. Individuals were later identified in the laboratory, to the lowest practicable taxonomic level44. The information on functional traits related to morphology, life-history, dispersal strategies and resource acquisition methods was obtained from the New Zealand freshwater macroinvertebrate trait database prepared by NIWA, which has been explicitly developed for New Zealand’s standardised freshwater macroinvertebrate sampling protocols45. Functional traits were fuzzy-coded from 0 to 346 and converted to a single value for each taxon using weighted averages. Daily average river discharge data (l/s) at each sampling location collected from NIWA database. The time series of environmental noise was obtained as the root mean squared noise, or amplitude of all noncharacteristic frequencies of the daily average time series of each year using FFT (Fast Fourier Transform). Flow data were log10-transformed and normalised by the average discharge across the entire period at each site30.

Species gains and losses were calculated as the number of species gained and lost from previous to next year divided by the total number of species observed in both years27,28. Furthermore, we used traditional biodiversity metrics that capture important structural aspects of communities such as number of species at given time compared to the number of species occurred in that given location over the studied period (relative richness), species abundance distribution (evenness) and species identity change over time (species turnover). Species evenness (J) is a description of the distribution of species abundances within a community and is defined as the Shannon information entropy divided by the maximum entropy of relative species abundances: J=-Σi=1SPilog[Pi]/logS, where Pi is the relative abundance of species i. Species turnover—defined as the relative number of species gained and lost from one time period to the next — describes local compositional changes over time27,28. The relationship between species gain-loss time-series were quantified by Spearman’s correlation coefficient and normalised mutual information. Mutual information is a nonparametric and non-monotonic similarity metric between two random variables and calculated as MIXY=H(X)+H(Y)-H(X,Y), where H denotes the Shannon entropy. The MIXY was then normalised by the maximum mutual information : NMIXY=MIXY/MIXYmax, where MIXYmax=min(H(X),H(Y)).

Causal discovery and causal effects

In order to infer causal relationships from observational time series, a first step involves the construction a graphical causal model, i.e. DAG (directed acyclic graph), among the variables in question referred to as causal discovery18. Causal discovery algorithms based on conditional independence testing (or constraint-based approaches) have four major steps: first, we start with a full undirected graph on n nodes (variables), with edges between all nodes. Second, we test each pair of variables X and Y, and each set of other variables S. If X and Y variables are independent given S (X⊥⊥Y|S), the edge between X and Y should be removed. Third, we search for colliders (i.e. nodes that receive edges from at least two other nodes) by checking for conditional dependencies between independent variables where X⊥⊥Y, but X⧸⊥⊥Y|S . Lastly, we orient the remaining undirected edges (if possible) by consistency with already-oriented edges. We applied the PC (Peter-Clark) algorithm for time series data29,47. In order to obtain a general picture of the causal relationships among our variables and to gain statistical confidence, we combined each variable of all 66 sites into a single concatenated time series48. All variables V were shifted with a time lag of τ=1 (variables were first shifted then concatenated). The time lag corresponds to the average generation time of the macroinvertebrate species, where most species are uni- or plurivoltine (Fig S4). We did not include the time lagged version of the environmental noise in the causal model due to its high temporal autocorrelation (Fig. S1). Since, all variables were continuous random variables but from different distributions, nonparametric Spearman’s partial correlation test have been applied to test for conditional independence49,50. The threshold for conditional independence tests were set to α=5·10-4 based on Structural Hamming Distance (SHD) analysis51,52. The SHD analysis counts the number of edge insertions, deletions and flips between two completed partially directed cyclic graphs (CPDAG)52, the PC algorithm generates a stable skeleton, but edge orientation can be dependent on the ordinality of the variables added to the algorithm49. Therefore, we measured the SHD between two CPDAGs with randomly ordering the variables. This was repeated 5000 times in order to obtain the threshold (α) for the analysis that gives the most stable CPDAGs (with the smaller SHD) regardless of the order of variables (see Fig. S2). The window causal graph (Fig. S3), which covered all variables (Vt and Vt+1), showed time consistency. The summary causal graphs (Fig. 3) which was deduced from the window causal graph and directly relate variables without time, gives an overview of the relationships47. The effect sizes were calculated as partial correlation coefficients applying the corresponding adjustment sets based on the window causal graph.

Theoretical analysis

We defined the population dynamics as a birth-death process8,53. The population birth B(n) and death D(n) rates are expressed as B(ni)=qi+ni·λi·(1-ni/Ki) and D(ni)=di·ni+ni·Σ(aij·nj/Ki). We consider that a community of species is characterized by an interaction matrix (A), whose elements (aij) define the direct per-capita effect of a species j on the per-capita growth rate of a species i. Note that aij and aji are not the same. Interaction matrices were generated using scaling relationships based on species body masses: Mi=M0·10ki with ki∼N(1,0.3) and M0=1. Competitive and predator-prey interaction coefficients were estimated as aij=a0MiiMjj with si=2/3 and sj=11/1232 or si=-3/4 and sj=3/433, respectively. The interaction matrices with a certain average interaction strength (excluding the diagonal elements) were generated via one-dimensional optimisation process. The immigration rate (qi) scaled with body sizes n0·Mi-1/4+ϵi with added Gaussian noise N(0, 0.1) to the exponent, where n0=10, which represent the noise resulting from dispersal processes (see Supporting Information). The amount of noise added were set to simulate the observed values obtained from causal inference analysis. Note that dispersal abilities generally positively scale with body mass, however in our empirical analysis smaller macroinvertebrate species have better dispersal abilities. We added external noise (representing environmental fluctuations) by varying the intrinsic growth rates (λi) of all species at each time step54. The intrinsic growth rates were scaled with body masses as λi-1/4+σi adding noise (σi) drawn from normal distribution N(0, 0.1) to the exponent. The intrinsic growth rates represent the inverse generation time, i.e. species with longer generation time have lower birth rates. The amount of noise added was set to simulate the observed values obtained from the causal inference analysis (see Supporting Information). Carrying capacities were calculated based on body size scaling as Ki=K0·Mi-3/4+γi, where γi is drawn from N(0, 0.1) and K0=103. Death rates were uniformly set to 0.5 across all species. In each case, the fraction of predator species were set to 40% similar to observations (see Supporting Information). The state of the system can be characterized by the probability P of having n individuals at time t. The time evolution of the probability distribution is described by a differential equation called a master equation: dP(n,t)dt=∑i{(D(ni+1)·P(ni+1,t)+B(ni-1)·P(ni-1,t))-(B(ni)·P(ni,t)+D(ni)·P(ni,t))}. Communities were simulated using Gillespie’s algorithm55. Simulations were run starting with 55 species representing the regional species pool across different levels of average interaction strengths, μ={0.01,0.1,0.5,1,1.5}, each interaction strength was replicated 100 times. Each stochastic simulation process was sampled over 30 times by equal time intervals. At each sampling event species identities and abundances were recorded.Fig 1 Sampling locations and river discharge in New Zealand. (a) Macroinvertebrate communities sampled annually across New Zealand rivers over 30 years at 66 sampling sites. (b) The signal-to-noise ratio (SNR) of river discharge time series indicate that New Zealand have rivers ranging from (c) aseasonal (left) to highly seasonal (right) discharge patterns.

Fig 2 Community metrics. Macroinvertebrate communities were sampled annually across New Zealand rivers over 30 years at 66 sampling sites. (a) Communities show overall a slight increase in richness through time. (b) Species evenness was also unchanged through time. (c) Species identity changes in communities were steady over time with relatively high turnover rates. (d) Species gains and losses were negatively correlated in each community (measured as the Spearman’s correlation) (e) with various levels of mutual dependence (dashed orange lines indicate the average value).

Fig 3 Causal graph. Causal relationships between species gains and losses, environmental noise (measured as the noise component of Fourier transform of river discharge) and community weighted mean (CWM) traits. Using causal discovery (PC algorithm) for time series data, results show that predation is the only variable that is directly linked to species gains and losses. Species gains and losses have a negative bidirectional relationship indicating the presence of cycles. Higher environmental noise slightly increases the mean generation time (voltinism) in the community. Higher predation leads to larger average body sizes and higher dispersal tend to lead to smaller body sizes. Larger average body sizes increases the average generation time.

Fig 4 Synthetic analysis of continuous community assembly. Communities assuming stochastic birth-death processes were generated with different levels of interaction strengths over 30 sampling events repeated 100 times for each parameter level. Interaction strengths refer to the average value of the non-diagonal elements of the interaction matrix. The purple dashed line indicates the empirical values. Panel (a) shows the Spearman’s correlation coefficient and panel (b) depicts the mutual information between species gains and losses time series. Stronger species interactions caused a more stronger negative association between gains and losses time series and higher mutual information. (c) Species richness is the highest when species do not interact and decreased with interaction strength. Similarly, interaction strength decreased (d) species evenness and increased (e) species turnover.

Supplementary Information

Supplementary Figures.

Supplementary Information

The online version contains supplementary material available at 10.1038/s41598-024-72405-z.

Acknowledgements

AT was supported by Te Pu¯naha Matatini, a Centre of Research Excellence funded by the Tertiary Education Commission, New Zealand. JDT is supported by a Rutherford Discovery Fellowship administered by the Royal Society Te Apa¯rangi (RDF-18-UOC-007).

Author contributions

AT conceived, designed and implemented the study and wrote the manuscript. TS and JDT contributed to the design of the study and edited the manuscript.

Data availibility

Data and codes supporting the results are archived on Zenodo https://zenodo.org/records/13734864.

Competing interests

The authors declare no competing interests.

Publisher's note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
==== Refs
References

1. Sala OE Global biodiversity scenarios for the year 2100 Science 2000 287 5459 1770 1774 10.1126/science.287.5459.1770 10710299
Sala, O. E. et al. Global biodiversity scenarios for the year 2100. Science 287(5459), 1770–1774 (2000).10710299
2. Hooper DU Effects of biodiversity on ecosystem functioning: A consensus of current knowledge Ecol. Monogr. 2005 75 1 3 35 10.1890/04-0922
Hooper, D. U. et al. Effects of biodiversity on ecosystem functioning: A consensus of current knowledge. Ecol. Monogr. 75(1), 3–35 (2005).
3. HilleRisLambers J Adler P Harpole W Levine J Mayfield M Rethinking community assembly through the lens of coexistence theory Annu. Rev. Ecol. Evolut. Syst. 2012 43 1 227 248 10.1146/annurev-ecolsys-110411-160411
HilleRisLambers, J., Adler, P., Harpole, W., Levine, J. & Mayfield, M. Rethinking community assembly through the lens of coexistence theory. Annu. Rev. Ecol. Evolut. Syst. 43(1), 227–248 (2012).
4. Nee S Gregory RD May RM Core and satellite species: Theory and artefacts Oikos 1991 62 1 83 87 10.2307/3545450
Nee, S., Gregory, R. D. & May, R. M. Core and satellite species: Theory and artefacts. Oikos 62(1), 83–87 (1991).
5. Dornelas M A balance of winners and losers in the Anthropocene Ecol. Lett. 2019 22 5 847 854 10.1111/ele.13242 30874368
Dornelas, M. et al. A balance of winners and losers in the Anthropocene. Ecol. Lett. 22(5), 847–854 (2019).30874368
6. Hubbell, S.P. The Unified Neutral Theory of Biodiversity and Biogeography (MPB-32). (Princeton University Press, 2001).
7. Chase JM Leibold MA Ecological Niches: Linking Classical and Contemporary Approaches, Interspecific Interactions 2003 University of Chicago Press
Chase, J. M. & Leibold, M. A. Ecological Niches: Linking Classical and Contemporary Approaches, Interspecific Interactions (University of Chicago Press, 2003).
8. Fisher, C.K. & Mehta, P. The transition between the niche and neutral regimes in ecology. In Proceedings of the National Academy of Sciences. Vol. 111(36). 13111–13116. (Proceedings of the National Academy of Sciences, 2014).
9. Poff NL Ward JV Implications of streamflow variability and predictability for lotic community structure: A regional analysis of streamflow patterns Can. J. Fish. Aquat. Sci. 1989 46 10 1805 1818 10.1139/f89-228
Poff, N. L. & Ward, J. V. Implications of streamflow variability and predictability for lotic community structure: A regional analysis of streamflow patterns. Can. J. Fish. Aquat. Sci. 46(10), 1805–1818 (1989).
10. Tonkin JD Designing flow regimes to support entire river ecosystems Front. Ecol. Environ. 2021 19 6 326 333 10.1002/fee.2348
Tonkin, J. D. et al. Designing flow regimes to support entire river ecosystems. Front. Ecol. Environ. 19(6), 326–333 (2021).
11. McAuliffe JR Competition for space, disturbance, and the structure of a benthic stream community Ecology 1984 65 3 894 908 10.2307/1938063
McAuliffe, J. R. Competition for space, disturbance, and the structure of a benthic stream community. Ecology 65(3), 894–908 (1984).
12. Cooper SD Walde SJ Peckarsky BL Prey exchange rates and the impact of predators on prey populations in streams Ecology 1990 71 4 1503 1514 10.2307/1938287
Cooper, S. D., Walde, S. J. & Peckarsky, B. L. Prey exchange rates and the impact of predators on prey populations in streams. Ecology 71(4), 1503–1514 (1990).
13. Rosemond, A. D., Pringle, C. M. & Ramírez, A. & Paul, M.J. A test of top-down and bottom-up control in a detritus-based food web. Ecology 82(8), 2279–2293 (2001).
14. Holomuzki JR Feminella JW Power ME Biotic interactions in freshwater benthic habitats J. N. Am. Benthol. Soc. 2010 29 1 220 244 10.1899/08-044.1
Holomuzki, J. R., Feminella, J. W. & Power, M. E. Biotic interactions in freshwater benthic habitats. J. N. Am. Benthol. Soc. 29(1), 220–244 (2010).
15. Scrimgeour GJ Culp JM Wrona FJ Feeding while avoiding predators: Evidence for a size-specific trade-off by a lotic mayfly J. N. Am. Benthol. Soc. 1994 13 3 368 378 10.2307/1467366
Scrimgeour, G. J., Culp, J. M. & Wrona, F. J. Feeding while avoiding predators: Evidence for a size-specific trade-off by a lotic mayfly. J. N. Am. Benthol. Soc. 13(3), 368–378 (1994).
16. McPeek MA Schrot AK Brown JM Adaptation to predators in a new community: Swimming performance and predator avoidance in damselflies Ecology 1996 77 2 617 629 10.2307/2265635
McPeek, M. A., Schrot, A. K. & Brown, J. M. Adaptation to predators in a new community: Swimming performance and predator avoidance in damselflies. Ecology 77(2), 617–629 (1996).
17. Martin TH Johnson DM Moore RD Fish-mediated alternative life-history strategies in the dragonfly Epitheca cynosura J. N. Am. Benthol. Soc. 1991 10 3 271 279 10.2307/1467600
Martin, T. H., Johnson, D. M. & Moore, R. D. Fish-mediated alternative life-history strategies in the dragonfly Epitheca cynosura. J. N. Am. Benthol. Soc. 10(3), 271–279 (1991).
18. Pearl, J. Causality: Models, Reasoning and Inference. 2nd ed. (Cambridge University Press, 2009).
19. Spaak JW Adler PB Ellner SP Continuous assembly required: Perpetual species turnover in two-trophic-level ecosystems Ecosphere 2023 14 7 e4614 10.1002/ecs2.4614
Spaak, J. W., Adler, P. B. & Ellner, S. P. Continuous assembly required: Perpetual species turnover in two-trophic-level ecosystems. Ecosphere 14(7), e4614 (2023).
20. Lytle DA Poff NL Adaptation to natural flow regimes Trends Ecol. Evolut. 2004 19 2 94 100 10.1016/j.tree.2003.10.002
Lytle, D. A. & Poff, N. L. Adaptation to natural flow regimes. Trends Ecol. Evolut. 19(2), 94–100 (2004).
21. Palmer, M. & Ruhi, A. Linkages between flow regime, biota, and ecosystem processes: Implications for river restoration. Science 365(6459), eaaw2087 (2019).
22. Tonkin, J.D. Climate change and extreme events in shaping river ecosystems. In Encyclopedia of Inland Waters (eds. Mehner, T., Tockner, K.). 653–664 (Elsevier, 2022).
23. Winterbourn MJ Rounick JS Cowie B Are New Zealand stream ecosystems really different? N. Z. J. Mar. Freshw. Res. 1981 15 3 321 328 10.1080/00288330.1981.9515927
Winterbourn, M. J., Rounick, J. S. & Cowie, B. Are New Zealand stream ecosystems really different?. N. Z. J. Mar. Freshw. Res. 15(3), 321–328 (1981).
24. Tonkin JD Death RG Muotka T Astorga A Lytle DA Do latitudinal gradients exist in New Zealand stream invertebrate metacommunities? PeerJ 2018 6 e4898 10.7717/peerj.4898 29844999
Tonkin, J. D., Death, R. G., Muotka, T., Astorga, A. & Lytle, D. A. Do latitudinal gradients exist in New Zealand stream invertebrate metacommunities?. PeerJ 6, e4898 (2018).29844999
25. Shipley, B. Cause and correlation in biology: A user’s guide to path analysis, structural equations and causal inference with R. 2 Ed. (Cambridge University Press, 2016).
26. Brown JH Gillooly JF Allen AP Savage VM West GB Toward a Metabolic Theory of Ecology Ecology 2004 85 7 1771 1789 10.1890/03-9000
Brown, J. H., Gillooly, J. F., Allen, A. P., Savage, V. M. & West, G. B. Toward a Metabolic Theory of Ecology. Ecology 85(7), 1771–1789 (2004).
27. Diamond JM Avifaunal equilibria and species turnover rates on the channel islands of California Proc. Natl. Acad. Sci. 1969 64 1 57 63 10.1073/pnas.64.1.57 16591783
Diamond, J. M. Avifaunal equilibria and species turnover rates on the channel islands of California. Proc. Natl. Acad. Sci. 64(1), 57–63 (1969).16591783
28. Hallett LM codyn: An r package of community dynamics metrics Methods Ecol. Evolut. 2016 7 10 1146 1151 10.1111/2041-210X.12569
Hallett, L. M. et al. codyn: An r package of community dynamics metrics. Methods Ecol. Evolut. 7(10), 1146–1151 (2016).
29. Spirtes, P., Glymour, C. & Scheines, R. Causation, Prediction, and Search. (The MIT Press, 2001).
30. Sabo JL Post DM Quantifying periodic, stochastic, and catastrophic environmental variation Ecol. Monogr. 2008 78 1 19 40 10.1890/06-1340.1
Sabo, J. L. & Post, D. M. Quantifying periodic, stochastic, and catastrophic environmental variation. Ecol. Monogr. 78(1), 19–40 (2008).
31. Sheldon RW Prakash A Sutcliffe WH Jr The size distribution of particles in the Ocean1 Limnol. Oceanogr. 1972 17 3 327 340 10.4319/lo.1972.17.3.0327
Sheldon, R. W., Prakash, A. & Sutcliffe, W. H. Jr. The size distribution of particles in the Ocean1. Limnol. Oceanogr. 17(3), 327–340 (1972).
32. Rall BC Universal temperature and body-mass scaling of feeding rates Philos. Trans. R. Soc. B Biol. Sci. 2012 367 1605 2923 2934 10.1098/rstb.2012.0242
Rall, B. C. et al. Universal temperature and body-mass scaling of feeding rates. Philos. Trans. R. Soc. B Biol. Sci. 367(1605), 2923–2934 (2012).
33. Saavedra, S., Arroyo, J.I., Marquet, P.A. & Kempes, C.P. Linking Metabolic Scaling and Coexistence Theories (2023).
34. Schmiedel U Oldeland J Vegetation responses to seasonal weather conditions and decreasing grazing pressure in the arid Succulent Karoo of South Africa Afr. J. Range Forage Sci. 2018 35 3–4 303 310 10.2989/10220119.2018.1531926
Schmiedel, U. & Oldeland, J. Vegetation responses to seasonal weather conditions and decreasing grazing pressure in the arid Succulent Karoo of South Africa. Afr. J. Range Forage Sci. 35(3–4), 303–310 (2018).
35. Creed RP Predator transitions in stream communities: A model and evidence from field studies J. N. Am. Benthol. Soc. 2006 25 3 533 544 10.1899/0887-3593(2006)25[533:PTISCA]2.0.CO;2
Creed, R. P. Predator transitions in stream communities: A model and evidence from field studies. J. N. Am. Benthol. Soc. 25(3), 533–544 (2006).
36. Landmann, S., Holmes, C.M. & Tikhonov, M. A simple regulatory architecture allows learning the statistical structure of a changing environment. eLife 10, e67455 (2021).
37. Bruijning M Metcalf CJE Jongejans E Ayroles JF The evolution of variance control Trends Ecol. Evolut. 2020 35 1 22 33 10.1016/j.tree.2019.08.005
Bruijning, M., Metcalf, C. J. E., Jongejans, E. & Ayroles, J. F. The evolution of variance control. Trends Ecol. Evolut. 35(1), 22–33 (2020).
38. De Bie T Body size and dispersal mode as key traits determining metacommunity structure of aquatic organisms Ecol. Lett. 2012 15 7 740 747 10.1111/j.1461-0248.2012.01794.x 22583795
De Bie, T. et al. Body size and dispersal mode as key traits determining metacommunity structure of aquatic organisms. Ecol. Lett. 15(7), 740–747 (2012).22583795
39. Woodward, G. & Warren, P. Body size and predatory interactions in freshwaters: scaling from individuals to communities. In Body Size: The Structure and Function of Aquatic Ecosystems, Ecological Reviews (eds. Hildrew, A.G., Raffaelli, D.G., Edmonds-Brown, R.). 98–117 (Cambridge University Press, 2007).
40. Wilkes MA Trait-based ecology at large scales: Assessing functional trait correlations, phylogenetic constraints and spatial variability using open data Glob. Change Biol. 2020 26 12 7255 7267 10.1111/gcb.15344
Wilkes, M. A. et al. Trait-based ecology at large scales: Assessing functional trait correlations, phylogenetic constraints and spatial variability using open data. Glob. Change Biol. 26(12), 7255–7267 (2020).
41. Tumolo BB Albertson LK Daniels MD Cross WF Sklar LL Facilitation strength across environmental and beneficiary trait gradients in stream communities J. Anim. Ecol. 2023 92 10 2005 2015 10.1111/1365-2656.13992 37555442
Tumolo, B. B., Albertson, L. K., Daniels, M. D., Cross, W. F. & Sklar, L. L. Facilitation strength across environmental and beneficiary trait gradients in stream communities. J. Anim. Ecol. 92(10), 2005–2015 (2023).37555442
42. Wallace JB Webster JR The role of macroinvertebrates in stream ecosystem function Annu. Rev. Entomol. 1996 41 115 139 10.1146/annurev.en.41.010196.000555 15012327
Wallace, J. B. & Webster, J. R. The role of macroinvertebrates in stream ecosystem function. Annu. Rev. Entomol. 41, 115–139 (1996).15012327
43. Smith DG McBride GB New Zealand’s national water quality monitoring network—Design and first year’s operation1 JAWRA J. Am. Water Resour. Assoc. 1990 26 5 767 775 10.1111/j.1752-1688.1990.tb01411.x
Smith, D. G. & McBride, G. B. New Zealand’s national water quality monitoring network—Design and first year’s operation1. JAWRA J. Am. Water Resour. Assoc. 26(5), 767–775 (1990).
44. Quinn JM Hickey CW Characterisation and classification of benthic invertebrate communities in 88 New Zealand rivers in relation to environmental factors N. Z. J. Mar. Freshw. Res. 1990 24 3 387 409 10.1080/00288330.1990.9516432
Quinn, J. M. & Hickey, C. W. Characterisation and classification of benthic invertebrate communities in 88 New Zealand rivers in relation to environmental factors. N. Z. J. Mar. Freshw. Res. 24(3), 387–409 (1990).
45. Dolédec S Phillips N Townsend C Invertebrate community responses to land use at a broad spatial scale: trait and taxonomic measures compared in New Zealand rivers Freshwater Biology 2011 56 8 1670 1688 10.1111/j.1365-2427.2011.02597.x
Dolédec, S., Phillips, N. & Townsend, C. Invertebrate community responses to land use at a broad spatial scale: trait and taxonomic measures compared in New Zealand rivers. Freshwater Biology 56(8), 1670–1688 (2011).
46. Chevene F Doléadec S Chessel D A fuzzy coding approach for the analysis of long-term ecological data Freshw. Biol. 1994 31 3 295 309 10.1111/j.1365-2427.1994.tb01742.x
Chevene, F., Doléadec, S. & Chessel, D. A fuzzy coding approach for the analysis of long-term ecological data. Freshw. Biol. 31(3), 295–309 (1994).
47. Assaad CK Devijver E Gaussier E Survey and evaluation of causal discovery methods for time series J. Artif. Intell. Res. 2022 73 767 819 10.1613/jair.1.13428
Assaad, C. K., Devijver, E. & Gaussier, E. Survey and evaluation of causal discovery methods for time series. J. Artif. Intell. Res. 73, 767–819 (2022).
48. Günther, W., Ninad, U. & Runge, J. Causal discovery for time series from multiple datasets with latent contexts. In Proceedings of the Thirty-Ninth Conference on Uncertainty in Artificial Intelligence (PMLR). 766–776 (2023).
49. Kalisch, M., Mächler, M., Colombo, D., Maathuis, M.H. & Bühlmann, P. Causal inference using graphical models with the R package pcalg. J. Stat. Softw. 47(11), 1 (2012) (26. section: articles).
50. Hauser A Bühlmann P Characterization and greedy learning of interventional Markov equivalence classes of directed acyclic graphs J. Mach. Learn. Res. 2012 13 1 2409 2464
Hauser, A. & Bühlmann, P. Characterization and greedy learning of interventional Markov equivalence classes of directed acyclic graphs. J. Mach. Learn. Res. 13(1), 2409–2464 (2012).
51. Tsamardinos I Brown LE Aliferis CF The max–min hill-climbing Bayesian network structure learning algorithm Mach. Learn. 2006 65 1 31 78 10.1007/s10994-006-6889-7
Tsamardinos, I., Brown, L. E. & Aliferis, C. F. The max–min hill-climbing Bayesian network structure learning algorithm. Mach. Learn. 65(1), 31–78 (2006).
52. Kalisch M Bühlmann P Estimating high-dimensional directed acyclic graphs with the PC-algorithm J. Mach. Learn. Res. 2007 8 613 636
Kalisch, M. & Bühlmann, P. Estimating high-dimensional directed acyclic graphs with the PC-algorithm. J. Mach. Learn. Res. 8, 613–636 (2007).
53. Palamara GM Delius GW Smith MJ Petchey OL Predation effects on mean time to extinction under demographic stochasticity J. Theor. Biol. 2013 334 61 70 10.1016/j.jtbi.2013.06.007 23778159
Palamara, G. M., Delius, G. W., Smith, M. J. & Petchey, O. L. Predation effects on mean time to extinction under demographic stochasticity. J. Theor. Biol. 334, 61–70 (2013).23778159
54. Caravagna G Mauri G d’Onofrio A The interplay of intrinsic and extrinsic bounded noises in biomolecular networks PLOS ONE 2013 8 2 e51174 10.1371/journal.pone.0051174 23437034
Caravagna, G., Mauri, G. & d’Onofrio, A. The interplay of intrinsic and extrinsic bounded noises in biomolecular networks. PLOS ONE 8(2), e51174 (2013).23437034
55. Gillespie DT Exact stochastic simulation of coupled chemical reactions J. Phys. Chem. 1977 81 25 2340 2361 10.1021/j100540a008
Gillespie, D. T. Exact stochastic simulation of coupled chemical reactions. J. Phys. Chem. 81(25), 2340–2361 (1977).
