Modeling, simulation, and analysis of interacting agent systems is a broad field of research, with existing approaches reaching from informal descriptions of interaction dynamics to more formal, mathematical models. In this paper, we study agent-based models (ABMs) given as continuous-time stochastic processes and their pathwise approximation by ordinary and stochastic differential equations (SDEs) for medium to large populations. By means of an appropriately adapted transfer operator approach, we study the behavior of the ABM process on long time scales. We show that, under certain conditions, the transfer operator approach allows us to bridge the gap between the pathwise results for large populations on finite timescales, i.e., the SDE limit model, and approaches built to study dynamical behavior on long time scales like large deviation theory. The latter provides a rigorous analysis of rare events including the associated asymptotic rates on timescales that scale exponentially with the population size. We demonstrate that it is possible to reveal metastable structures and timescales of rare events of the ABM process by finite-length trajectories of the SDE process for large enough populations. This approach has the potential to drastically reduce computational effort for the analysis of ABMs.
This article provides a lucid mathematical framework for describing and analyzing social interaction dynamics as described by agent-based models (ABMs) including standard models for opinion formation or spreading of infectious diseases on social networks. For the setting of a moderate population size (i.e., many but not infinitely many agents), an approximative stochastic model is analyzed which, in contrast to the commonly used deterministic mean-field limit, exhibits stochastic effects like metastable behavior and can be used for studying timescales of rare transitions. The theory of large deviations is used to characterize these rare events completely for both the agent-based model and its stochastic approximation. Our results are significant for the field of research because they enable a twofold decrease of computational effort when studying systems of interacting agents, which will considerably expand the possibilities of their analysis.
I. INTRODUCTION
Social dynamics and collective social phenomena arise in systems of multiple agents that act and interact, often based on incomplete information, within a social network embedded in a common environment, which can be given by geographical conditions, infrastructure, resources, etc., as well as by norms, rules, and narratives. An agent can represent an individual, a household, firm, political or administrative organization, or any type of discrete entity. A wide range of applications, such as innovation spreading (e.g., Ref. 1) or infection kinetics (e.g., Ref. 2) is addressed, using a wide spectrum of methods from data-based micro-simulation of synthetic populations (e.g., Ref. 3) to abstract individual-4 and agent-based models (ABMs) for studying underlying dynamic mechanisms. Comparatively, compact models of social dynamics are present especially in the fields of socio- and econonophysics (see, e.g., the recent special issue “From statistical physics to social sciences”).5 A prime application lies in opinion dynamics, a field that goes back to the introduction of the voter model by Clifford and Sudbury6 in the 1970s, and later on obtained its name by Holley.7 The basic idea is that agents imitate the opinion of neighbors. Various modifications in the representation of opinions, imitation details, and the interaction structures exist (see, e.g., Refs. 8–10 for recent overviews). Throughout the paper, we focus on basic ABMs of this kind.
While the focus on the individuals in social systems and their interactions was proposed as early as 1957 by Orcutt,11 only in the 1990s, motivated by the increasing computing power, computer simulations of the resulting dynamics became a commonly used tool. Also nowadays, many models are implemented with the help of (often object-oriented and discrete-time) software frameworks for agent-based modeling (see, e.g., Ref. 12). Not always the model is precisely specified beforehand. The basics of an ABM are easily communicable, e.g., to stakeholders, as individual (inter)action rules at the microlevel and stepwise simulation of the overall system’s dynamics can be explained without requiring mathematical expertise of the audience. However, the great freedom of the modeler in defining details can make model documentation a challenge.13 One point that often remains ambiguous in ABMs with a discrete time step—which is the overwhelming majority—is scheduling, that is, which agent(s) influence(s) which other agent(s) in which order in each time step. As Weimer et al.14 point out, most textbooks do not deeply reflect upon this topic15 and models commonly use random interaction orders in each step. In this case, the question arises whether agents “see” the changes already made within the same time step by other agents acting earlier. For parallelization of the ABM simulation, this may lead to problems, however. When considering an ABM to be a representation of a real-world social system, time discretization into steps in which each agent acts once is anyhow somewhat artificial. As an alternative to the discrete-time description of ABMs, there is a variety of approaches using continuous-time Markov processes (see, e.g., Refs. 16 and 17) a corresponding software framework is proposed in Ref. 18. In this paper, we will adopt this continuous-time description, not only because it allows us to circumvent the scheduling problem but mainly because it simplifies the mathematical approach taken herein.
Whether we consider simulation-oriented and rather informal ABMs or more precise mathematical modeling approaches for interacting agent dynamics, we always have to face severe practical and theoretical challenges if the number of agents and/or the timescale of interest become large. With increasing and/or , the computational effort increases drastically (in terms of operations per time step and in terms of the total number of time steps required), which renders simulation-based analysis of the dynamics practically infeasible for ABMs with very large and/or .
Since the emergence of ABMs, several approaches have been discussed for meeting this challenge. The most prominent ones consider
the large population limit for not too large, -independent timescale by constructing appropriate limit equations that describe the effective dynamics of the ABM but themselves are much less demanding computationally and analytically, or
the behavior of the ABM on exponentially long timescales via WKB approximations (after Wentzel, Kramers, and Brillouin) or the large deviation principle (LDP).
There are a lot of results and remarks on the relation between (A) and (B), but the picture is far from being complete. This article contributes to making the picture clearer. In particular, it bridges the gap between (A) and (B) by means of the so-called transfer operator approach. For the sake of comprehensibility, the subsequent considerations will be limited to a voter model like network-based form of ABMs without any spatial component.
The main well-known result with regard to (A), the large population limit, is the insight that, for large , the ABM (described as Markov jump process) can be approximated by a closed system of ordinary differential equations (ODE or mean-field ODE).19,20 As we will see later, this is a pathwise result, i.e., the rescaled trajectory (e.g., given by opinion percentages) of the ABM converges to the trajectory of the ODE system for for a fixed finite time interval . For moderately large , one will see deviations between the trajectories that are due to the stochastic fluctuations of the ABM dynamics. These fluctuations can be included into the description by an extension of the ODE system to a stochastic differential equation (SDE),20,21 which allows us to reproduce the fluctuations up to second order. Since the ABM process and the SDE process are of stochastic nature, it is often omitted that this is a pathwise result for medium to large and fixed finite time interval , too, as we will also discuss in more detail below. In most articles on the subject, the SDE-based description is not discussed directly, but instead in terms of a mean-field approximation leading to the corresponding Fokker–Planck equations (see, e.g., Refs. 8 and 22).
When there is dynamical behavior on timescales that scale exponentially with , i.e., , case (B) from above, formal approaches via asymptotic expansions using the well-known WKB method23 or by means of the mathematically more rigorous large deviation principle (LDP)24 allow us to accurately characterize the associated rare events as remote tail events. That is, there are rare events that appear with very small probability as large deviations from the expected dynamical behavior of the ABM. As one example, we consider ABM dynamics, which exhibit so-called metastable sets or states to which the process is attracted for long periods of time before the rare event of an exit from the metastable sets and into another one occurs. For social systems, understanding such rare events can be of great interest because they should be avoided (e.g., an outbreak of pandemics or riots) or because, on the contrary, a transition is desirable (e.g., a shift to environmentally friendly technologies or healthy lifestyles). Often, the respective rare events, e.g., switching between metastable sets, cannot be described by the mean-field ODE, which typically exhibits asymptotically stable fixed points instead of metastable sets. Thus, the ODE system often is irrelevant for studying the behavior of the ABM on the longest timescales. As we will see below, the rare events can be understood and characterized by LDP-based analysis, at least in theory. However, for large , the necessary computations often are infeasible in practice. As has been observed and discussed in the literature,25 in some cases, they can be replaced by LDP-based computations for the associated mean-field SDE, at least under certain precautions that will be discussed below in detail.
The connection between (A) and (B) lies in understanding the behavior of the system on long (but not necessarily exponential) timescales connected to metastability. For this case, several approaches utilizing transfer operators have been developed, e.g., so-called Markov state models (MSMs).26,27 We will show how to adapt and use them for studying ABM dynamics. As the main result, these techniques will allow us to use results from (A) in order to characterize rare events on long timescales for (fixed) medium or large and to understand how this characterization is related to (B). Similar questions related to metastability have already been discussed in the literature, mainly for (discrete-time) Markov chain approaches,28 and via the Fokker–Planck equation.29 Herein, we will provide new insights illustrated by specific examples. The main point is that MSM building and related techniques like extended dynamic mode decomposition (EDMD)—see Ref. 30 for a recent overview—require many short trajectories of finite length only, allowing, e.g., for parallel computing to determine quantities of interest.
The paper is structured as follows: the agent-based model and its continuous-time description as a transition jump process are introduced in Sec. II. A guiding example reappears in Secs. III–V for illustration. We rescale the transition jump process and consider the large population limit processes given by ODE and SDE systems. Next, long timescales and metastability are discussed and illustrated in Sec. III by means of the transfer operator approach. Using MSMs and the projected transfer operator, we characterize mean first exit times. These reappear in Sec. IV, where we analyze rare events on exponentially long timescales using LDP-based approaches. We address the advantages and limitations arising in both approaches. Finally, open questions and future work are discussed in Sec. V.
II. MODELING INTERACTING AGENT SYSTEMS
The starting point in this paper is a continuous-time ABM without spatial resolution where agents are nodes in an interaction network, similarly to the discrete-time model given in Ref. 31. In analogy to the term interacting particle system, which is used in the context of chemical reaction networks, we also refer to the considered model as an interacting agent system. Each agent can switch according to given transition rules between finitely many states (called types). If the type space is and we consider agents, then the state space of the ABM is , i.e., its size grows combinatorially like , which poses a problem when becomes very large.
Alternatively, the ABM can be described via the population state, which counts the number of agents for each of the available types. That is, the size of population state space scales asymptotically like in the worst case. For the basic case of homogeneous agents and a complete interaction network, or if agents randomly interact with each other, the population space description is exact, otherwise it already entails an approximation due to aggregation. In the following, we assume completeness of the interaction network for the sake of simplicity. Then, the ABM transition rules between the types imply transition rules between population states. The associated propensities depend on the total population state.
The temporal evolution of the population state is given by the Markov jump process, called transition jump process or ABM process, and can be characterized by a master equation, in direct analogy to the reaction jump process considered in the context of chemical reaction systems. By applying Gillespie’s algorithm32 for the numerical simulation of the transition jump process, the problems of scheduling described above are naturally avoided. However, these simulations become computationally intensive for settings with numerous agents.
A. The agent-based model
The considered system of interacting agents consists of
a fixed number of agents,
a set of types available to the agents, i.e., at any point in time each agent owns one of these types,
a set of transition rules defining possible changes of the agents’ types, i.e., representing actions of and interactions between agents,
a set of propensity functions specifying the rates at which transitions randomly occur depending on the population state.
In the agent-based context, transition rules are mostly described from the perspective of a single agent; they may also be referred to as update rules or decisions. To completely specify the dynamics, in this case, also a description of the interaction patterns and update orders (scheduling) is needed. Here, we adopt the formulation used commonly in the chemical context that takes a system level perspective, leading to a simpler and more transparent description: each transition rule is represented by an equation of the form
with the coefficients denoting the numbers of agents of each type involved in the transition as input and output interaction partners (see Example II.1). In order to ensure that the total number of agents is not changed by such a transition, we assume for each . The associated vector is defined by
and describes the net change in the number of agents of each type due to transition . Note that different transitions can lead to identical net changes, accounting, e.g., for different social mechanisms inducing a specific change. The population state of the system (i.e., the system state) is given by a vector of the form
where refers to the number of agents of type . As the total number of agents is assumed to be constant, the population state space33 is given by
Each transition induces an instantaneous change in the population state of the form
which may occur at any point in time . The probability for transition to happen in an infinitesimal time step is given by , where is the propensity function of this transition. We assume the propensity to be proportional to the number of combinations of interacting agents in , and, moreover, to scale with the total population size .
(Extended voter model: Imitation and exploration)
The above description has been limited to the case of a complete interaction graph for the sake of simplicity. Generalizations are possible, e.g., by weighting the edges in the graph or by forming the interaction network out of some weakly connected, complete components or clusters. In these cases, the form of the propensity functions and perhaps the definition of the state space need to be adapted, but the general setting remains the same.
B. The ABM process
One way to describe the temporal evolution of the system is to formulate a continuous-time stochastic process ,
with denoting the number of agents of type at time . The process is a Markov jump process, i.e., it is piece-wise constant, with jumps of the form
occurring at random jump times. The waiting times between the jumps follow exponential distributions determined by the propensity functions. Let denote the probability to find the system in state at time given some initial state . In order to describe the time-evolution of the system, we consider the Kolmogorov forward equation of the transition jump process , which is given by
where we set and for in order to exclude terms in the right-hand side of (2) where the argument contains negative entries. In the context of chemical reaction networks, (2) is called chemical master equation.37
Alternatively, the evolution of the probability can be described by the transfer operator acting on functions of as
That is, the transfer operator is the evolution operator generated by the master equation with denoting the operator on the right-hand side of (2). Generally, the master equation (2) cannot be solved analytically. Instead, the process’ distribution is typically estimated by Monte Carlo simulations of the underlying Markov jump process , which may be generated using Gillespie’s stochastic simulation algorithm.32 With an increasing population size , the jumps in the population process occur more and more often, while the size of an individual jump relative to the agent numbers decreases. In particular, in social systems, it is also obvious that in a larger system, more actions take place and that generally the influence of the single agent diminishes. Stochastic simulations of the jump process using Gillespie’s algorithm become inefficient for large , since they track each of the individual stochastic jump events, and thus time advance in each iteration becomes extremely small. Thus, simulation of the ABM process may become computationally infeasible for very large values of .
C. Population limits for finite time intervals
For large , an appropriate rescaling of the dynamics may lead to effective approximate dynamics given by stochastic or ordinary differential equations. In what follows, we summarize the corresponding results, which are mainly based on the law of large numbers and the central limit theorem.
Let denote the transition ABM process as defined in Sec. II B given the total number of agents. Also, for the propensity functions, we now use the notation in order to indicate their dependence on . We introduce the relative frequencies and rewrite the master equation (2) of the interacting agent system in terms of the frequency-based probability distribution
together with the propensities
where denotes the smallness parameter. Then, with adapted notation, the master equation (the forward Kolmogorov equation) reads
The transfer operator associated with the rescaled process will be denoted by , i.e., where denotes the generator of the rescaled master equation (3).
It is well-known that in the limit and assuming convergence of the scaled propensity functions , the rescaled jump process converges to the frequency process given by the ODE,
with initial state .38 The order of convergence is given by ,20,38 i.e., we have the pathwise approximation
for every finite and an a.s. finite constant , both independent of , where will, in general, depend on . Here, refers to the Euclidean norm (or any other norm) on .
A higher order approximation can be obtained by considering the stochastic Langevin process given by the SDE,
which, in the context of chemical reaction kinetics, is known as the chemical Langevin equation.39 Here, , , are independent Brownian motion processes. For the pathwise approximation error, one gets from20,21 that
for finite and an a.s. finite constant , both independent of , again as above. Also, the estimate is a pathwise result again. It is valid if in (5), one uses a realization of the Brownian motion that is adapted to the realization of the rescaled Poisson process used for the jump process, for details visit.20 Note that these approximation results only hold for finite time intervals that are independent of .
Another commonly used approach to approximate the ABM process defined by the master equation (2) is the linear noise approximation given by the leading-order term of the corresponding system size expansion. In contrast to the ODE limit model, both the non-linear SDE approach given by (5) and the linear noise approximation allow us to recover not only distributions of the ABM process but also power spectra, which provide a means to detect oscillations as given, e.g., in predator–prey cycles.40,41 As for estimations of the systems first- and second-order moments, however, the non-linear SDE approach turns out to be more accurate than the linear noise approximation.42
The Fokker–Planck equation associated with the SDE limit process (5) has the form
with
(see Ref. 8 for the discrete-time case). The forward transfer operator associated with the SDE limit process again is the evolution operator
generated by the Fokker–Planck equation , that is, by the operator on the right-hand side of Eq. (7). Just as the master equation of the Markov jump process, also the Fokker–Planck equation (7) in general cannot be solved analytically. However, trajectories of the Langevin process may be generated using the standard Euler–Maruyama scheme. Here, possible stepsizes are asymptotically independent of the population size , which makes the model more efficient than the jump process model if the number of agents is large.
Under some technical conditions (e.g., regarding growth of and at infinity), a unique invariant measure (stationary density) exists, however, perhaps only on the accessible part of the state space. The SDE dynamics is reversible (i.e., satisfies detailed balance with respect to this measure) under some technical conditions (e.g., growth at infinity), if and only if there exists a smooth function such that43
with the more explicit form
If a solution with sufficient growth at infinity exists, the invariant measure of the SDE dynamics (more exactly the density associated with it) is given by
where is a normalization factor.
In order to motivate the investigations in Sec. III, we now calculate the invariant measure for the guiding example depending on , observing that its properties cannot fully be explained by large population limits.
(Limit SDE and ODE for two types of agents)
Invariant measure of SDE dynamics for , , and . Red/solid: , blue/dashed: , and green/dotted: .
Invariant measure of SDE dynamics for , , and . Red/solid: , blue/dashed: , and green/dotted: .
Independent simulations of (a) the ABM process and (b) the SDE process for the dynamics of Example III.1 showing agent numbers instead of opinion percentages. Two types and , agents, and . The fixed point of the ODE process is . Clearly, the ODE process cannot approximate the ABM process, since it is not able to exhibit a metastable behavior; the fixed point is asymptotically stable.
Independent simulations of (a) the ABM process and (b) the SDE process for the dynamics of Example III.1 showing agent numbers instead of opinion percentages. Two types and , agents, and . The fixed point of the ODE process is . Clearly, the ODE process cannot approximate the ABM process, since it is not able to exhibit a metastable behavior; the fixed point is asymptotically stable.
Let us shortly return to Example II.1 with two types. By setting , , the limit ODE has one stable fixed point , and one unstable fixed point referring to the trap state of the ABM dynamics. For appropriate initial values, the ODE limit dynamics converges asymptotically to the stable fixed point and will stay there unconditionally. The SDE and ABM dynamics will behave similarly for large and finite time interval. However, on very large time intervals (scaling exponentially with ), both the ABM process and the SDE process will rarely deviate from the narrow cylinder around the stable fixed point, approach and finally end up in the trapping state.
III. TRANSFER OPERATOR APPROACH
For appropriately chosen rate constants and , the ABM process of the guiding example given in Sec. II A can exhibit metastable behavior, where one type predominates the population for a long period of time before another type will take over eventually and then dominates for another long period of time. In many (but not all) cases for moderate to large , such metastable behavior can be reproduced by the SDE limit process, while the ODE limit process often fails to reproduce it. As finite timescales (i.e., independent of ) may not be sufficient to understand this, we first introduce the transfer operator approach to metastability and then show how it can be applied to the ABM and limit SDE process.
A. Transfer operators and dominant timescales
In the following, we will consider the transfer operators of the transition jump (ABM) process and of the corresponding limit SDE, where the subindex indicates for which number of agents the respective dynamics is considered.
For the next step, we assume that both the ABM dynamics and the SDE limit dynamics are (geometrically) ergodic on the respective accessible state space, and there are respective invariant measures , respectively . Moreover, we assume that both kinds of dynamics are reversible. This assumption makes most of the following constructions much shorter and easier to comprehend because, for reversible dynamics, the associated transfer operators are self-adjoint in the Hilbert space (with or , respectively) and thus possess real-valued spectral decompositions. The assumption of reversibility is not necessary; without it, one has to replace real-valued spectral decompositions by the more involved complex ones, alternatives like the Schur decomposition44 or the respective singular value decompositions.
a. Predominant eigenvalues
Let be the eigenvalues of , sorted by decreasing absolute real value, and the corresponding eigenfunctions, where . Under our assumptions, it holds that is independent of , isolated and the sole eigenvalue with absolute value . Furthermore, . The subsequent eigenvalues satisfy for some , , and thus decrease monotonously to zero both for increasing index and time. That is,
The associated eigenfunctions can be interpreted as sub-processes of decreasing longevity in the following sense: Given a function and lag time with , , then
since there exists an index such that for all and all . Hence, the major part of the information about the long-term density propagation of the ABM dynamics is encoded in the dominant eigenpairs. The timescales associated with the dominant eigenvalues , are called dominant timescales and given by
where is independent of , since the transfer operator exhibits an infinitesimal generator, and, therefore,
For the SDE transfer operator , we denote the eigenvalues by , and the eigenfunctions by with . The same relation concerning the dominant timescales holds.
The ABM transfer operator acts on functions on the rescaled population space , while acts on functions . In general, the size of these function spaces prohibit efficient computation of the dominant eigenvalues. Therefore, one considers projected transfer operators instead.
b. Projected transfer operators
We make the following considerations for the transfer operator of the ABM process; however, analogous statements hold for the transfer operator of the SDE process. The projected transfer operator with respect to a subspace is the operator , where denotes the orthogonal projection of the original function space of to with respect to the appropriate scalar product . If is finite-dimensional and spanned by the functions , , then
The most prominent case is that of subspaces spanned by indicator functions , where is one on a set and zero outside and the , , form a complete, non-overlapping partition of the respective state space. In this case, called the box discretization of the transfer operator, the projected transfer operator has a matrix representation denoted , with entries
where the subindex means that initial values are distributed due to the respective invariant measure , or , respectively, and the respective ABM or SDE process. The matrix representation of the projected transfer operator is stochastic. Its entries can be approximated by starting trajectories of the respective process in each box. Let , be initial values distributed due to and the final point of a -long realization of the process started in , then
There are a variety of results on how closely the dominant eigenvalues of the projected transfer operator approximate the eigenvalues of the original transfer operator : for example, in Ref. 45, the error is characterized via the projection error induced by , while in Ref. 26 (Thm. 4.16), upper and lower bounds to the error, specific for every complete partition of the respective state space into sets, are given. Moreover, in Ref. 46, the long-term error with is analyzed.
c. Metastability
After these preparations, we can point out the key idea of the transfer operator approach to metastability:26 metastable subsets can be detected via the dominant eigenvalues of the respective transfer operator close to its maximal eigenvalue . Moreover, they can be identified by exploiting the corresponding eigenfunctions , . In doing so, the number of metastable subsets is equal to the number of eigenvalues close to 1, including 1 and counting multiplicity. Weighted with the invariant measure , the dominant eigenfunctions exhibit different sign combinations for each set (see Ref. 26). Alternatively, they allow us to decompose state space into metastable sets by their zeros.47 Then, the asymptotic exit rates from these metastable sets are approximately given by the inverse of the dominant timescales.47
The dominant eigenfunctions also play a major role in the theoretical justification of building so-called Markov state models (MSM).26,27 An MSM is a very low-dimensional reduced model of the full transfer operator with almost the same dominant eigenvalues. For dominant eigenvalues, the Markov states of an MSM are formed by non-negative ansatz functions , that satisfy as closely as possible and thus can be interpreted as macro-states that are almost invariant under the dynamics. More precisely, the are selected such that they form a partition of unity, i.e., , and the projected transfer operator (represented by a matrix) satisfies the condition that its eigenvalues are as close as possible to the dominant eigenvalues of . There are several algorithms for computing these almost-invariant ansatz functions based on the dominant eigenfunctions of , e.g., set-oriented algorithms like milestoning,48 or algorithms approximating a basis of the dominant eigenspace like PCCA+49 (see Example III.1 for more details).
All the previous considerations can be carried out for both the ABM process and the SDE process (replacing by ), independently of . Moreover, for large enough , the respective results of this MSM analysis are very close for the ABM and SDE cases and converge for , which we will see in the following two examples.
(Metastable behavior for two agent types, part 1)
Consider again two types of agents with and .
For , Fig. 2 shows typical long trajectories of the two processes. The ABM process and the SDE process clearly exhibit metastable behavior with at least two metastable areas, one around , the other around . With increasing and with respect to the same finite window in time, this bistability vanishes and the system remains close to the deterministic solution of the limit ODE while short escapes from a narrow cylinder around it become more and more rare.
In order to explain this behavior, we computed the projected transfer operators for the SDE and the ABM process for different numbers of agents () using a box discretization of the one-dimensional state space into uniform boxes ( for and for larger ), and approximating the entries of the respective stochastic discretization matrices via (10) by starting trajectories of length of the respective process in each box. The invariant measures of the respective stochastic discretization matrices are very good approximations of the analytical results for the SDE case as of Fig. 1. Next, the subsequent dominant eigenvalues and eigenfunctions of the resulting stochastic matrices were computed.
Weighted eigenfunctions for (a) the second eigenvalue [ for the ABM process (blue), for the SDE process (red)] and (b) the third eigenvalue [ for the ABM process (blue), for the SDE process (red)]. , and .
Weighted eigenfunctions for (a) the second eigenvalue [ for the ABM process (blue), for the SDE process (red)] and (b) the third eigenvalue [ for the ABM process (blue), for the SDE process (red)]. , and .
Weighted eigenfunctions for (a) the second eigenvalue ( for the ABM process (blue), for the SDE process (red)) and (b) the third eigenvalue [ for the ABM process (blue), for the SDE process (red)]. , , and .
Weighted eigenfunctions for (a) the second eigenvalue ( for the ABM process (blue), for the SDE process (red)) and (b) the third eigenvalue [ for the ABM process (blue), for the SDE process (red)]. , , and .
Second and third eigenvalues for different values of N. Error estimates indicate that the error is about ±0.01 in all cases.
N . | λ2 (ABM) . | (SDE) . | λ3 (ABM) . | (SDE) . |
---|---|---|---|---|
60 | 0.93 | 0.93 | 0.71 | 0.70 |
100 | 0.94 | 0.95 | 0.81 | 0.79 |
200 | 0.95 | 0.95 | 0.86 | 0.86 |
1000 | 0.95 | 0.95 | 0.90 | 0.89 |
N . | λ2 (ABM) . | (SDE) . | λ3 (ABM) . | (SDE) . |
---|---|---|---|---|
60 | 0.93 | 0.93 | 0.71 | 0.70 |
100 | 0.94 | 0.95 | 0.81 | 0.79 |
200 | 0.95 | 0.95 | 0.86 | 0.86 |
1000 | 0.95 | 0.95 | 0.90 | 0.89 |
Illustration of the three -dependent quasi-stationary ansatz functions , , used for building the MSM for the ABM process for . See Example III.1 for further details.
Illustration of the three -dependent quasi-stationary ansatz functions , , used for building the MSM for the ABM process for . See Example III.1 for further details.
d. Mean first exit times
In order to get additional information, we are interested in the expected mean first exit time of the two processes for starting in some box , with and going into some set . Note that and do not need to be metastable sets. The vector of these mean first exit times can be computed by solving
where denotes the submatrix of the discretization matrix of the projected transfer operator (respectively, ) for indices , and the vector of length with all entries having value one. Again, Eq. (11) results from the Galerkin discretization of the respective equation of the full transfer operator.
Given the mean first exit time , we can also compute the vector of associated rates via
We will calculate and compare the mean first exit times in the following example.
(Metastable behavior for two agent types, part 2)
Consider again two types of agents, this time with asymmetric coefficients , , , and .
In this case, the limit ODE has one stable fixed point in , and for large the ABM as well the SDE dynamics will stay in a narrow cylinder around the ODE trajectory on finite time intervals, while this trajectory will converge towards the fixed point.
(a) Invariant measures and (b) weighted second eigenfunctions for the ABM process (blue), and the SDE process (red). , , , , and .
(a) Invariant measures and (b) weighted second eigenfunctions for the ABM process (blue), and the SDE process (red). , , , , and .
We are now interested in the expected mean first exit time for starting in some box , with and going into set . This also gives the mean first exit times from to . Using , we compute the associated rates via (12), which are given in Table II for different values of . We observe impressive similarity between the mean first exit times computed via the ABM and the SDE dynamics. Moreover, we observe that the increase exponentially with and become rather large for large . We will see in Sec. IV how these two observations (the agreement between ABM and SDE and the exponential growth of timescales) can be explained by large deviation theory.
Rates ΦN of the mean first exit times from [0, 0.1] to [0.9, 1] for different values of N. See also Fig. 8.
N . | ηN (ABM) . | ΦN (ABM) . | (SDE) . | (SDE) . |
---|---|---|---|---|
60 | 458 | 0.10 | 440 | 0.09 |
100 | 540 | 0.06 | 530 | 0.06 |
200 | 874 | 0.03 | 885 | 0.03 |
1000 | 22 000 | 0.01 | 22 100 | 0.01 |
N . | ηN (ABM) . | ΦN (ABM) . | (SDE) . | (SDE) . |
---|---|---|---|---|
60 | 458 | 0.10 | 440 | 0.09 |
100 | 540 | 0.06 | 530 | 0.06 |
200 | 874 | 0.03 | 885 | 0.03 |
1000 | 22 000 | 0.01 | 22 100 | 0.01 |
B. Advantages and limits
The closeness between the discretization matrices and of the transfer operators of the SDE and ABM processes for large is due to the pathwise closeness (6) of the SDE and ABM process, which implies
entrywise20,26 for all times in for not too large . If the ansatz space used for the discretization is of dimension , then this means that there is a constant such that
as an asymptotic result, i.e., there is an such that the statement holds for all . This result requires only trajectories of length , with the additional computational advantage that they can be computed in parallel for all boxes. This implies that for large enough , we may characterize the long-term behavior of the ABM process via the discretized SDE transfer operator.
However, the discretizations and have to be computed by means of trajectories via (10) (denoted by ), which introduces an additional sampling error of order in the number of trajectories. Moreover, the discretizations differ from the true transfer operators by the discretization error resulting from using a finite-dimensional ansatz space (see Ref. 45,46) such that in total
where denotes the true ABM transfer operator. Note that this estimate does not require any assumption of a gap in the spectrum of (as often is assumed inappropriately) (see Ref. 50 and, in particular, the discussion in Ref. 46).
Therefore, even for large , metastable structures of the underlying ABM process can be identified by studying only up to the resolution given by the underlying discretization, which may be limited according to computational resources. In particular, if the metastable structures became finer and finer for increasing , one would have to increase resolution by increasing the dimension of the ansatz space with in order to yield sufficient accuracy which, in turn, would mean that we might not be able to reduce the first error term in Eq. (13) sufficiently.
(Potential failure of the SDE approximation)
The above result (13) and its consequences depend on our assumption that all types of agents are there in sufficient numbers. There are cases where the continuous approximation by the SDE process was documented to fail to capture the noise-induced multistability of the discrete ABM process, namely, when the multistability directly stems from the discreteness of the system.51,52 An example from the biochemical context is given by gene expression dynamics with stochastic switches between the gene’s activity and inactivity. For such dynamics, hybrid modeling approaches are demanded, which approximate only part of the process components by an SDE.53 In such cases, at least one species is present in (very) small numbers only; thus, they are not covered by the considerations herein.
IV. LARGE DEVIATIONS
The approximation results of Sec. II C concern the pathwise behavior of the stochastic ABM process on finite time intervals (that do not scale with ). In Sec. III, we went beyond finite timescales but saw that some rare events associated with metastability happen on timescales that grow exponentially with . In this case, i.e., when , the transfer operator approach reaches its limitations due to the increase of dimension of the ansatz space (see Sec. III B). We now investigate these unlikely tail events of the dynamics and their approximation by the SDE process via the LDP.
As for the guiding Example II.1, we will see that (under specific conditions outlined below) there is an approximate agreement of the tail probabilities when comparing the ABM process to the corresponding SDE process. The literature contains results that show that this is not always the case (see, e.g., Ref. 23). We will shed some light on the reasons behind success and failure too. The analysis is done in terms of the rescaled ABM process for , with the corresponding master equation given in (3). Again, denotes the smallness parameter for the sake of keeping the notation that is most prominent in large deviation theory, for which we will now give a brief introduction.
A. Large deviation theory
Let be an (arbitrary, random) path from an appropriate path space [e.g., ] starting in , and let denote the probability distribution generated by the master equation (3), respectively, by the Markov jump process associated with it, or by the SDE limit Eq. (5). Furthermore, let , , denote a specific path from the selected path space [for example, the solution trajectory of the ODE limit system (4)]. Then, we call the large deviation rate function associated with the law if
(see Ref. 54). This is often written in the following, more intuitive form:
where denotes -closeness of the paths and , and asymptotic equality or exponential equivalence, that is,
where the notation means that for . The statement says that the probability to find a solution path that is close to the specific path is exponentially small in with an asymptotic rate given by the rate function . In an alternative way of presenting this, is the path space measure introduced by the dynamics for small : Following Ref. 55, we can write the probability to go from at time to at time using the path integral formalism:
where denotes integration over all paths with and . That is, for small , the exponential factor works as a probability density in the space of paths.
In many cases, expressions for the rate function can be found by constructing its point-wise form , such that the intuitive Eq. (14) becomes
meaning for all . While characterizes the asymptotic behavior of the probability distribution induced by the dynamics in the state space , characterizes the associated probability distribution in the path space . In what follows, we will see how can be computed for the ABM process (3) and for the SDE (5). We will present just the essential results; there are rigorous construction techniques for the rate functions like the Feng–Kurtz54 or the Gärtner–Ellis56 methods (see Ref. 24). Furthermore, there are several other asymptotic techniques for studying exponentially small probabilities for master and Fokker–Planck equations in the sense of Eq. (15), e.g., WKB theory or eikonal approximations (cf. Ref. 23,25).
1. Large deviation rate function of the jump process
with a rate function for which one can derive a Hamilton–Jacobi equation of the form
with the Hamiltonian function
for (see Ref. 24 for a review over the underlying theory). In terms of the Lagrangian,
the rate function can be characterized by
for . Unfortunately, in general, does not have an explicit form.
The generator of the Markov jump process underlying the master equation (3) is the infinitesimal generator of the backward Kolmogorov equation and given by
If denotes the exit time of the Markov jump process from a bounded domain with boundary starting in a state , the mean first exit time or mean first passage time satisfies
with boundary conditions on . When interested in large deviations of the mean first exit time from a bounded domain after starting in , we set
for another rate function , meaning
Large deviation theory results in the following expression for this rate function:24
which can again be expressed via the Hamiltonian defined in (16),
That is, the curves in the phase portrait of the Hamiltonian system associated with the master equation determine the rate function for the mean first exit time. These results show that the Hamiltonian is key to characterize both the large deviation rate function and the (exponentially large) mean first exit time. We will see how to utilize this insight for computing explicitly for a specific case in Sec. IV B.
2. Large deviation rate function of the SDE process
For the SDE process (5) with the density , we consider a rate function such that
Again, there is a Hamiltonian function 23,24 such that
Both rate functions (for the master equation of the ABM process) and (for the SDE limit process) have the same minimum curve, given by the solution of the ODE limit system. Moreover, for small , we have
i.e., the associated Hamiltonian of the SDE limit process is the second-order accurate approximation of the Hamiltonian of the jump process around the ODE limit curve.
This time, the associated Lagrangian can be directly computed if the matrix defined in (8) is invertible,55,57 and the large deviation rate function on path space of the SDE system takes the form
for paths from that start in the initial frequency state , where we set .
The mean first exit time
of the SDE process from a bounded domain after starting in fulfills , where the generator is given by
In this case, one obtains55
which can again be expressed in terms of the Hamiltonian function by
B. Explicit rate functions for specific propensities
We now derive the explicit rate functions for the guiding Example II.1. Consider again two types of agents and a total propensity function
and vectors given by
a. ABM process
The Hamiltonian (16) associated with the master equation reads
and the Lagrangian is defined as
In this case, we have the conservation property for all solutions of the master equation. This implies for the Lagrangian that
where the reduced Lagrangian is given by ()
with and now one-dimensional and . It can be computed explicitly, resulting in
We find, as to be expected, that along the ODE limit trajectory, the solution of the reduced ODE
The rate function for all 1-dimensional paths is
The reduced Hamiltonian reads
Its curves are given by
The phase portrait of and these two curves are shown in Fig. 7(a).
Phase portraits of the reduced Hamiltonian (blue) with curves (red, green) and of the reduced Hamiltonian with curves for (a) the ABM process and (b) the SDE model, respectively. The arrows indicate the direction of the temporal evolution.
Phase portraits of the reduced Hamiltonian (blue) with curves (red, green) and of the reduced Hamiltonian with curves for (a) the ABM process and (b) the SDE model, respectively. The arrows indicate the direction of the temporal evolution.
b. SDE process
When we turn to the SDE large deviation rate function for this specific case, we find that
is not positive (it has an eigenvalue ). Again, this is a consequence of the conservation property , and we have to work with a reduced Lagrangian given by
Moreover, we again observe that along the trajectory of the reduced ODE limit Eq. (18). The associated reduced Hamiltonian reads
so that in accordance with (17). The curves for are given by
The phase portrait of and these two curves are shown in Fig. 7(b).
When comparing Figs. 7(a) and 7(b), we observe that the phase portraits and the curves for of the ABM process and the SDE limit process are almost identical. This means that the respective large deviation rates for the mean first exit time are almost identical.
(Calculation of the rate function)
Mean time to pass from to [more specifically the Monte Carlo estimate of the corresponding rate by simulations of the respective process] for (a) the ABM process (master equation) and (b) the SDE limit process considered in Sec. IV B in comparison to the value of the rate function. Dashed lines: confidence interval for confidence level . The results are in agreement with the results of Example III.2, where identical parameters , , and , were considered. The rates of Table II are indicated by the red markers.
Mean time to pass from to [more specifically the Monte Carlo estimate of the corresponding rate by simulations of the respective process] for (a) the ABM process (master equation) and (b) the SDE limit process considered in Sec. IV B in comparison to the value of the rate function. Dashed lines: confidence interval for confidence level . The results are in agreement with the results of Example III.2, where identical parameters , , and , were considered. The rates of Table II are indicated by the red markers.
Along the green curves in Fig. 7, where , the temporal derivative is positive on the left-hand side of and negative on the right-hand side, while the temporal derivative is constant . Thus, with the ODE solution, we always end up in the fixed point no matter from which side we are approaching. Along the red curve, for , say positive, the derivatives and are positive and we follow the red line upwards to . The direction of the temporal evolution is indicated by arrows in Fig. 7.
C. Deviations of the SDE rates from the ABM rates
In the example analyzed in Sec. IV B, Hamiltonian’s phase portraits of the ABM process and of the SDE process are almost indistinguishable (see Fig. 7) so that the resulting mean first exit times are almost identical. In general, however, the Hamiltonians of the two processes only agree to second order in , such that, for large , there can be deviations (that lead to exponential deviations in the exit times). In such a case, the SDE fails to quantitatively capture the dynamics of the ABM process. Therefore, the characterization of metastable behavior via the SDE process will in general not be enough to understand the metastability of the ABM process quantitatively.
V. CONCLUSION
In this work, we have studied an agent-based model given as a continuous-time Markov jump process and its pathwise approximation by ordinary and stochastic differential equations for medium to large population sizes. The two main insights are: first, the transfer operator approach allows us to uncover metastable structures and long timescales associated with rare events for either the ABM or the SDE processes by means of (many) finite-length trajectories of the corresponding process. Second, for large enough numbers of agents, the metastable structures detected by the transfer operator approach of the ABM and SDE process are very close, such that the characteristics of the long-term behavior of the ABM process can be determined by simulating (many) short trajectories of the SDE process instead (for which the pathwise closeness of the SDE and ABM processes is well-established). This is of major importance for increasing , since simulations of the ABM process may become infeasible due to exploding computational effort, which is not the case for the respective SDE process. However, this approach has important theoretical limitations if metastable structures become finer with increasing (see Sec. III B). In this case, when considering exponentially rare events, large deviation theory allows us to derive equations that characterize the asymptotic rate functions of both the ABM process and the SDE process, which were demonstrated to be close under certain conditions. While the results of Sec. IV require exponentially long timescales (i.e., the results concern only the asymptotic behavior of the processes) and the approximation results summarized in Sec. II hold only for short timescales (i.e., independent of ), the transfer operator approach of Sec. III allows us to consider time scales “in between.” This approach uses the finite time approximation results to derive statements for large times which can—but do not necessarily need to—scale exponentially with (see Sec. III B). In this sense, the transfer operator approach is the bridge between the two concepts (A) and (B) stated in Sec. I.
These theoretical insights are complemented by computational considerations. If aiming at understanding rare events of realistically complex ABM processes on long timescales and for large , large deviation theory might not be helpful for several potential reasons: (a) the associated Hamilton–Jacobi equations cannot be solved efficiently, (b) it is not clear whether we may replace the ABM by the SDE process in large deviation analysis, or (c) it may be difficult to find metastable structures in advance of computing the associated exit or transition rates. In these cases, metastability analysis based on transfer operators provides a useful and practical tool for identifying metastable structures, quasi-stationary distributions, and for approximately computing mean first exit times or transition rates.
Our analysis is restricted to the setting of complete (possibly weighted) communication networks with homogeneous transition rates. The considered model approaches do not distinguish between individual agents, but count the number of agents of each available type (or their concentrations, respectively), assuming that every agent may at any time interact with all other agents. In times of Internet communication and around-the-clock information availability, this assumption is not unrealistic for some interaction systems of interest. However, for many applications, there clearly arise limitations to the interaction opportunities of agents, as, for example, for disease spreading dynamics where the transfer of the disease by infection requires physical contact of agents. Here, more detailed models are required, which take the agents’ environment into account or define (time-homogeneous or time-dependent) incomplete interaction networks. Further investigations will show how the transfer operator approach can be applied to such incomplete or inhomogeneous interaction systems and more complex agent-based models.
ACKNOWLEDGMENTS
This research was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany’s Excellence Strategy MATH+: the Berlin Mathematics Research Center (EXC-2046/1, Project No. 390685689) and through the DFG (Grant No. CRC 1114).
DATA AVAILABILITY
The data that support the findings of this study are available from the corresponding author upon reasonable request.