Competition for fluctuating resources reproduces statistics of species abundance over time across wideranging microbiotas
Abstract
Across diverse microbiotas, species abundances vary in time with distinctive statistical behaviors that appear to generalize across hosts, but the origins and implications of these patterns remain unclear. Here, we show that many of these macroecological patterns can be quantitatively recapitulated by a simple class of consumerresource models, in which the metabolic capabilities of different species are randomly drawn from a common statistical distribution. Our model parametrizes the consumerresource properties of a community using only a small number of global parameters, including the total number of resources, typical resource fluctuations over time, and the average overlap in resourceconsumption profiles across species. We show that variation in these macroscopic parameters strongly affects the time series statistics generated by the model, and we identify specific sets of global parameters that can recapitulate macroecological patterns across wideranging microbiotas, including the human gut, saliva, and vagina, as well as mouse gut and rice, without needing to specify microscopic details of resource consumption. These findings suggest that resource competition may be a dominant driver of community dynamics. Our work unifies numerous time series patterns under a simple model, and provides an accessible framework to infer macroscopic parameters of effective resource competition from longitudinal studies of microbial communities.
Editor's evaluation
This paper introduces an elegant mathematical and ecological framework to model the fluctuations of microbial abundances in microbiomes along time series. The modeling approach considers consumerresource properties and is regulated by few parameters. Applied to timeseries microbiome data the model suggests the existence of recurrent patterns of microbial dynamics that are quite dependent on resource competition.
https://doi.org/10.7554/eLife.75168.sa0Introduction
Microbial communities are ubiquitous across our planet, and strongly affect host and environmental health (Sekirov et al., 2010; Tkacz and Poole, 2015). Predictive models of microbial community dynamics would accelerate efforts to engineer microbial communities for societal benefits. A promising class of models is consumerresource (CR) models, wherein species growth is determined by the consumption of environmental resources (Chesson, 1990). CR models capture a core set of interactions among members of a community based on their competition for nutrients, and have demonstrated the capacity to recapitulate important properties of microbial communities such as diversity and stability (Niehaus et al., 2019; Posfai et al., 2017; Tikhonov and Monasson, 2017). However, while model parameters such as resource consumption rates are beginning to be uncovered in the context of in vitro experiments (Goldford et al., 2018; Hart et al., 2019; Liao et al., 2020), it remains challenging to determine all parameters for a community of native complexity from the bottomup. A more accessible approach to parametrize CR models and to understand the features that drive communitylevel properties is needed.
To interrogate the dynamics of in vivo microbiotas, a common, topdown strategy is longitudinal sampling followed by 16S amplicon or metagenomic sequencing, thereby generating a relative abundance time series. Analyses of longitudinal data have shown that species abundances fluctuate around stable, hostspecific values in healthy humans (Caporaso et al., 2011; David et al., 2014; Faith et al., 2013). Recently, it was discovered that such time series exhibit distinctive statistical signatures, sometimes referred to as macroecological dynamics, that can reflect the properties of the community and its environment (Descheemaeker and de Buyl, 2020; Grilli, 2020; Ji et al., 2020; Shoemaker et al., 2017). For example, in human and mouse gut microbiotas, the temporal variance of different species scales as a power of their mean abundance (‘Taylor’s law’, Taylor, 1961) and deviations from this trend can highlight species that are transient invaders (Ji et al., 2020). Time series modeling can also provide insights into the underlying ecological processes. For example, the relative contributions of intrinsic versus environmental processes can be distinguished using autoregressive models whose output values depend linearly on values at previous times and external noise (Gibbons et al., 2017). Time series can also be correlated to environmental metadata such as diet to generate hypotheses about how environmental perturbations affect community composition (David et al., 2014), and to identify environmental drivers of transitions between distinct ecological states (Levy et al., 2020).
A growing body of work has shown that time series generated by simple mathematical models can exhibit statistics similar to experimental data sets, reinforcing the utility of such models for providing information about community dynamics even when many microscopic details are unknown. Some statistics can be recapitulated by phenomenological models, such as a noninteracting, constrained random walk in abundances (Grilli, 2020), while others can be described by a generalized LotkaVolterra (gLV) model with colored noise (Descheemaeker and de Buyl, 2020) or by ecological models describing the birth, immigration, and death of species (Azaele et al., 2006). However, the origins of and relationships among time series statistics have yet to be explained. Here, we sought to address this question using CR models, and simultaneously to use time series statistics as an accessible approach for parametrizing CR models.
Since the network of resource consumption in a community will typically depend on thousands of underlying parameters, directly measuring all parameters is intrinsically challenging. We sought to overcome this combinatorial complexity by adopting an indirect, coarsegrained approach, in which resources describe effective groupings of metabolites or niches, and model parameters are randomly drawn from a common statistical ensemble. We show that this simple formulation generates statistics that quantitatively match those observed in experimental time series across wideranging microbiotas without needing to specify the exact parameters of resource competition, allowing us to infer the global properties of resource competition that can recapitulate experimentally observed time series statistics. We further show that our effective CR model captures the behavior of a broader class of ecological interactions, and can guide the development and analysis of other models and their time series statistics. Our work thus provides an accessible connection between complex microbiotas and the effective resource competition that could underlie their dynamics, with broad applications for engineering communities relevant to human health and to agriculture.
Results
A coarsegrained CR model under fluctuating environments
To determine the nature of time series statistics generated by resource competition, we considered a minimal CR model in which $N$ consumers compete for $M$ resources via growth dynamics described by
Here, ${X}_{i}$ denotes the abundance of consumer i, ${Y}_{j}$ the amount of resource $j$, and ${R}_{ij}$ the consumption rate of resource $j$ by consumer i. The resources in this model are defined at a coarsegrained level, such that individual resources represent effective groups of metabolites or niches. We assumed that the resource consumption rates ${R}_{ij}$ were independent of the external environment and constant over time, thereby specifying the intrinsic ecological properties of the community with a collection of $N\times M$ microscopic parameters. To simplify this vast parameter space, we conjectured that the macroecological features of our experimental time series might be captured by typical profiles of resource consumption drawn from a statistical ensemble. This is a crucial simplification: while these randomly drawn values will never match the specific resource consumption rates of a given microbiota, previous work suggests that they can often recapitulate the largescale behavior of sufficiently diverse communities (Cui et al., 2021). This simplification allows us to test whether particular ensembles of resource consumption rates can reproduce the time series statistics we observe. Specifically, we considered an ensemble in which each ${R}_{ij}$ was randomly selected from a uniform distribution between 0 and ${R}_{\text{max}}$. To model the sparsity of resource competition within the community, each ${R}_{ij}$ was set to zero with probability $S$ (Figure 1A). This ensemble approach allows us to represent arbitrarily large communities with just two global parameters, $S$ and ${R}_{\text{max}}$.
We simulated the dynamics in Equation 1 using a serial dilution scheme (Erez et al., 2020) to mimic the punctuated turnover of gut microbiotas due to multiple feedings and defecations between sampling times. During a sampling interval $T$, each dilution cycle was seeded with an initial amount of each resource, ${Y}_{j,0}\left(T\right)$, and Equation 1 was simulated until all resources were depleted ($d{Y}_{j}/dt=0$ for all $j$). The community was then diluted by a factor $D$ and resources were replenished to their initial amounts ${Y}_{j,0}\left(T\right)$ (Figure 1B). To mimic the effects of a reservoir of species that could potentially compete for the resources (Ng et al., 2019), we initialized the first dilution cycle of each sampling interval by assuming that $N$ consumers were present at equal abundance. Additional dilution cycles were then performed until an approximate ecological steady state was reached (Figure 1B, Materials and methods). Consumer abundances at sampling time $T$ were defined by this approximate ecological steady state. For the relevant parameter regimes we considered, this approximate steady state was reached within a reasonable number of generations (5–6 dilutions or ~40 generations for $D=200$). Although the precise details of microbiota turnover are largely unknown in humans, our modeling results were robust to the precise value of $D$ and threshold for ecological steady state (Figure 1—figure supplement 1). Similarly, our results did not depend on the precise composition of the reservoir (Figure 1—figure supplement 2), although they did depend on its existence and relative size (Figure 1—figure supplement 2).
Under the assumptions of this model, any temporal variation in consumer abundances must arise through external fluctuations in the initial resource levels ${Y}_{j,0}\left(T\right)$, which might come, for example, from dietary fluctuations. To model these fluctuations, we assumed that the initial resource levels undergo a biased random walk around their average values $\stackrel{}{{Y}_{j}}$:
where ${\xi}_{j}\left(T\right)$ is a normally distributed random variable with zero mean and unit variance, $\sigma $ determines the magnitude of resource fluctuations, and $k$ is the strength of a restoring force that ensures the same resource environment on average over time (Figure 1A). The absolute value enforces ${Y}_{j,0}$ to be positive. If $k=0$, there is no restoring force and hence ${Y}_{j,0}\left(T\right)$ performs an unbiased random walk; if $k=1$, ${Y}_{j,0}\left(T\right)$ fluctuates about its set point $\overline{{Y}_{j}}$ independent of its value at the previous sampling time. For all $k>0$, the model exhibits longterm stability without drift. As above, we used an ensemble approach to model the set points $\overline{{Y}_{j}}$, assuming that each $\overline{{Y}_{j}}$ was independently drawn from a uniform distribution between $0$ and ${Y}_{\text{max}}$. These assumptions yield a Markov chain of fluctuating resource amounts ${Y}_{j,0}\left(T\right)$ and their corresponding consumer relative abundances ${x}_{i}\left(T\right)={X}_{i}\left(T\right)/\sum _{n}{X}_{n}\left(T\right)$ (Figure 1C).
The statistical properties of these time series are primarily determined by five global parameters: the total number of consumers in the reservoir $N$, the number of resources in the environment $M$, the sparsity $S$ of the resource consumption matrix, and the resource fluctuation parameters $\sigma $ and $k$. The absolute magnitudes of ${R}_{\text{max}}$ and ${Y}_{\text{max}}$ are not important for our purposes since they do not affect the predictions of consumer relative abundances at ecological steady state. We extracted $N$ from experimental data as the number of consumers that were present for at least one sampling time point, leaving only four free global parameters.
Previous studies have suggested that the family level is an appropriate coarse graining of metabolic capabilities (Goldford et al., 2018; Louca et al., 2016; Tian et al., 2020), thus we assumed, unless otherwise specified, that each consumer grouping i within our model represents a taxonomic family, and combined abundances of empirical operational taxonomic units (OTUs) or amplicon sequencing variants (ASVs; Callahan et al., 2016) at the family level for analyses (Materials and methods). Given the typical limits of detection of 16S amplicon sequencing data sets, we only examined time series statistics for taxa with relative abundance >10^{–4} at any given time point. Experimental and simulated data were processed equivalently to enable consistent comparisons of their time series statistics.
As expected, we found that random realizations of our model (i.e., different resource consumption matrices drawn from the same ensemble) generated similar time series statistics, whose typical behavior strongly varied with the global parameters of the model. In particular, only small subsets of the parameters led to time series statistics that agreed with experiments, as we show below. An example simulation using the macroscopic parameters $\left(N,M,S,\sigma ,k\right)=\left(50,30,0.1,0.2,0.8\right)$ is shown in Figure 1. This set of parameters produced relative abundance time series with highly similar statistical behaviors as in experiments involving daily sampling of human stool (Figure 1D). Given this agreement, we next systematically analyzed the time series statistics generated by our model across the macroscopic parameter space and compared against experimental behaviors to estimate model parameters for wideranging microbiotas.
Model reproduces the statistics of human gut microbiota time series
To test whether our model can recapitulate major features of experimental time series, we first focused on a data set of daily sampling of the gut microbiota from a human subject (Caporaso et al., 2011; Figure 2). These data were previously shown (Ji et al., 2020) to exhibit several distinctive statistical behaviors: (1) the variance ${\sigma}_{{x}_{i}}^{2}$ of family i over the sampling period scaled as a power law with its mean $\u2329{x}_{i}\u232a$ (Figure 2B and F); (2) the log_{10}(abundance change) ${\mathrm{\Delta}l}_{i}\left(T\right)={\mathrm{log}}_{10}\left({x}_{i}\left(T+1\right)/{x}_{i}\left(T\right)\right)$ , pooled over all families and across all sampling times, was well fit by an exponential distribution with standard deviation ${\sigma}_{\mathrm{\Delta}l}$ (Figure 2B and G); and (3) the distributions of residence times ${t}_{\text{res}}$ and return times ${t}_{\text{ret}}$ (the durations of sustained presence and absence, respectively) pooled over all families were well fit by power laws with an exponential cutoff (Figure 2D and K). Through an exhaustive search of parameter space, we identified a specific combination of parameters that could reproduce all of these behaviors within our simple CR model (Figure 2F, G and K).
In addition, several other important statistics were reproduced without any additional fitting: (1) the distribution of richness $\alpha \left(T\right)$ , the number of consumers present at sampling time $T$ (Figure 2A and E); (2) the distribution of the restoring slopes ${s}_{i}$ of the linear regression of $\mathrm{\Delta}{l}_{i}\left(T\right)$ against ${l}_{i}\left(T\right)\equiv {\mathrm{log}}_{10}\left({x}_{i}\left(T\right)\right)$ across all $T$ (Figure 2C and H); (3) the distribution of prevalences ${p}_{i}$ , the fraction of sampling times for which family i is present (Figure 2A1); (4) the relationship between ${p}_{i}$ and $\u2329{x}_{i}\u232a$ (Figure 2J); and (5) the rank distribution of mean abundances $\u2329{x}_{i}\u232a$ (Figure 2L).
Therefore, our model was able to simultaneously capture at least eight statistical behaviors in a microbiota time series with only four parameters, each of which may represent biologically relevant features of the community.
To determine whether our model can be used to analyze time series statistics at other taxonomic levels, we analyzed the same data set (Caporaso et al., 2011) at finer (genus) and coarser (class) taxonomic levels, both of which exhibited qualitatively similar statistical behaviors as the family level. Our modeling framework was able to quantitatively recapitulate almost all statistics at both levels (Figure 2—figure supplements 1 and 2). A notable exception is that the Bacteroides genus dominated the observed rank abundance distribution at the genus level, while our CR model predicted a more even distribution (Figure 2—figure supplement 2). Nevertheless, the relative abundances among the remaining genera were still well captured by the model predictions (Figure 2—figure supplement 2). These results demonstrate that our model and its applications can be generalized across taxonomic levels.
Systematic characterization of the effects of CR dynamics on time series statistics
Since our model can reproduce the observed statistics in gut microbiota time series, we sought to determine how these statistics would respond to changes in model parameters, and thus how experimental measurements constrain the ensemble parameters across various data sets. To do so, we simulated our model across all relevant regions of parameter space. $S$ and $k$ were varied across their entire ranges, and $M$ and $\sigma $ were varied across relevant regions outside of which the model clearly disagreed with the observed data. For each set of parameters, each time series statistic was averaged across random instances of ${R}_{ij}$ and ${Y}_{j,0}\left(T\right)$ drawn from the same statistical ensemble. For each statistic $z$, its global susceptibility $C(z,w)$ to parameter $w$ was calculated as the change in $z$ when $w$ is varied, averaged over all other parameters and normalized by the standard deviation of $z$ across the entire parameter space. Due to the normalization, $C\left(z,w\right)$ varies approximately between –3 and 3, where a magnitude close to 3 indicates that almost all the variance of $z$ is due to changing $w$.
By clustering and ranking susceptibilities, we identified four statistics with $\leftC\left(z,w\right)\right>2$ that were largely determined by one of each of the four model parameters (Figure 3, Figure 3—figure supplement 1): mean richness $\u2329\alpha \u232a$, the power law exponent $\beta $ of ${\sigma}_{{x}_{i}}^{2}$ versus $\u2329{x}_{i}\u232a$, the standard deviation in log_{10}(abundance change) ${\sigma}_{\mathrm{\Delta}l}$, and the mean restoring slope $\u2329s\u232a$ were almost exclusively susceptible to variations in $M$, $S$, $\sigma $, and $k$, respectively. Similar results were also obtained for local versions of the susceptibility, in which individual parameters were varied around the best fit values for the human gut microbiota in Figure 2 (Figure 3figure supplement 2). These susceptibilities broadly illustrate how various time series statistics are affected by coarsegrained parameters of resource competition; we further investigate some specific examples in the next section.
The exclusive susceptibilities of these four statistics suggest that they can serve as informative metrics for estimating model parameters. Therefore, we estimated model parameters by minimizing the sum of errors between model predictions and experimental measurements of these four statistics, and obtained estimation bounds by determining parameter variations that would increase model error by 5% of the mean error across all parameter space. As we will show, the resulting bounds are small relative to the differences among distinct microbiotas, indicating that meaningful conclusions can be drawn from the best fit values of the ensemble level parameters of resource competition. In summary, the four model parameters were fit to four summary statistics: mean richness $\u2329\alpha \u232a$, variancemean scaling exponent $\beta $, standard deviation of abundance change ${\sigma}_{\mathrm{\Delta}l}$, and mean restoring slope $\u2329s\u232a$ (Figure 2E–H, respectively). The shapes of their corresponding distributions and scalings, as well as at least four other statistics (Figure 2I–L), are all parameterfree predictions.
Origins of distinctive statistical behaviors in species abundance time series
To understand the mechanisms that underlie the susceptibilities of various time series statistics to model parameters, we investigated their origins within our model, focusing on how they constrain the parameters.
The average richness $\u2329\alpha \u232a$ is a fundamental descriptor of community diversity. Within our model, $\u2329\alpha \u232a$ is largely determined by and increases with increasing resource number $M$ ($C\left(\alpha ,N/M\right)=2.6$), as expected for CR dynamics. The sparsity of resource use $S$ impacts the power law exponent $\beta $ between ${\sigma}_{{x}_{i}}^{2}$ and $\u2329{x}_{i}\u232a$ ($C\left(\beta ,S\right)=2.0$). Together, $\alpha $ and $\beta $ constrain the parameters of resource competition $M$ and $S$.
The effect of $S$ on $\beta $ can be partially understood by considering limiting behaviors as follows. When sparsity is high ($S\approx 1$), there is little competition and each consumer consumes almost distinct sets of resources from other consumers. In the limit in which each consumer utilizes a single unique resource, ${\sigma}_{{x}_{i}}^{2}$ is determined by the noise in resource level, which has a $\beta =2$ scaling according to Equation 2. In the limit of large $M$ and high sparsity, the variation in the number of resources consumed by each consumer can be large relative to the mean, and both ${\sigma}_{{x}_{i}}^{2}$ and $\u2329{x}_{i}\u232a$ scale with the number of resources consumed, hence $\beta =1$. Simulations of a nocompetition model in which consumers consume distinct sets of resources confirmed the scalings in these limits (Figure 3—figure supplement 3). By contrast, when sparsity is low ($S\approx 0$), each consumer utilizes almost all resources and hence variation in the number of resources consumed is small relative to the mean. Despite the obvious presence of competition in our CR model, we nevertheless attempted to understand the low sparsity limit by extrapolating the nocompetition model above to a case in which all consumers consume distinct sets of the same number of resources. For large number of resources, these simulations predicted that $\beta \approx 1.5$ (Figure 3—figure supplement 3), as did our CR model for $S=0.1$ (Figure 3—figure supplement 3). These findings suggest that the effect of $S$ on $\beta $ can be partially attributed to differences in the number of resources consumed.
The distribution of $\mathrm{\Delta}l$ describes the nature of abundance changes. As expected, the width of the distribution is largely determined by and increases with increasing $\sigma $ ($C\left({\sigma}_{\mathrm{\Delta}l},\sigma \right)=2.6$). For the gut microbiota data set in Figure 2, the shape of the distribution was well fit by an exponential. Within our model, the shape of the distribution aggregated across all consumers is determined by $N/M$ and the sparsity $S$, emerging from the mixture of each consumer’s individual distribution (Figure 3—figure supplement 4). When $N/M<1$ and the sparsity $S$ is low, individual distributions of $\mathrm{\Delta}l$ are well fit by normal distributions, and pool together to generate another normal distribution. When $N/M<1$ and sparsity $S$ is high, individual distributions remain normal, but can pool together to generate a nonnormal distribution that is well fit by an exponential (see also Allen et al., 2001). By contrast, when $N/M>1$, individual distributions can be well fit by an exponential and can pool together to approximate another exponential. Simulations of the nocompetition model considered above led to individual and aggregate distributions that were normal in all cases, indicating that in our model resource competition is responsible for generating the nonnormal distributions of $\mathrm{\Delta}l$ (Figure 3—figure supplement 3). Although it is challenging to discern the shape of individual distributions in most experimental data sets given the limited numbers of samples, the shape of the aggregate distribution of $\mathrm{\Delta}l$ informs the parameters of resource competition $M$ and $S$. In particular, an exponential distribution of $\mathrm{\Delta}l$ suggests either strong resource competition in the form of $N>M$ or substantial niche differentiation in the form of high $S$. Other statistics such as $\beta $ can help to distinguish between these two regimes.
The distribution of restoring slopes ${s}_{i}$ describes the tendency with which consumers revert to their mean abundances following fluctuations. As expected, the mean $\u2329s\u232a$ is almost completely determined by $k$, which describes the autocorrelation in resource levels ($\u2329s\u232a\approx k$ and $C\left(\u2329s\u232a,k\right)=3.0$). Together, the distributions of $\mathrm{\Delta}l$ and ${s}_{i}$ constrain the parameters of external fluctuations $\sigma $ and $k$.
Within our model, resource fluctuations can lead to the temporary ‘extinction’ of certain species when they drop below the detectability threshold of 10^{–4}. The distributions of residence and return times, ${t}_{\text{res}}$ and ${t}_{\text{ret}}$, reflect the probabilities of extinction as well as correlations between sampling times. For all parameter sets explored, these distributions can be well fit by power laws, with an exponential cutoff to account for finite sampling (Ji et al., 2020). As expected, the power law slopes ${\nu}_{\text{res}}$ and ${\nu}_{\text{ret}}$ decrease (become more negative) with increasing $\sigma $ or $k$ (Figure 3—figure supplement 1), since increasing external noise or decreasing correlations in time increases the probability of fluctuating between existence and extinction for each consumer. By contrast, ${\nu}_{\text{res}}$ and ${\nu}_{\text{ret}}$ change in opposite directions in response to variation in $M$ (Figure 3—figure supplement 1). Increasing $M$ leads to a larger number of highly prevalent consumers, thereby increasing the mean and broadening the distribution of ${t}_{\text{res}}$ and decreasing the mean and narrowing the distribution of ${t}_{\text{ret}}$. Since the four ensemble level parameters are already fixed by other statistics, the distributions of ${t}_{\text{res}}$, ${t}_{\text{ret}}$, and ${p}_{i}$ are parameterfree predictions of our model. In other words, a macroscopic characterization of the effective resource competition and resource fluctuations is sufficient to predict the statistics of ‘extinction’ dynamics, as well as the abundance rank distribution and the relationship between consumer abundance and prevalence.
Since the distributions of $\mathrm{\Delta}l$, ${t}_{\text{res}}$, and ${t}_{\text{ret}}$ are dependent on correlations between sampling times, it was initially puzzling that their distributions in some data sets remained similar after shuffling sampling times, raising questions as to what extent these statistics hold information about the underlying intrinsic dynamics (Tchourine et al., 2021; Wang and Liu, 2021a). Our results assist in reconciling the apparent conundrum, since within our model richness $\u2329\alpha \u232a$ and Taylor’s law exponent $\beta $ do not depend on correlations between sampling times and are also the statistics that are most informative about the intrinsic parameters $M$ and $S$ (Figure 3). As a result, the shuffled time series were also well fit by our model and yielded best fit values that were identical to those produced by the actual time series except with $k=1$, as expected due to the absence of correlation across sampling times (Figure 3—figure supplement 5). Thus, our results suggest that while external fluctuations in resource levels may be responsible for generating species abundance variations, the intrinsic properties of resource competition can determine the resulting scaling exponents of many statistical behaviors.
Taken together, our analyses demonstrate the complex relationships among time series statistics and highlight their unification within our model using only a small number of global parameters, whose values are strongly constrained by macroecological patterns.
CR model guides the identification of other models that can reproduce time series statistics
We have shown that many time series statistics can be recapitulated by a simple model that does not require knowing many detailed features of real microbiota (Figure 2). The success of this approach implies that these macroecological fluctuations must be independent of at least some model details, which suggests that there may be other ecological models that could also recapitulate the same data (Figure 4, Figure 4—figure supplements 1–5). The relationships between ecological models are generally poorly characterized. To explore these possibilities, we sought to compare our calibrated CR models against several common alternatives.
First, we aimed to determine the extent to which the simulated statistics depend on the assumptions of our CR model. Our parametrization of the consumption rates introduces a correlation between the maximum growth rate of a consumer and the number of resources it consumes. To remove this correlation, we normalized the sum of consumption rates ${\sum}_{j}{R}_{ij}$ for consumer i to a fixed capacity ${\stackrel{~}{R}}_{i}$ that was randomly drawn from the original growth rates ${\sum}_{j}{R}_{ij}{Y}_{j,0}$ (Good et al., 2018; Posfai et al., 2017; Tikhonov and Monasson, 2017). This modification preserves the variation in consumer fitness while implementing a metabolic tradeoff. The resulting time series statistics were essentially unaffected, also recapitulating experimental data (Figure 4—figure supplement 1).
Moreover, the CR dynamics in Equation 1 do not consider other biologically plausible scenarios such as saturation kinetics (Momeni et al., 2017; Niehaus et al., 2019). To probe the robustness of the results of our model to the dynamical assumptions, we implemented saturation kinetics with all other details kept the same (Materials and methods). When this model was simulated with the best fit parameters of the original model, the resulting dynamics were less variable across sampling times than without saturation kinetics, since the saturated regime is unaffected by small changes in resource levels (Figure 4—figure supplement 2). Nonetheless, experimental statistics were again reproduced once the strength of environmental fluctuations $\sigma $ was increased appropriately (Figure 4—figure supplement 2). This suggests that our results are robust to assumptions regarding metabolic tradeoffs and saturation kinetics.
We next considered a noninteracting null model in which consumer abundances were drawn from independent normal distributions whose means and variances were fitted directly from the data. Even with a large number of free parameters, this null model was unable to capture some of the time series statistics reproduced by our CR model, including Taylor’s law as well as the distributions of richness and restoring slopes (Figure 4—figure supplement 3). We reasoned that the discrepancies between experimental data and the null model could be due to the lack of interspecies interactions. To test this hypothesis, we examined the pairwise correlations between the consumer abundances across sampling times. The measured distribution of pairwise correlations is much broader than the prediction of the noninteracting model, which is sharply peaked about zero as expected (Figure 4). By contrast, the distribution of correlations predicted by our CR model without any additional fitting was in much closer agreement with the experimental data (Figure 4). These findings imply that interspecies interactions are required to capture important details of community dynamics.
While our CR model assumes pairwise interactions between consumers and resources, the effective interactions between consumers are not necessarily pairwise. To explore whether these higherorder contributions are necessary for recapitulating the data, we considered models explicitly based on pairwise interspecies interactions, which despite differences compared with CR models (Momeni et al., 2017) can also reproduce some properties of experimental time series (Descheemaeker and de Buyl, 2020; Wang and Liu, 2021b). To further explore the properties of models focused on pairwise interactions, we investigated gLV models in which $N$ taxa grow and interact via
where ${X}_{i}$ denotes the relative abundance of taxon i, ${r}_{i}$ its growth rate, and ${A}_{ij}$ its interaction coefficient with taxon $j$. $\mathrm{\Gamma}\left(t\right)=\sum _{i}{r}_{i}{X}_{i}+\sum _{i,j}{A}_{ij}{X}_{i}{X}_{j}$ is a normalizing term that ensures that the relative abundances always sum to one (Joseph et al., 2020). Since this classical model is generally unstable for randomly drawn interaction coefficients (May, 1972), we sought to focus on particular instances of the gLV model that were closest to our original CR model. This conversion between models was achieved by converting the consumption rates ${R}_{ij}$ and resource levels ${Y}_{j,0}$ at each sampling time $T$ to the growth rates ${r}_{i}$ and interaction coefficients ${A}_{ij}$ that characterize the dynamics when consumption rates are similar to the mean value (Materials and methods). This conversion results in negative, symmetric ${A}_{ij}$ whose magnitudes depend on the niche overlap between the interacting taxa (Good et al., 2018). Moreover, fluctuations in ${Y}_{j,0}$ result in corresponding fluctuations in both ${r}_{i}$ and ${A}_{ij}$ across $T$. These CRconverted gLV models generated time series statistics that reproduced the experimental data to a similar extent as the original CR model (Figure 4—figure supplement 4). In light of this correspondence, we asked whether more general ensembles of pairwise interaction could also reproduce the experimental data. We randomly selected ${r}_{i}$ and ${A}_{ij}$ values from normal distributions with means and variances equal to those in the CRconverted gLV models while enforcing symmetric and negative interactions. The resulting gLV models yielded a poor fit to the data (Figure 4—figure supplement 5). Together, these results suggest that while pairwise interactions between taxa are likely sufficient to recapitulate the experimental data, their parameters must be drawn from particular ensembles that can be more simply described in the CR framework.
These examples reinforce that only a particular subset of models can recapitulate the data, and therefore, that the underlying community properties are highly constrained by macroecological dynamics. Moreover, our calibrated CR model can guide the parametrization of other models that can satisfy those constraints, while also identifying model features that are necessary for recapitulating data.
Time series statistics distinguish wideranging microbiotas
Having developed a simple method to estimate parameters of our CR model that recapitulate time series statistics, we applied this method to data sets involving wideranging microbial communities. Although the various communities considered are drastically different in many aspects, we hypothesized that our CR model framework could still be applied to identify the statistical ensembles that can describe their macroecological dynamics. In addition to microbiotas from the human and mouse gut (Caporaso et al., 2011; Carmody et al., 2015; David et al., 2014), we examined communities from the human vagina (Song et al., 2020), human saliva (David et al., 2014), and in and around rice roots (Edwards et al., 2018). The time series statistics of these microbiotas varied broadly (Figure 5A). Nevertheless, our model successfully reproduced the experimental statistics across all communities (Figure 5—figure supplements 1–6), suggesting that simple CR models can capture many of the macroscopic features of these microbiotas.
The best fit parameters suggest that the effective resource competition dynamics occur in distinct regimes across microbiotas (Figure 5B). Human gut microbiotas were best described by $N>M$, suggesting that there are more species in the reservoir than resources in the environment, by contrast to mouse gut microbiotas that were best described by $N<M$. In terms of resource niche overlaps, human gut microbiotas were best fit with sparsity $S<0.3$, while mouse gut microbiotas were best fit with $S>0.3$, suggesting that on average, pairs of bacterial families are more metabolically distinct in the mouse versus the human gut.
Unlike gut microbiotas, a human saliva microbiota yielded best fit parameters $N\approx M$ and $S\approx 0.8$, suggesting that this community has access to abundant resources and that each effective resource is competed for by a small fraction of the extant bacterial families. All vaginal microbiotas were best fit with $S<0.1$, suggesting intense resource competition.
Like vaginal microbiotas, microbial communities residing in the bulk soil around rice roots and in the associated rhizoplane and rhizosphere were well described by $S<0.1$. By contrast, the community in the associated endosphere was best described by $S\approx 0.6$, suggesting that resource competition is less fierce within plant roots than around them.
In addition, inferences about the nature of environmental fluctuations can be made from the best fit values of $\sigma $ and $k$ (Figure 5B). Apart from the two vaginal microbiota data sets, the best fit values of $\sigma $ ranged from 0.1 to 0.3, indicating that changes in resource levels smaller than this magnitude will generate abundance changes that look like typical fluctuations. The best fit values of $k$ varied between 0.5 and 1 across data sets, suggesting that the dynamics of microbial communities occur faster than or comparable to the typical sampling frequency of longitudinal studies. While it is unclear whether the internal time scales are faster than the sampling frequency for all of these communities, simulation results were robust to the dilution factor and threshold change defining ecological steady state (Figure 1—figure supplement 1), two main factors that affect the relationship between the internal and sampling time scales.
Inferences about intrinsic parameters of resource competition and external parameters of environmental fluctuations were also consistent with expectations for in vitro passaging of complex communities derived from humanized mice (ArandaDíaz et al., 2022). The resulting time series statistics were best fit by the smallest value of $\sigma $ among the data sets studied, indicating that the in vitro environment has relatively low noise across sampling times (as expected); the nonzero $\sigma $ presumably arises from technical variations that result in effective noise in resource levels. The best fit value of $M$ was larger than the reservoir size $N$, suggesting that there are many distinct resources in the complex medium used for passaging and consistent with the ability of more diverse inocula to support more diverse in vitro communities (ArandaDíaz et al., 2022). The consistency of these results further supports the utility of our model.
Taken together, our model infers ensemblelevel parameters of resource competition and external parameters of environmental fluctuations for several widely studied microbial communities that can inform future mechanistic studies.
Discussion
Here, we presented a coarsegrained CR model that generates species abundance time series from fluctuating environmental resources. We demonstrated that this model reproduces several statistical behaviors (Figure 2) and elucidated how these observations constrain the parameters of resource competition within the model (Figure 3). Moreover, we successfully fitted the model to wideranging microbiotas, which allowed us to draw inferences about the parameters of their effective resource competition. In sum, our work provides an existence proof that a CR model can recapitulate experimentally observed time series statistics in microbiotas from diverse environments.
An important feature of our model is that it does not need to specify the individual resource uptake rates of different taxa, which could be too numerous and complex to be tractable. Instead, our model reproduces many statistical behaviors with a small number of global parameters that describe the distributions of resource uptake rates. To what extent these macroscopic parameters can be interpreted mechanistically is an interesting open question that could be explored in future work. Although by no means exhaustive, our framework nevertheless addresses several pertinent questions regarding construction of useful models of microbiota dynamics. The success of our CR model in reproducing experimental time series statistics is consistent with bioinformaticsguided analyses of complex communities demonstrating that metabolic capability is a major determinant of community composition (Louca et al., 2016; Tian et al., 2020). Our results also suggest that the contributions of a reservoir of species or other forms of species reintroduction are important for the dynamics of wideranging microbiotas. Within our model, the lack of species reintroduction renders poor consumers unable to recover to meaningful abundance within a sampling time even when resource fluctuations are in their favor, thereby distorting time series statistics. The existence of a reservoir is consistent with previous experimental work in mice (Ng et al., 2019), but further work is required to investigate how species reintroduction occurs in other systems. Similarly, further experimental work is required to ascertain the amount of growth and change that occurs during sampling time scales, and further theoretical work is required to infer such internal time scales from microbiota time series.
In terms of intrinsic metabolic properties, our results provide a baseline expectation for the effective number of resources or available niches in the wideranging systems examined here, and to what extent they are competed for by extant consumers. In terms of environmental properties, our results provide a baseline expectation to help distinguish between typical fluctuations and large perturbations in resources. These expectations may aid in the engineering of complex microbiotas.
In general, our work demonstrates that it is feasible to reproduce time series statistics using CR models of microbiota dynamics, thereby generating mechanistic hypotheses for further investigation. Our CR model and fitting procedure can also be used to aid the parametrization of other models such as LotkaVolterra models (Figure 4—figure supplements 1–5), comparisons among which can reveal the model details that are required to recapitulate experimental data. In the future, more detailed hypotheses can be generated by investigating how time series statistics are affected by modifications to baseline CR dynamics, such as the incorporation of metabolic crossfeeding (Goldford et al., 2018; Li et al., 2020) or physical interactions such as type VI killing (Verster et al., 2017), functional differentiation from genomic analysis (Arkin et al., 2018; Machado et al., 2021; Pollak et al., 2021), and physical variables such as pH (ArandaDíaz et al., 2020; Ratzke and Gore, 2018), temperature (Lax et al., 2020), and osmolality (Cesar et al., 2020). In addition, recent studies have shown that evolution can substantially affect the dynamics of human gut microbiotas (Garud et al., 2019; Yaffe and Relman, 2020; Zhao et al., 2019). It will therefore be illuminating to incorporate evolutionary dynamics into CR models under fluctuating environments (Good et al., 2018). Such extended models can then be applied to probe the underlying mechanisms in microbiotas for which frequent sampling and deeper understanding could be translated to urgent applications, including those in marine environments, wastewater treatment plants, and the guts of insect pests and livestock.
Materials and methods
Simulations of a CR model with fluctuating resource amounts
Request a detailed protocolUnder a serial dilution scheme, an ecological steady state is reached when the dynamics in subsequent passages are identical, which is the case when all consumers are either extinct or have a growth ratio (the ratio of a consumer’s final and initial abundances within one passage) equal to the dilution factor $D$. Due to the slow path to extinction of some consumers, reaching an exact ecological steady state can require hundreds of passages, presumably more than realistically occurs between sampling times in the data sets examined here. Thus, we assumed instead that between sampling times the system only approximately reaches an ecological steady state, defined as the growth ratios of all species changing by less than a threshold between subsequent passages that was defined as a fraction of $D$. Throughout this study, $D$ was set to 200 and the steady state threshold was 5%, under which a steady state was approximately reached in about 5 dilutions (Figure 1B). In this manner, our model assigns a welldefined state of consumer abundances to each resource environment while ensuring that only a reasonable amount of change occurs between sampling times. Note that in human gut microbiotas, abundances can change by more than 1000fold between daily samplings (Figure 2B), indicating that at least 10 generations can occur between sampling times. The precise value of $D$ did not affect time series statistics, and steadystate thresholds between 1% and 10% generated similar time series statistics (Figure 1—figure supplement 1). We therefore expect our results to be robust to the values of these two parameters. Simulations were carried out in Matlab, and all code is freely available online in Matlab and Python at https://bitbucket.org/kchuanglab/consumerresourcemodelformicrobiotafluctuations/.
CR model with saturation kinetics
Request a detailed protocolSaturation kinetics were implemented into the CR dynamics of Equation 1 as
where ${Y}_{s}$ denotes the saturation constant. For simplicity, ${Y}_{s}$ was assumed to be equal for all resources, and set to an intermediate value of ${Y}_{s}=\u2329{Y}_{j,0}\u232a/3$ such that both saturated and linear kinetics could affect community dynamics. Other model details are the same as the original CR model.
LotkaVolterra models
Request a detailed protocolThe gLV model in Equation 3 was parametrized in two ways. The first parametrization, which we refer to as CRconverted gLV models, was motivated by the successful recapitulation of experimental time series statistics with our CR model. The CR model can be rewritten as a gLV model when resource consumption rates are similar to the mean value (Good et al., 2018). Under this assumption, the mapping is ${r}_{i}=2{\sum}_{j}{R}_{ij}{Y}_{j,0}$ and ${A}_{ij}=\frac{1}{{R}_{\text{max}}}{\sum}_{k}{R}_{ik}{R}_{jk}{Y}_{k,0}$ . The converted interaction coefficients are negative and symmetric, and their magnitudes depend on the niche overlap between the interacting taxa. Since the resource levels ${Y}_{j,0}$ are involved in this parametrization, fluctuations in ${Y}_{j,0}$ across sampling times $T$ translate into fluctuations in ${r}_{i}$ and ${A}_{ij}$ .
In the second parametrization, ${r}_{i}$ and ${A}_{ij}$ were randomly drawn from normal distributions with means and variances equal to those in the CRconverted gLV model. ${A}_{ij}$ were forced to be negative and symmetric.
The gLV models were initialized with equal relative abundances for all taxa, and simulated for a fixed amount of time such that a similar range of relative abundances was generated as in the CR model at approximate ecological steady state.
Analysis of 16S amplicon sequencing data
Request a detailed protocolRaw 16S sequencing data from David et al., 2014; Song et al., 2020, were downloaded from the European Nucleotide Archive and the Sequence Read Archive, respectively, and ASVs were extracted using DADA2 (Callahan et al., 2016) with default parameters. OTUs or ASVs from other studies were downloaded and analyzed in their available form. All code for data processing is available in the repository listed above.
Data availability
The current manuscript is a computational study, so no data have been generated for this manuscript. Modelling code is uploaded at https://bitbucket.org/kchuanglab/consumerresourcemodelformicrobiotafluctuations/.

EBIID ERP006059. Host lifestyle affects human microbiota on daily timescales.

NCBI BioProjectID PRJNA637322. Daily Vaginal Microbiota Fluctuations Associated with Natural Hormonal Cycle, Contraceptives, Diet, and Exercise.
References

KBase: The United States Department of Energy Systems Biology KnowledgebaseNature Biotechnology 36:566–569.https://doi.org/10.1038/nbt.4163

Moving pictures of the human microbiomeGenome Biology 12:R50.https://doi.org/10.1186/gb2011125r50

Diet dominates host genotype in shaping the murine gut microbiotaCell Host & Microbe 17:72–84.https://doi.org/10.1016/j.chom.2014.11.010

MacArthur’s consumerresource modelTheoretical Population Biology 37:26–38.https://doi.org/10.1016/00405809(90)90025Q

Diverse communities behave like typical random ecosystemsPhysical Review. E 104:034416.https://doi.org/10.1103/PhysRevE.104.034416

The longterm stability of the human gut microbiotaScience (New York, N.Y.) 341:1237439.https://doi.org/10.1126/science.1237439

Two dynamic regimes in the human gut microbiomePLOS Computational Biology 13:e1005364.https://doi.org/10.1371/journal.pcbi.1005364

Emergent simplicity in microbial community assemblyScience (New York, N.Y.) 361:469–474.https://doi.org/10.1126/science.aat1168

Macroecological dynamics of gut microbiotaNature Microbiology 5:768–775.https://doi.org/10.1038/s4156402006851

Compositional LotkaVolterra describes microbial dynamics in the simplexPLOS Computational Biology 16:e1007917.https://doi.org/10.1371/journal.pcbi.1007917

Higher temperatures generically favour slowergrowing bacterial species in multispecies communitiesNature Ecology & Evolution 4:560–567.https://doi.org/10.1038/s4155902011265

Modeling microbial metabolic tradeoffs in a chemostatPLOS Computational Biology 16:e1008156.https://doi.org/10.1371/journal.pcbi.1008156

Modeling microbial crossfeeding at intermediate scale portrays community dynamics and species coexistencePLOS Computational Biology 16:e1008135.https://doi.org/10.1371/journal.pcbi.1008135

Decoupling function and taxonomy in the global ocean microbiomeScience (New York, N.Y.) 353:1272–1277.https://doi.org/10.1126/science.aaf4507

Polarization of microbial communities between competitive and cooperative metabolismNature Ecology & Evolution 5:195–203.https://doi.org/10.1038/s41559020013534

Microbial coexistence through chemicalmediated interactionsNature Communications 10:2052.https://doi.org/10.1038/s4146701910062x

Public good exploitation in natural bacterioplankton communitiesScience Advances 7:eabi4717.https://doi.org/10.1126/sciadv.abi4717

Metabolic TradeOffs Promote Diversity in a Model EcosystemPhysical Review Letters 118:028103.https://doi.org/10.1103/PhysRevLett.118.028103

Gut microbiota in health and diseasePhysiological Reviews 90:859–904.https://doi.org/10.1152/physrev.00045.2009

A macroecological theory of microbial biodiversityNature Ecology & Evolution 1:107.https://doi.org/10.1038/s415590170107

Deciphering functional redundancy in the human microbiomeNature Communications 11:1–11.https://doi.org/10.1038/s41467020199401

Collective Phase in Resource Competition in a Highly Diverse EcosystemPhysical Review Letters 118:048103.https://doi.org/10.1103/PhysRevLett.118.048103

Role of root microbiota in plant productivityJournal of Experimental Botany 66:2167–2175.https://doi.org/10.1093/jxb/erv157

Adaptive Evolution within Gut Microbiomes of Healthy PeopleCell Host & Microbe 25:656–667.https://doi.org/10.1016/j.chom.2019.03.007
Article and author information
Author details
Funding
National Institutes of Health (F32 GM14385901)
 PoYi Ho
National Institutes of Health (R01 AI147023)
 Kerwyn Casey Huang
National Institutes of Health (NIH RM1 GM135102)
 Kerwyn Casey Huang
Alfred P. Sloan Foundation (FG202115708)
 Benjamin H Good
National Science Foundation (EF2125383)
 Kerwyn Casey Huang
The funders had no role in study design, data collection and interpretation, or the decision to submit the work for publication.
Acknowledgements
We thank members of the Huang lab and Lisa Maier, Rui Fang, Jie Lin, and Felix Wong for helpful discussions. We thank Stephanie Song and Nicholas Chia for sharing metadata. This work was funded by a Stanford School of Medicine Dean’s Postdoctoral Fellowship (to PH), NIH F32 GM14385901 (to PH), an Alfred P Sloan Research Fellowship FG202115708 (to BHG), a Stanford Terman Fellowship (to BHG), NSF grant EF2125383 (to KCH), NIH Award R01 AI147023 (to KCH), and NIH Award RM1 GM135102 (to KCH). KCH and BHG are Chan Zuckerberg Biohub Investigators.
Version history
 Preprint posted: May 14, 2021 (view preprint)
 Received: November 1, 2021
 Accepted: March 24, 2022
 Version of Record published: April 11, 2022 (version 1)
Copyright
© 2022, Ho et al.
This article is distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use and redistribution provided that the original author and source are credited.
Metrics

 1,697
 Page views

 268
 Downloads

 21
 Citations
Article citation count generated by polling the highest count across the following sources: Crossref, PubMed Central, Scopus.
Download links
Downloads (link to download the article as PDF)
Open citations (links to open the citations from this article in various online reference manager services)
Cite this article (links to download the citations from this article in formats compatible with various reference manager tools)
Further reading

 Ecology
The bacterium responsible for a disease that infects citrus plants across Asia facilitates its own proliferation by increasing the fecundity of its host insect.

 Ecology
 Evolutionary Biology
In the unpredictable Anthropocene, a particularly pressing open question is how certain species invade urban environments. Sexbiased dispersal and learning arguably influence movement ecology, but their joint influence remains unexplored empirically, and might vary by space and time. We assayed reinforcement learning in wildcaught, temporarily captive core, middle, or edgerange greattailed grackles—a bird species undergoing urbantracking rapid range expansion, led by dispersing males. We show, across populations, both sexes initially perform similarly when learning stimulusreward pairings, but, when reward contingencies reverse, male—versus female—grackles finish ‘relearning’ faster, making fewer choiceoption switches. How do male grackles do this? Bayesian cognitive modelling revealed male grackles’ choice behaviour is governed more strongly by the ‘weight’ of relative differences in recent foraging payoffs—i.e., they show more pronounced risksensitive learning. Confirming this mechanism, agentbased forward simulations of reinforcement learning—where we simulate ‘birds’ based on empirical estimates of our grackles’ reinforcement learning—replicate our sexdifference behavioural data. Finally, evolutionary modelling revealed natural selection should favour risksensitive learning in hypothesised urbanlike environments: stable but stochastic settings. Together, these results imply risksensitive learning is a winning strategy for urbaninvasion leaders, underscoring the potential for life history and cognition to shape invasion success in humanmodified environments.