{'fraction_non_alphanumeric': 0.030144024486895685, 'fraction_numerical': 0.007925446147959881, 'mean_word_length': 5.013475760065735, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modelling dynamics of plasmid-gene mediated antimicrobial resistance in enteric bacteria using stochastic differential equations

The ubiquitous commensal bacteria harbour genes of antimicrobial resistance (AMR), often on conjugative plasmids. Antimicrobial use in food animals subjects their enteric commensals to antimicrobial pressure. A fraction of enteric Escherichia coli in cattle exhibit plasmid-gene mediated AMR to a third-generation cephalosporin ceftiofur. We adapted stochastic differential equations with diffusion approximation (a compartmental stochastic mathematical model) to research the sources and roles of stochasticity in the resistance dynamics, both during parenteral antimicrobial therapy and in its absence. The results demonstrated that demographic stochasticity among enteric E. coli in the occurrence of relevant events was important for the AMR dynamics only when bacterial numbers were depressed during therapy. However, stochasticity in the parameters of enteric E. coli ecology, whether externally or intrinsically driven, contributed to a wider distribution of the resistant E. coli fraction, both during therapy and in its absence, with stochasticities in individual parameters interacting in their contribution.

C ommensal bacteria are ubiquitous and many harbour genetic determinants of antimicrobial resistance (AMR). Commensal enteric bacteria of food animals, in particular, may contaminate meat products or, via manure, the wider environment; in turn, this can result in the transfer of AMR-conferring genes to human microbiota. These genes are often plasmidic, and thus can be passed by bacteria vertically through generations, as well as spread laterally on conjugative plasmids. In mathematical models, the lateral plasmid spread is typically considered as a contagious process, similar to infectious agent transmission in human or animal populations 1,2 . We have proposed a deterministic compartmental mathematical model (using ordinary differential equations, ODEs), describing the dynamics of resistant, those with the AMR-gene plasmid, and sensitive, those free of such a plasmid, commensal Escherichia coli (E. coli) in the large intestine of cattle 3 . The model assumes ''frequencydependent'' plasmid transmission from the resistant to sensitive cells; it also accounts for the population growth of enteric E. coli, their regular replacement due to ingestion and defecation, and the presence of resistant cells among the ingested E. coli 3 .
Models based on ODEs allow for studying the average behaviour for systems comprised of large numbers of individual entities (that is, under the assumption that contributions to the overall system's behaviour due to random differences among the entities is averaged out). The same trajectory of outcome is observed for any given set of starting conditions and parameter values. By allowing the starting conditions and parameters to vary by following certain distributions, one can evaluate the degree of uncertainty in the outcome trajectory. However, the role of chance in the realized outcome trajectory is not captured. As applied to the rates of biological processes in bacterial populations, these approaches may miss some important contributions to the population-level dynamics as illustrated below.
For example, we might assume that there is cell-level randomness in the occurrence of events of a biological process component to AMR dynamics, but its contribution to population-level process rate would be averaged out with a higher numbers of cells engaged. We thus would expect the population-level rate to be more sensitive to stochastic fluctuations during those periods when the cell numbers are lower (e.g., suppressed number of antimicrobial-sensitive enteric E. coli in an animal being treated with the antimicrobial), but closer to the deterministic rate trajectory when the cell numbers are larger. This is similar to the assumptions reflected in the demographic stochastic noise formulation for models of infectious disease dynamics in human and animal populations 4 .
Alternatively, we might assume that the main source of stochasticity in AMR-dynamics is random fluctuation in the values of parameters governing the relevant biological processes, perhaps due to external forces acting on the bacterial population. We then would expect a relatively larger stochasticity in the population-level process rate when there are larger numbers of cells engaged. This is similar to the assumptions reflected in the environmental stochastic noise formulation for models of infectious disease dynamics in human and animal populations 4 . Another term used for this noise type is ''intrinsic'' 5 , since it also can be thought of as reflecting intrinsic randomness in the system parameter values.
The demographic and environmental noise models are stochastic compartmental mathematical models that incorporate random noises in the population-level process rates by using stochastic differential equations, SDEs. We apply these designs to research the potential sources and roles of stochasticity in the dynamics of plasmid-gene mediated AMR among commensal E. coli of the cattle large intestine. We use the exemplar of resistance to a third-generation cephalosporin ceftiofur. We concentrate on plasmid-mediated resistance since plasmids are the most common means of lateral resistance spread between bacteria 6,7 Third-generation cephalosporins is an antimicrobial class of critical importance for human therapeutic options; preventing dissemination of bacterial resistance to these drugs is essential 8 . Resistance to ceftiofur provides for a relatively well-characterized exemplar of plasmid-mediated resistance to a cephalosporin. Further placing this in the context of cattle enteric commensal E. coli we can inquire into the roles which stochasticity plays in the AMR dynamics in bacterial populations in vivo, both in terms of resistance persistence in the absence of antimicrobial pressure, and while the populations are subjected to such pressure.We consider scenarios whereby the animal receives, or does not receive, parenteral therapy with the antimicrobial.

Results
AMR dynamics depending on the assumed sources of stochasticity: in the absence of antimicrobial therapy. The distributions of the fraction of ceftiofur-resistant commensal enteric E. coli at the stochastic equilibrium -in the absence of antimicrobial therapy in the animal -for the demographic noise model formulation, and the formulation with environmental noise in all parameters are given in Figure 1. With both noise formulations, and for either animal model of a beef calf or a dairy cow, the resistant-fraction reached its stochastic equilibrium (i.e., ''stabilized'' around its average) within 6 simulated months (not shown); this was similar to the outcome dynamics with the deterministic model formulation published earlier 3 .
The equilibrium resistant-fraction distribution differed depending on the assumptions made about the main source of stochasticity in the AMR dynamics. First, a narrower outcome distribution with a lower median was observed with the demographic noise when compared to the environmental noise ( Fig. 1a vs. 1b; and 1c vs. 1d). The reason was that the total stochastic fluctuation (diffusion coefficient| j i ) in the random variable of each population-level process rate was proportional to the square root of the deterministic rate with the demographic noise, and to the deterministic rate itself with the environmental noise assumption. Hence, in our system with a large population, relatively larger stochastic fluctuations from the deterministic process rates at each time step occurred with the environmental noise. This agrees with the theory that in large populations the dominant ''error term'' may be expected to be from the environmentally-forced parameter fluctuations 4 .
Second, there was a difference in the medians of the equilibrium outcome distributions between the two model formulations, with a higher median with the environmental noise (Fig. 2, both medians also were slightly higher than the deterministic outcome). This arose from the effects of truncation of the random variables of the processes' rates to their biologically-plausible intervals. In particular, stochasticity in a relatively low event rate, e.g., plasmid transfer or occurrence of resistant E. coli in the cattle ingesta, within a short time step, was more often driving the rate towards 0 (or below 0, and the value was re-set to 0), rather than causing a fluctuation to a higher value. This was similar to the stochastic effects contributing to a higher probability of infectious disease extinction in an animal or human population of a small size. We considered that these behaviours were a property of the modelled system, and therefore report both the ranges and the medians of the simulated outcome distributions.
In other systems with non-linear dynamics, it is possible for stochasticity to introduce changes to the average outcome value through other effects, e.g., through the effects on covariances between the dynamics in fractions of the population engaged in the events (e.g., infected and susceptible to infection individuals), especially in small populations 4 . In our relatively large population this effect was not evident: if the truncation of random variables in either model formulation was removed, the median resistant-fraction was similar to the deterministic outcome (Fig. 2). The environmental noise model formulation was scrutinized to investigate the effects of stochasticities in individual parameters for the outcome. The outcome distributions were compared when different parameters were allowed to be noisy (Fig. 3). All these formulations produced wider outcome distributions when compared to the demographic-noise formulation, the sole exception being when randomness was restricted to the rate of regular replacement of enteric E. coli, c (Fig. 3d). When only the plasmid transfer term, b, was noisy (with, or without, further stochasticity in the fitness cost of hosting AMR-gene-plasmid, a), the outcome distribution demonstrated a higher median compared to when only c (with, or without, the intestinal bacterial growth rate, q), and the fraction of resistant cells among the ingested E. coli, u, were noisy ( Fig. 3a-b vs. c-e). An intermediate value of the median outcome was observed when all the parameters were allowed to vary randomly (Fig. 3f). Hence, stochasticities in the parameters interacted in their contribution to the outcome, with the noise in b acting to increase, but the noises in c and u acting together to decrease the equilibrium resistant-fraction. Because of this, only the all-parameter environmental-noise model formulation was carried forward.
In the all-parameter environmental-noise model formulation, we assumed that proportionality of the stochastic fluctuation to the deterministic rate was the same for all process rates at each time step, and was constant in time (i.e., everyg 0~1 in equations (7)-(8) at every time point). Although no biological information was available to test the assumption of equal proportionality for the rates of different component biological processes, we tested the impact of the assumed proportionality constant value of one. Figure 4 shows the distribution of resistant-fraction in a beef calf (at the system's stochastic equilibrium while in the absence of antimicrobial therapy) depending on the value of g 0 . The trend was that larger stochastic fluctuations allowed for both a wider distribution and a higher median of the resistant fraction across the system realizations (i.e., individual cattle, and their ingesta, which would be formed by the ingested feed, water and production environment).
AMR dynamics depending on the assumed sources of stochasticity: during antimicrobial therapy. The distributions over time of the numbers of total E. coli and resistant E. coli per mL of faecal mass in the large intestine, and of the resistant E. coli fraction, for a beef calf treated with a single injection of a sustained-release ceftiofur preparation, and from the two model formulations are given in Figure 5. Similar outputs for a dairy cow treated for 5 days with daily injections of a non-sustained release ceftiofur preparation are provided in Fig. 6. With both model formulations, the median outcomes over simulations indicated a decrease in the total number of commensal enteric E. coli during therapy (Fig. 5a, 5d, 6a, 6d), with concurrent increases in the number of resistant cells (Fig. 5b, 5e, 6b, 6e) and their fraction among the surviving E. coli (Fig. 5c, 5f, 6c, 6f ).
The demographic noise in the events component to AMR dynamics among the less numerous enteric E. coli during antimicrobial therapy had a larger impact on the distribution of the resistantfraction trajectories (Fig. 5f, 6f) compared to that in the absence of therapy (Fig. 1a), as was expected. The widest distribution of possible trajectories of the resistant-fraction due to the demographic noise ( Fig. 5f, 6f) was at the time during therapy when the total E. coli number was depressed the most (Fig. 5d, 6d). With the environmental noise, an interesting unexpected observation was a transient increase in the number (Fig. 5b) and fraction (Fig. 5c) of resistant cells soon after these quantities began to decline post therapy with a sustained-release antimicrobial preparation. This was observed in a small fraction of the simulations and corresponded to the period when the total number of E. coli was beginning to recover (Fig. 5a). This was likely due to a relatively larger role for stochasticity in the realized dynamics at the beginning of the bacterial population regrowth post therapy.

Discussion
In terms of inference to overall sources of stochasticity in the dynamics of plasmid-gene mediated AMR among cattle enteric E. coli, the model formulations' outputs suggested two possibilities for the role of cell-level randomness in occurrence of the relevant biological events. First, these heterogeneities may serve to lessen the number (Fig. 5e, 6e) and fraction (Fig. 5f, 6f) of resistant enteric E. coli during parenteral antimicrobial therapy in the animal. Using the example of plasmid transfer, the plasmid-donors may be heterogeneous in their rate of contact with sensitive cells, or there may be randomness in the propensity to attempt conjugation upon contact or random interruptions during conjugation that abort plasmid  transfer. When more relevant empirical data become available, b can be partitioned accordingly to develop a more detailed presentation of the sources of stochasticity. Second, in the absence of disturbance of enteric commensals by antimicrobial therapy in the animal, the demographic noise formulation produced a narrow outcome distribution, with the median close to that from the deterministic model formulation. Hence, the cell-level heterogeneities may simply be insignificant for the population-level process rates when large numbers of bacteria are participating (or, are available to participate).
Overall, randomness in the parameters governing the biological processes related to plasmid-gene mediated AMR in enteric commensals, whether originating from external forces acting on the bacterial population to cause parameter fluctuations 4 or else intrinsically 5 , may be contributing to a larger number and higher fraction of the resistant cells. This was observed both in the absence of antimicrobial therapy in the animal (Fig. 1b, 1d), and during therapy ( Fig. 5b-c, 6b-c). Furthermore, stochastic noises in individual parameters of enteric E. coli ecology interacted in their effects on the resistant-fraction; this was investigated in the absence of therapy (Fig. 3). If we think of a model simulation as a system realization, across the simulated 1,000 hypothetical animals with their ingesta, stochasticity in the transfer rate of AMR-gene plasmid(s) among the enteric E. coli contributed to an increase in the resistant-fraction at the system's stochastic equilibrium (Fig. 3a). Environmental stochasticity in the context of bacteria in the faecal mass could arise from variability in the physical matrix of faeces translating into randomness in the rate of contact between the sensitive and plasmid-donor bacteria. An alternative ''force'' could be plasmid ecology (recall the term ''intrinsic'' for this noise type). Different plasmids can carry the same AMR-gene (and this is the case for genes conferring ceftiofur resistance 9,10 ); the transfer rate is plasmid-specific 11,12 . There may be randomness among individual animals in the plasmid profile present and, therefore, in the cumulative plasmid transfer rate among the enteric E. coli, b. Stochasticity in the fitness cost or gain to the cells hosting the AMR-gene plasmid(s) did not appear to contribute to the outcome distribution beyond the contribution from stochastic b (Fig. 3b vs. 3a). Stochasticity in the fraction of resistant among E. coli ingested by the 1,000 hypothetical animals, u, led to a relatively lower median resistant-fraction among their enteric E. coli at the stochastic equilibrium (Fig. 3c); and so did the stochasticity in the rate of regular fractional replacement of enteric E. coli through ingestion and defecation, c (Fig. 3d). For example, u could be random in the feedstuffs delivered to cattle, and the feed composition itself could alter c. In the all-parameter environmental-noise model formulation carried forward in this study, the increase in the fraction of resistant enteric E. coli forced by stochastic b was ''balanced'' by randomness in u and c (compare Fig. 3f with 3a and d). In other words, the stochasticities in these parameters interacted in their contribution to the equilibrium outcome distribution.
During parenteral treatment of cattle with ceftiofur, the median trends in the outputs from both model formulations were a decrease in the total number of commensal enteric E. coli, and increases in the number and fraction of resistant cells among the survivors (Fig. 5-6). Such changes are known to occur during parenteral ceftiofur therapy in cattle [13][14][15][16][17] , and during parenteral therapy in humans with a closely related drug ceftriaxone, another third-generation cephalosporin 18,19 .
Here, we only considered the potential role for the dynamics of randomness in rates of ecological processes of enteric E. coli. That is, the parameters of pharmacodynamics of the drug intestinal metabolites against E. coli, and the metabolite concentrations (obtained earlier with a model of ceftiofur pharmacokinetics 3 ) were kept constant between simulations. Wide distributions (minimum-to-maximum) of trajectories of the number and fraction of resistant enteric E. coli were observed during therapy, with either assuming the demographic or environmental sources of stochasticity in the AMR dynamics (Fig. 5, 6). A recent study used direct experimental observations of population growth from individual bacteria to develop a mathematical model of the process using an alternative mathematical method to reflect the cell-level stochasticities 20 . The study results demonstrated the cell-level heterogeneity in growth potential, and that a wider distribution of the population size trajectories occurs with a lower starting cell number 20 . This agrees with our observation of a distribution of possible trajectories for the population outgrowth of resistant E. coli during therapy. Also, compared to the effects from the demographic noise, randomness in the parameters appeared to contribute to a sharper decrease in the total E. coli number (Fig. 5a vs. 5d; and 6a vs. 6d), and, at its maximum during therapy, a higher median fraction of resistant E. coli among the survivors and its more prolonged presence (Fig. 5c vs. 5f; and 6c vs. 6f ).
We were unable to choose between the stochastic model formulations based on their ability to best reproduce the empirical data (we have previously established that the model in its deterministic formulation is able to reproduce the general trends in the observed dynamics 3 ). The reasons for this were two-fold. First, using the data for the purpose of model-fitting requires an understanding of the measurement error involved, since it acts as a concurrent source of stochasticity for the recorded dynamics 5 . Such understanding was not available. The second reason was insufficient consistency and granularity of the empirical data. The relevant data in the absence of therapy were the estimates of the ceftiofur-resistant faecal E. coli fraction in cattle without a direct connection to ceftiofur treatment. The available estimates for the scenario of a 6-month old beef calf were: 1.8% of E. coli resistant to ceftazidime at a breakpoint $8 mg/ mL in feedlot steers 21 , and 6% resistant to ceftriaxone at a breakpoint $16 mg/mL in 2-6 month-old post-weaned dairy calves (estimated from 16 ). The estimates for the scenario of a dairy cow were: 0.7% of E. coli resistant to ceftazidime at a breakpoint $8 mg/mL across samples from 39 dairy herds 13 , and 7.4% resistant to ceftiofur at a breakpoint $16 mg/mL in dairy cattle 22 . A major inconsistency was the variable antimicrobial concentration cut-offs used to enumerate the sensitive vs. resistant E. coli (i.e, the data from Europe vs. North America). Further, the distributions of sensitivity to these antimicrobials in E. coli with plasmid-gene mediated resistance are not identical 23 . Similar problems exist with estimates of the resistance distribution from field trials of ceftiofur therapy; here also, often the sampling was performed with insufficient granularity -only on certain days post-treatment 13,14,16,17,24 . On the other hand, there is a considerable variability in the dynamics of the number and fraction of ceftiofur-resistant faecal E. coli observed during the trials; this has been recently reviewed in detail by Call et al 25 . This supported our premise that the role of stochasticity in AMR-dynamics may be significant and it allows for a wide distribution of the trajectories of the resistant E. coli number and fraction during therapy (Fig. 5  and 6). However, the granularity of the data did not allow for a formal assessment of which assumptions about the sources of stochasticity in the dynamics (demographic vs. parameter noise) were most relevant.
One also could not consider the contribution of stochasticity to AMR ''extinction'' from enteric E. coli (stochastic models are commonly used to evaluate the probability of infectious disease extinction from a human or animal population). This was because individual membership in the population of enteric E. coli was not stable -the population was routinely ''replaced'' through ingestion and defecation, with the ingested bacteria bringing in the AMR-gene plasmid. Due to stochasticity, the in-flow may be free of such plasmids within certain time steps, however there could be no longlasting ''extinction'' of resistance from the enteric E. coli for as long as the E. coli populations in the cattle feed, water or production environment carry such plasmids. This points to the problems of mitigation of AMR in the E. coli in intensive livestock operations, where the production environment itself can reflect years of AMRgenes buildup, and there is always the potential for new introduction of AMR-genes with the E. coli populations in the water and feed supplied to cattle. Further, lateral gene transfer (e.g., through transconjugation or transduction) across bacterial taxa can introduce AMR-genes to the E. coli in the animate and non-animate habitats within the cattle production systems.
In the SDE-based models used here, bacteria were considered en masse. The system was described with variables representing the dynamical changes in the whole due to each biological process component to the AMR dynamics. How much each process contributed was defined based on current understanding of enteric E. coli ecology and plasmid-gene mediated AMR. The impact of stochasticity in the process rates at the level of the bacterial population then was considered. Other approaches to include stochasticity are the event-driven algorithms for compartmental models 26 , and agent-based models 27 . Building the former for our exemplar system would involve considering each process rate as an event (e.g., plasmid transfer, cell division) with an associated transition probability for a cell in the population's compartment. Building an agent-based model would involve assigning the states and rules of behaviours for individual E. coli. Notably, until very recently bacteria have been studied only as populations. Assigning the competing event probabilities, or the states and behaviours, for individual E. coli would be based on simple extrapolations from the population-level measurements and understanding. For some of the processes contributing to AMR dynamics in enteric commensals, e.g., for biology of plasmid transfer, the celllevel empirical data may accumulate in the near future (and are starting to be used in mathematical models 28,29 ). However, for the other processes, the cell-based knowledge is not realistically foreseeable, e.g., for movement of commensals between their animate and non-animate habitats that determine what fraction of E. coli ingested by cattle carries plasmids with AMR-genes.
For the system of plasmid-gene mediated resistance to a thirdgeneration cephalosporin (ceftiofur) among commensal E. coli of the cattle large intestine, SDE-based models permitted us to learn that randomness in the values of parameters of bacterial ecology between the system ''realizations'' allows for variability in which fraction of E. coli is resistant at the system's stochastic equilibrium in the absence of antimicrobial therapy, and during and following therapy. The contribution from stochasticity in the component event occurrence among individual E. coli appears to be less important in the absence of therapy; this is likely because the cumulative event rates are insensitive to cell-level event probabilities when large numbers of cells participate. However, when the enteric commensal system is disturbed by the antimicrobially active drug metabolites during therapy in the animal, and either the randomness in bacterial ecology parameter values or stochasticity in the events in the cells is present, the resistant-fraction among E. coli surviving in the intestine can follow considerable different trajectories due to the role of chance. This should be taken into account when designing studies to measure the effects that antimicrobial therapies have on enteric commensals. Explicit empirical understanding of such bacterial population variability in the aggregate, and the variability among the animals (enteric ''system realizations'') would help to formally test which sources of stochasticity are most relevant for AMR dynamics within and between the animals. This also shows that deterministic models of AMR dynamics, while helping to elucidate the average system behaviours and responses, may not provide an adequate modelling environment in which to test the potential efficacy of interventions.
Intervention hypotheses need to be tested while accounting for the expected stochasticity in AMR dynamics in vivo.

Methods
Deterministic model. Commensal E. coli were ''free-living'' within the faecal mass of cattle large intestine (model was scaled per mL of the matter), mixing homogeneously, in planktonic mode of growth, with their density-dependent population growth being restricted to a maximum possible number of E. coli, N max . Conceptually, interspecies competition among E. coli and the other enteric commensals was reflected in the presence of N max ; intraspecies competition was reflected in that the antimicrobial sensitive and resistant E. coli were filling N max . The number of resistant E. coli, those with the AMR-gene plasmid, was denoted Nr; the number of sensitive E. coli, those without such a plasmid, was Ns; and the total E. coli was N. Deterministically, the ODEs (1)-(2) described the changes in Ns and Nr over time: Where q was the net E. coli population growth rate in exponential phase, i.e., ''specific growth rate'' in microbiological terms, net result of unobservable bacterial replications and deaths. The restriction on the realized growth due to its densitydependence was modeled using logistic growth model. Resistant E. coli experienced a fitness change; it was defined as a fractional reduction a in q because for E. coli resistance to ceftiofur it tends to be a fitness cost 3 . The plasmid transfer term was b, a product of the contact rate of sensitive cells with resistant, and the probability of completed plasmid transfer to the sensitive cell upon contact. The in-flow of E. coli with ingesta, and out-flow with faeces ensured a regular replacement of the enteric E. coli at a fractional rate c. Fraction u of the in-flowing E. coli were resistant.
General concepts of stochastic noise model formulation. The population-level rate of each biological process represented in equations (1)-(2) was a random variable, realization of a stochastic process. We modelled this using an SDE with diffusion approximation. We wrote SDEs in ODE-form (as Langevin equations). The process rate at time step Dt depended on the variable's deterministic part and its stochastic fluctuation (originating from the stochastic process) from the deterministic value. The deterministic part was defined by the underlying ODE; we refer to this part as the deterministic rate. The fluctuation at Dt was the product of average fluctuation, the diffusion coefficient (whose form depended on model assumptions), and a draw from the stochastic process -the noise term. Stochastic noise was additive; hence, the random variable at Dt was the sum of the deterministic rate and the fluctuation.
Several integration routines are used to iteratively solve SDEs. We adopted a method used in infectious disease modelling 4 . For a random variable i, at each Dt, the noise term j i was obtained by randomly sampling a number from the standard normal distribution and scaling it by the length of Dt, as j i~r andom draw(N(0,1)) ffiffiffiffiffi Dt p 4,30 . The noise-term dynamics corresponded to a random walk 4 . The system was memory-less. The function g specified how the diffusion coefficient was related to the variable's deterministic part; the stochastic fluctuation in variable i at Dt was g i (det er min istic rate i ) Demographic noise model formulation. Here we assumed that main source of stochasticity in the population-level rate of each biological process component to the AMR dynamics was random occurrence of the events in the cells engaged; heterogeneities among both the sensitive and resistant E. coli were contributing to the dynamics; and these contributions (relative to the total process rate) averaged out with larger numbers of cells engaged. That is, randomness in the AMR dynamics was due to ''demographic'' differences in the event occurrences among the cells.
Using the example of plasmid transfer, transfer at a short Dt was expected to be a rare random event in the bacterial population. Hence, the number of transfers at Dt followed a Poisson distribution, and the variance in the number of transfers equaled the mean 4 . The average stochastic fluctuation from the deterministic rate at Dt was the standard deviation of the process, g i~ffi ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi det er min istic rate i p (see also 30 for a derivation of this form of g i for demographic stochasticity). Similar assumptions were true for stochasticity in the other processes' rates. Each rate was a random variable (j i drawn independently for each rate). The SDEs for Ns and Nr for this formulation were: During model simulations, the values of the random variables of the processes' rates were re-set to their biologically-plausible intervals, which were: Parameter noise model formulation. Here we assumed that the main source of stochasticity in the AMR dynamics was from that the system's parameters were noisy, either intrinsically or due to external forces acting on the bacterial population. (In the latter case, randomness in the external-force action translated into randomness in the deviation of parameter values at each Dt.) Hence, the magnitude of the stochastic part of the random variable of each process rate was proportional to the deterministic rate, with a constant proportionality 4 as g i (deterministic rate i )~g i0 |deterministic rate i . Stochasticity resulted from randomness in individual parameters (j i drawn independently for each parameter). The SDEs for Ns and Nr for this noise formulation were: Because the proportionality constants for the rates of component processes were unknown, in order to investigate the effects of stochasticities in individual parameters in this model, we set the simplest case of g 0~1 for every parameter assumed to vary, and g 0~0 for every parameter assumed to be constant (every g 0~1 in the ''full'' model). No information was available to relax the assumption of the same proportionality constant for all parameters; that is, to specify that at a given Dt there was a different magnitude of fluctuation in each parameter. Thus, we kept the same g 0 for all parameters, and investigated model behaviour with different values of this constant, varying it from 0 (no stochasticity) to 2 (the diffusion coefficients twice larger than the deterministic rates at each Dt).
During model simulations, the values of the parameters with noise were re-set to their biologically-plausible intervals, which were: Simulations and software. To calculate each j i , a random number from the standard normal distribution *N(0,1) was drawn at each Dt. The seed for the draws was taken at random from a uniform distribution on the interval (1, 10,000) for each random variable for each model simulation. The time step Dt corresponded to the length of the most frequent of the events in the AMR dynamics (plasmid transfer rate, 3-4 minutes). The models were implemented in VensimH PLE Plus software (Ventana Systems Inc., Harvard, MA, USA), and solved with the Euler algorithm recommended for this noise-term formulation 4 . The simulations with each model formulation were performed 1,000 times for 180 days in the absence of antimicrobial therapy, and 10,000 times from the start of antimicrobial therapy (the system's stochastic equilibrium in the absence or following therapy was reached in this time window; further increasing the numbers of simulations did not change the outcome distribution). When investigating how the output of the all-parameter noise model depended on the constant of proportionality, g 0 , 10,000 model simulations were performed with Latin hypercube sampling of g 0 from a uniform (0, 2) distribution for each simulation 31 . Parameterization. Parameter values were adopted from an earlier literature review 3 . The bacterial ecology parameter values were: enteric E. coli specific growth rate q 5 0.17/hour (for a 4-hour doubling time in the anaerobic intestinal conditions 32 ); fitness cost to Nr a 5 0.05; enteric E. coli fractional in-flow/out flow c 5 0.01/hour; fraction of resistant E. coli in ingesta of a 6-month beef calf u 5 0.011 and of an adult dairy cow 0.0042; maximum viable E. coli/mL faeces N max 5 5.5log; and plasmid transfer term b 5 4*10 23 . In the deterministic model formulation with these parameter values and no antimicrobial therapy, the equilibrium fraction of resistant enteric E. coli (reached within 6 simulated months) was 0.018 in the beef calf and 0.007 in the dairy cow 3 . Two antimicrobial-therapy scenarios were considered: a single injection of a sustainedrelease cefiofur preparation in the beef calf; and five daily injections of a nonsustained ceftiofur preparation in the dairy cow. The estimated concentrations of antimicrobially-active ceftiofur metabolites in the animals' large intestines were available 3 . The parameter values for pharmacodynamics of the metabolites against enteric E. coli were: minimum inhibitory concentration for sensitive E. coli, MICs 5 1 mg/mL, and for resistant E. coli, MICr 5 8 mg/mL; and Hill coefficient, H 5 1.5 3 .
The starting values of Nr and Ns were calculated based on the starting resistantfraction and N max .