A review on aggregation techniques for agent based models: understanding the presence of long-term memory

: A key feature of the agent-based modeling is the understanding of the macroscopic behavior based on data at the microscopic level. In this respect, among the topics of interest, one can found the long term behavior of a system and the assessment of the presence of correlations. The study of the property of long-term memory becomes relevant when past events continue to maintain their influence for the future evolution of a system, and the autocorrelation is decaying slowly. In turn, this is relevant for understanding the reaction of the system to shocks, and further information on the evolution of an economic system can be obtained by analyzing the agents populating the system itself, considering both their heterogeneity and the outcome of their aggregation. The aim of this paper is to review some techniques for studying the long-term memory as emergent property of systems composed by heterogeneous agents. Theorems relevant to the present analysis are summarized and their application in four structural models for long-term memory are shown. The main property of the models is given the functional relation between their parameters and the long memory of the time series under examination. This would allow an immediate calibration of the model avoiding time-expensive numerical calibration procedures, the estimation of their bias, and numerical instabilities. The described approaches can be useful for further expansions and applications in economical and financial models.


Introduction
The presence of long-term memory is a remarkable feature of time series, which are eventually generated by stochastic processes, when the autocorrelation function decays hyperbolically as the time lag increases. The property is relevant because of its reaction to shocks: systems in which the dependence on past events is sufficiently strong are going to need more time to recover from either good or bad shocks than systems with a fast decay of the correlation. Long memory models were introduced in the physical sciences since at least 1950, when some researches in applied statistics stated the presence of long memory within hydrologic and climatologic data.
The earliest studies on this field are due to [43,44,53,54,55] among the others.
Quantitative studies on financial markets have shown the persistence properties of the financial time series. The long-term memory has been evidenced through the analysis of many different time series: speculative returns [14,32], foreign exchange rate returns [4,45,61] and their power transformation [31], and also in stock price time series [3,61,65]. For what concerns the persistence of the prices, this property has been tackled in the context of the agricultural futures by [67], while [24,51] focus on the evidence of long memory in certain stock prices and analyze also the gold market returns. [36] show no consistent pattern of persistence in S&P 500 index futures prices.
The microeconomic explanation of these data is far from being obvious. We are most interested in agent based models for financial time series, and on the composition of possible actions in the market that lead to persistence in the correlation of prices.
Specifically, we aim at reviewing some remarkable theoretical results for assessing the presence of long-term memory. The considered approaches differ from the most part of literature, where the presence of long-term memory is measured through numerical estimates [10,11,49,52,62,68].
Beyond the mere regression on the autocorrelation function, other methods have been developed for the numerical estimate of the long term memory, aiming at shortening the confidence intervals and improving the reliability of results: in this respect, it is worth mentioning the Hurst exponent H, the Detrended Fluctuation Analysis (DFA), the spectrum (within some boundaries). Literature reports also studies on the systematic bias in the over-or under-estimate of specific procedures [7,8,9].
In assessing the long-term memory property, a key role is played by the presence of heterogeneity in the agent-based model. In this respect, for what concerns the specific contest of finance, the interaction among agents leads to an imitative behavior, that can affect the structure of the asset price dynamics. Several authors focus their research on describing the presence of an imitative behavior in financial markets (see, for instance, [6,13,16,26]).
The traditional viewpoint on the agent-based models in economics and finance relies on the existence of representative rational agents. Two different behaviors of agents follow from the property of rationality: firstly, a rational agent analyzes the choices of the other actors and tends to maximize utility and profit or minimize the risk.
Secondly, rationality consists in having rational expectations, i.e. the forecast on the future realizations of the variables are assumed to be identical to the mathematical expectations of the previous values conditioned on the available information set.
Thus, rationality assumption implies agents' knowledge of the market's dynamics and equilibrium, and ability to solve the related equilibrium equations. [63] argues that it seems to be unrealistic assuming the complete knowledge about the economic environment, because it is too restrictive. Moreover, if the equilibrium model's equations are nonlinear or involve a large number of parameters, it can be hard to find a solution.
An heterogeneous agent systems is more realistic, since it allows the description of agents' heterogeneous behaviors evidenced in the financial markets [50] for a summary of some stylized facts supporting the agents' heterogeneity assumption). Moreover, heterogeneity implies that the perfect knowledge of agent beliefs is unrealistic, and then bounded rationality takes place [40].
Brock and Hommes propose an important contribution on this field [17,18]. The authors introduce the learning strategies theory to discuss agents' heterogeneity in economic and financial models. More precisely, they assume that different types of agents have different beliefs about future variables's realizations and the forecast rules are commonly observable by all the agents.
in [18] the authors consider an asset in a financial market populated by two typical investor types: fundamentalists and chartists. An agent is fundamentalist if he/she believes that the price of the aforementioned asset is determined by its fundamental value. In contrast, chartists perform a technical analysis of the market and do not take into account the fundamentals.
More recently, important contributions on this field can be found in [1,25,27,35].
For an excellent survey of heterogeneous agents models see [41].
Aggregation and spreading of opinions give an insight of social interactions. Models that allow for a opinion formation are mostly based on random interaction among agents, and they were refined considering constraints to the social contact, as an example modeled through scale free networks. It has already been shown that the relevant number of social contact in financial markets is very low, being between 3 and 4 [5,60,66], opening the way to lattice-based models.
It is also worth citing also the interpretation of heterogeneity as diversity, in the context of complex systems. The analysis of the diversity have become a remarkable aspect of the decision theory for what concerning the selection of multiple elements belonging to different families of candidates [70].
The possibility to provide theoretical results on the long-term memory of time series generated from heterogeneous agent-based models overcomes at once the problem of the reliability of numerical methods, the time-consuming computational time, the need to run the algorithms many times, so to confirm the results and derive the ones related to the mean and variance of the estimated variable, the reliability of random variables generators, and the problem of managing many variables, that often cause numerical instabilities. Therefore, we focus on structural models for long-term memory.
The literature on this specific subject is not wide. Some references are [15,19,64,69].
The keypoint of the quoted references is to assume distributional hypothesis on parameters of models in order to detect the presence of long-term memory in time series.
It is worth citing [29], from which the present report differs: indeed, [29] is targeting to provide a model while we propose here a review on some theoretical probabilistic methods.
Specifically, the theme of the detection of long-term memory is surely of interest for economic/financial models, but yet there is a lack of theoretical estimates, directly from the parameters of the model. This is the rational that has lead us to select theorems and results aiming at theoretically proving the presence (or absence) of long-term memory in models. In turn, this approach leads to conditions on model parameters, that define the zones in which the presence of long memory is ensured, and adds knowledge on the outcome of models, and on the composition of agents. The present report aims at giving a critical review on the used approaches, and shows the application of the main theorems on four different agent based models. The models differ each from the other for the microeconomic approach, and the modeling of the heterogeneity, even if they all refer to [35] in making forecasts on the basis of mixed chartist/fundamentalist strategy. [20] bases on the model of [49], and generalizes it to the study of the long-term memory of exchange rates; in [21] the maximum of expected utility is studied, and the heterogeneity among the agents also includes mutual influence and the case of dependence among their decisions; [22] also includes the analysis of returns, through a result of [33]; [23] proposes a condition of fairness among excess of demand and excess of supply. The presence of spot traders is analyzed alongside the chartists and fundamentalist forecasts. In general, the analysis contained in the models listed above extend some existing results [71,72,73] about long-memory property arising due to the aggregation of micro units, by enlarging the class of probability densities of agents' parameters.
The rest of the paper is organized as follows. Section 2,3,4 and 5 collect the discussion of the theoretical results presented in [20], [21], [22] and [23], respectively. Section 6 concludes. Section 7 is an Appendix which collects the formalization of the mathematical concepts used throughout the paper.

First setting
The aim of this section is to reproduce the main results contained in [20], which refers to long-memory for exchange rates.

The model
Consider a market populated by N agents.
In order to make a forecast ∆P i,t+1 |I i,t of the exchange rate increment ∆P i,t+1 con-ditioned to the information available at time t, I i,t , each agent i relies on a technical analysis forecast ∆P c i,t+1 |I i,t and on fundamentalist forecast ∆P f i,t+1 |I i,t , conditioned to her/his information at time t. Let us indicate by k i the individual proportion between the two points of view of the agent i. Thus The exchange rate of the market is given by the average of the exchange rates associated to the agents, i.e.
The chartist approach assumes that the investor can get information by observing the time series of the market data. In this model we consider chartist forecast composed by two terms: for the sake of simplicity, a forecast due to the increment of market exchange rates made by using the simplest linear model where h t is a deterministic function of time, plus an additive term, whereᾱ i ∈ D[0, 1], ∀ i, that takes into account a self correction of the agent obtained by the observation of the difference between the previous market price and the previous agent forecast. Thus we have that the chartist forecast is given by So we have a linear relation between the exchange rate predicted at time t + 1 and the variation of P t , independent from the agent, and we have an additional stochastic shock associated to the comparison between the market situation at time t − 1 and the forecast made by the agent at the same date.
In the fundamentalist analysis the value of the market fundamentals is known, and so the investor has a complete information on the estimate of the exchange rate (he understands if the exchange rate is over or under estimated). We thus have the following relation: whereP i,t is a series of fundamentals observed with a stochastic error from the agent The fundamental variablesP i,t can be described by the following random walk: We suppose furthermore that each agent may invest in foreign risky value with stochastic interest rate ρ t ∼ N(ρ, σ 2 t ) and in riskless bonds with a constant interest rate r. We assume that ρ > r, to meet empirical evidence.
Let us define with d i,t the demand of the foreign value associated to agent i at the date t. Thus the wealth invested in foreign riskly value is given by P t+1 d i,t and, taking into account the stochastic interest rate ρ t+1 , we have that the wealth grows as (1 + ρ t+1 )P t+1 d i,t . The remaining part of the wealth, (W i,t − P t d i,t ) is invested in riskless bonds and thus gives (W i,t − P t d i,t )(1 + r). The wealth of the agent i at time t + 1 is given by W i,t+1 , and it can be written by The expression of W i,t+1 can be rewritten as The utility function associated to the agent i, and conditioned to his information at time t, is defined by: where E and V are the usual mean and variance operators and are given by: Each agent i can change her/his demand d i,t in order to maximize the expected utility, conditioned to her/his information at the date t.
For each agent i the first order condition is and thus we obtain , .
Let X i,t be the supply of foreign value for the agent i. When the market is in equilibrium, the interest rate, that is used by the investor for the transactions, is such that Continuing to follow the Kirman and Teyssiere approach we assume thatP By these relations we obtain:

The long memory property of the exchange rates
By the definition of P t given by (1), we have the following result: Proposition 2.1. Suppose that the following conditions hold: Then, for N → +∞, we have that P t has long memory with Hurst exponent given by Proof. Let L be the difference operator such that LP i,t = P i,t−1 .
. By hypothesis 3. and Proposition 7.16 it follows that (1 − k i ) ∼ b(p, p, 1, 1). Therefore, by applying Proposition 7.16, it follows that ( . For particular choices ofᾱ i we have thatβ i obeys still to a beta distribution. As an example, this happens ifᾱ i = (1 − k i ) δ . In this caseβ ∼ b(p, p, − 1 c , δ). By hypothesis 1., then, (6) becomes: By definition of P t andP i,t , we can write In the limit for N → ∞ and by the definition ofP we have Suppose, as a further hypothesis, that there exist a random variable α * ∼ D(0, 1) with mean µ such thatα = (1 −β)α * , and α * is independent fromβ. Thus Thus This is a characteristic of a long memory process [37].

Second setting
In [21], we provide a mathematically tractable financial market model that can give an insight on the market microstructure that captures some characteristics of financial time series.

Market price dynamics
We consider N investors trading in the market, and we assume that ω i,t is the size of the order placed on the market by agent i at time t. This choice allows to model individual traders as well as funds managers, that select the trading strategy on behalf of their customers. In the present analysis we consider investors getting information from two different sources: observation of the macroeconomic fundamentals and adjustment of the forecast performed at the previous time. Other markets characteristics, like as the presence of a market maker, are not considered here, and they will be studied elsewhere. Let us define with P i,t the forecast of the market price performed by the investor i at time t. Each of them relies on a proportion of fundamentalist P f i,t and of a chartist P c i,t forecast. We can write where β i are sampled by a random variableβ with compact support equals to [0, 1], Parameter β i in equation (11) regulates the proportion of fundamentalist/chartist in each agent forecast. The most β i is to 0, the most is the confidence in the return to fundamentals. The most β i is to 1, the most the next price is estimated to be the actual price. The shape of the distribution used for sampling the β i gives relevant information on the overall behavior of agents.
In the fundamentalist analysis the value of the market fundamentals is known, and so the investor has a complete information on the risky asset (he understand over or under estimation of price). Given the market price P t we have the following fundamentalist forecast relation: where ν ∈ R andP i,t is a series of fundamentals observed with a stochastic error from with α i,t = ζ i P t and ζ i are sampled by a real random variable ζ with finite expected valueζ and independent onβ. The fundamental variablesP i,t can be described by the following random walk:P The chartist forecast at time t is limited to an adjustment of the forecast made by the investor at the previous time. The adjustment factor related to the i-th agent is a random variable γ i . We assume that γ i are i.i.d, with support in the interval and γ i are independent on ζ i and β i . Then we can write We assume, that the aggregate size of the order placed by the agents at a fixed time t depends uniquely on t. We denote it asω t , and we havẽ We assume that such aggregate size is uniformly bounded. Therefore, there exists a couple of thresholds ω and ω such that, for each t > 0, ω <ω t < ω.
Market price is given by the weighted mean of trading prices associated to the agents.
The weights are given by the size of the order. We do not consider here the bidask spread, and mechanisms related to the limit order book, leaving them to future studies. Summing up the components, we can write Then, by (11), (60) and (15)

Memory property: the case of independence
The scope of this section is to describe the memory property of the financial time series P t , in the case of absence of relations between the strategy β i , adopted by the agent i, and the weight ω i,t of the agent i at time t.
The following result holds.
Theorem 3.1. Given i = 1, . . . , N, let β i be a sampling drawn from a random variable β such that Moreover, given i = 1, . . . , N, let ζ i be a sampling drawn from a random variable ζ.
Let us assume that β and ζ are mutually independent.
Furthermore, suppose that there exists q > 0 such that Then, for N → +∞ and q + p ∈ [− 1 2 , 1 2 ], we have that P t has long memory with Hurst exponent given by H = p + q + 1 2 .
Proof. Let L be the time-difference operator such that LP i,t = P i,t−1 .
By definition of P i,t , we have and then By the definition of P t and (19), we have Setting the limit as N → ∞ and by the definition ofP , a series expansion gives Since, by hypothesis,β and ζ are mutually independent, with distributions F 1 and F 2 respectively, we have where M k is the k-th moment of a random variable satisfying the condition (17). Since then, by the hypothesis on the γ i 's, we desumē Therefore we have a long memory model I(d) with d = p + q + 1 and thus Hurst , [32], [37], [38], [51]).
Remark 3.2. We can use the Beta distribution B(p, q) for defining the random variableβ. In fact, if X is a random variable such that X ∼ B(p, q), with p, q > 0, then X satisfies the relation stated in (17). order to obtain such stationarity property for P t , we need that p + q ∈ [−1/2, 1/2], and modifications of q and/or p must not exceed the range. , [12] and [28]). A possible explanation of the reasons for the fact, that asset prices does not reflect the fundamentals, can be found in the spreading of information among investors, and in the consequent decision to follow a common behavior.
We model the dependence structure allowing the size of the order to change the proportion between fundamentalist and chartist forecasts.
Then, for each weight ω i,t , we consider a function Analogously to the previous section, we formalize a result on the long-run equilibrium properties of the time series P t in this setting.
Theorem 3.6. Given i = 1, . . . , N, let β i be a sampling drawn from a random variablẽ Fixed ω i,t , let f ω i,t be a random variable transformation defined as in (24) such that Moreover, given i = 1, . . . , N, let ζ i be a sampling drawn from a random variable ζ, whereβ and ζ are mutually independent.
Furthermore, suppose that there exists q > 0 such that Then, for N → +∞ and q +p ∈ [− 1 2 , 1 2 ], we have that P t has long memory with Hurst exponent given by H =p + q + 1 2 .
Proof. The proof is similar to the one given for Theorem 3.1.
. Therefore, the changing of the strategy used by the investors, driven by the weights ω's, can be attained by calibrating the parameters of a Beta distribution.
We use the B(p, q) distribution because of its statistical properties and of the several different shapes that it can assume depending on its parameters values. In the particular case p = 1, q = 1 it is the uniform distribution. If β i are sampled in accord to a uniform distribution then there is no prevailing preference on the strategy, and so between either chartist or fundamentalist approach. If β i are sampled in accord to a random variableβ,β ∼ B(p, p), p > 1 then this means that agents opinion agree on mixture parameter values close to the mean of β. If the distribution is U-shaped, this means that there are two most agreeable strategies.
The main result of this paper is the theoretical proof of the degree of long memory of market price due to traders that have a specific weight in the formation of market price. Since H = 1/2 is taken into account in the theoretical model, the long-run equilibrium properties of uncorrelated processes represents a particular case.

Third setting
In [22], we focus on the long memory of prices and returns of an asset traded in a financial market.

The model
The basic features of the market model, that we are going to set up, are the existence of two groups of agents, with heterogeneity inside each group.
Let us consider a market with N agents that can make an investment either in a risk free or in a risky asset. Furthermore, the risky asset has a stochastic interest rate ρ t ∼ N(ρ, σ 2 t ) and the risk free bond has a constant interest rate r. We suppose that ρ > r for the model to be consistent.
Let P i,t be the estimate of the price of the risky asset done by the agent i at time t. The change of the price at time t + 1 forecasted by the i-th agent, conditioned to her/his information at time t, I t , is given by ∆P i,t+1 |I i,t .
Let us assume that the market is not efficient, i.e. we can write the following relationship: In this model, we suppose that the behavior of the investors is due to an analysis of the market data (by a typical chartist approach) and to the exploration of the behavior of market's fundamentals (by a fundamentalist approach). Moreover, the forecasts are influenced by an error term, common to all the agents: where (∆P c i,t+1 |I i,t ) is the contribute of the chartist approach, (∆P f i,t+1 |I i,t ) is associated to the fundamentalist point of view and u t is a stochastic term representing an error in forecasts.
As a first step we assume that all the agents have the same weight in the market and that the price P t of the asset in the market at time t is given by the mean of the asset price of each agent at the same time. So we can write The chartists catch information from the time series of market prices. The forecast of the change of prices performed by the agent i is assumed to be given by the following linear combination: with α i , α The fundamental variablesP i,t can be described by the following random walk: The fundamental prices observed by the agent i at time t,P i,t , are assumed to be biased by a stochastic error:P Moreover, the forecasts of the fundamentalist agents is based on the fundamental prices and his/her forecast on market prices at the previous data. So we can write with ν ∈ R. Thus Let us define d i,t to be the demand of the risky asset of the agent i at the date t. Thus the wealth invested in the risky asset is given by P t+1 d i,t and, taking into account the stochastic interest rate ρ t+1 , we have that the wealth grows as (1 + ρ t+1 )P t+1 d i,t . The remaining part of the wealth, (W i,t − P t d i,t ) is invested in risk free bonds and thus gives (W i,t − P t d i,t )(1 + r) [20].
The wealth of the agent i at time t + 1 is given by W i,t+1 , and it can be written as The expression of W i,t+1 can be rewritten as Each agent i at time t optimizes the mean-variance utility function Thus: Each agent i maximizes her/his expected utility with respect to his demand d i,t , conditioned to her/his information at the date t. For each agent i the first order condition is By the first order conditions we obtain .
Let X i,t be the supply function at time t for the agent i. Then Let us denote By (27), (29), (32) and (34) we get: where L is the backward time operator.
Condition (28) and equation (36) allow to write the market price as

Long-term memory of prices
This section shows the long-term memory property of market price time series. Equation (37) evidences the contribution of each agent to the market price formation.
Each agent is fully characterized by her/his parameters, and it is not allowed to change them. Parameters are independent with respect to the time and they are not random variables, but they are fixed at the start up of the model in the overall framework of independent drawings.
The heterogeneity of the agents is obtained by sampling α i , i = 1, . . . , N from the cartesian product R N with the relative product probability measure. No hypotheses are assumed on such a probability up to this point.
In order to proceed and to examine the long-term memory property of the aggregate time series, the following assumption is needed: This Assumption thus introduces a correlation in the way in which actual prices P t play a role in the fundamentalists' and chartists' forecasts, and meets the chartists' viewpoint that market prices reflect the fundamental values. Moreover, a relationship between the parameters of the model describing the preferences and the strategies of the investors, α i and ν, and the interest rates of the risky asset and risk free bond (combined in the parameter c) is evidenced.
By a pure mathematical point of view, since ρ > r (and, consequently, c < −1), the variation range of α i is, in formula (38), respected.
We assume that Assumption (A) holds hereafter.
Equation ( The components of P t have precise meaning.
A 1 t is the idiosyncratic component of the market, and it gives the impact of the supply over market's prices, filtered through agents' forecasts parameters.
A 2 t describes the common component of the market. In fact, A 2 t represents the portion of the forecast driven by an external process independent by the single investor.
t is a term typically linked to the perception of the fundamentals' value by the agents. • long memory is detected for each component of P t ; • the terms are aggregated.
Before stating the main result on the disaggregated long memory property of the components of P t , we need to briefly analyze A 3 t . By the definition ofP given in (30), we can rewrite A 3 t as where ǫ ∼ N(0, σ 2 ǫ ) and {P i,0 } i=1,...,N is a set of normal random variable i.i.d. with mean 0 and variance σP , for each i = 1, . . . , N.
The stability of the gaussian distribution implies that In particular, Γ t is a stationary stochastic process.
By (40) and (41), we can write The long memory property is formalized in the following result.
Moreover, let us assume that u t is a stationary stochastic process, with Fix r = 1, 2, 3, 4. Then, as N → +∞, the long-term memory property for A r t holds, with Hurst's exponent H r , in the following cases: • b > 1 implies H r = 1/2: • b ∈ (0, 1) and the following equation holds: imply H r = (1 − b)/2. In this case it results H r < 1/2, and the process is mean reverting.
Proof. We prove the result for A 1 t . First of all, we need to show that Let us examine The terms of the series are positive, and so it is possible to exchange the order of the sums: In the limit as N → +∞ and setting x := λ i , y := λ j , (48) becomes: where F is the joint distribution over x and y.
Taking the mean w.r.t. the time and by using the hypothesis (44), we get By using the distributional hypothesis on λ i , for each i, we get Now, the rate of decay of the autocorrelation function related to A 1 is given by (52).
By using the results in [59] on such rate of decay and the Hurst's exponent of the time series, we obtain the thesis.

Aggregation of the components
In this part of the work we want just summarize the results obtained for the disaggregate components of the market's forecasts done by the investors. Then, for N → +∞, we have that P t has long memory with Hurst's exponent H given by Proof. It is well-known that, if X is a fractionally integrated process or order d ∈

Long-term memory of returns
This section aims at mapping the long memory exponent of price time series generated by the model into long memory of log-returns. In order to achieve this goal, the effect of log-transformation of a long-memory process has been analyzed. [33] provides theoretical results on the long memory degree of nonlinear transformation of I(d) processes only if the transformation can be written a finite sum of Hermite polynomials. Therefore they cannot be used for examining log-returns, which the logarithms is involved in.
The same authors provide further results through numerical analysis. Let X t be I(d), Y t = g(X t ) with g(·) a transcendental transformation. Numerical estimates of the degree of long memory of Y t , d ′ , suggest the following behaviour: We can state the following

Fourth setting
In [23] we model the evolution of an economic system through the agents populating the system itself. In this regard, it is worth to focus attention to the important role played by the diversity between units.

The model
The basic features of the market model we are going to set up, are the existence of two groups of agents, with heterogeneity inside each group.
Let us consider a market with N agents who can invest either in a risk-free or in a risky asset. The risk free bond has a constant interest rate r ∈ (0, 1).
Let P t the price of the risky asset and P i,t the estimate of it carried out by the agent i at time t. The change of the price at time t + 1 forecast by the i-th agent, conditioned to her/his information at time t, I i,t , is given by ∆P i,t+1 |I i,t .
We assume that the market is not efficient, i.e. we can write the following relationship: where I t is the information available up to time t.
The behavior of the investors is due to analysis of the market data (using a typical chartist approach) and to the exploration of the behavior of market fundamentals (using a fundamentalist approach). Moreover, the forecasts are influenced by an error term, common to all the agents: where (∆P c i,t+1 |I i,t ) is the contribution of the chartist approach, (∆P f i,t+1 |I i,t ) is associated to the fundamentalist point of view and u t is a stochastic term representing an error in forecasts, i.e. u t is i.i.d. with mean 0 and variance σ 2 u . As a first step, we assume that all the agents have the same weight in the market and that the price P t of the asset in the market at time t is given by the mean of the asset price of each agent at the same time. So we can write Equation (56) is a type of market clearing price condition.
We now describe the price formation mechanism of the agents.
The chartists glean information from the time series of market prices. The i-th agent's price change forecast is assumed to be given by the following linear combination: with α The fundamental variablesP i,t can be described by the following random walk: The fundamental prices observed by the agent i at time t,P i,t , are assumed to be biased by a stochastic error:P withᾱ i,t = β i P t , where the n-ple (β 1 , . . . , β N ) is drawn by sampling from the cartesian product (1−ξ, 1+ξ) N , ξ > 0, equipped with the relative product probability measure.
The definition ofᾱ i,t takes into account the fact that the error in estimating depends on the adjustment performed by each agent of the market price. More precisely, the observation of the fundamental prices is affected by the subjective opinion of the agents about the influence of the market price on the fundamental. If β i > 1, then agent i guesses that the market price is responsible for an overestimate of fundamental prices. Otherwise, the converse situation applies.
Moreover, the forecasts of the fundamentalist agents are based on fundamental prices and their forecasts about market prices at the previous data. So we can write with ν ∈ R. Thus Remark 5.1. By comparing (57) and (60), it must be α . We state this condition for the remaining part of the paper.
Let us define d i,t to be the demand of the risky asset of the agent i at the date t.
The estimated wealth of the agent i at time t + 1 is given by W i,t+1 , and it is given by: By (61), the expression of W i,t+1 can be rewritten as: Each agent i at time t optimizes the mean-variance utility function where V is the usual variance operator, and thus: Each agent i maximizes her/his expected utility with respect to her/his demand d i,t , conditioned to her/his information at the date t. For each agent i the first order condition is By the first order conditions we obtain ; .
Let X i,t be the supply function at time t for the agent i. We have the following equilibrium relation: Let us denote By (55), (57), (60) and (63) we get: where L is the backward time operator, i.e. LP i,t = P i,t−1 .
Condition (56) and equation (65) allow us to write the market price as The parameter λ i is particularly relevant in describing the heterogeneity of the agents.
Indeed, it provides information on the technical analysis of the market performed by the i-th agent. As we will see below, the λ's play a central role in determining the persistence properties of the price.

Diversity and long-term memory
This section shows the long-term memory property of market price time series. In particular, we focus on the theoretical conditions on the parameters distribution and on the stochastic processes that are needed for long memory.
In order to proceed, the following technical assumption is needed: The relation between the indices i and t in defining the process γ i,t is outlined in the following Assumption.
Assumption 5.3. There exist N random variables w 1 , . . . , w N and a stochastic process z t , independent on u t , such that: • E[w j ] =ω ∈ R, for each j = 1, . . . , N; • w i is independent on λ i , for each i = 1, . . . , N; • z t are i.i.d., with mean 0 and variance σ 2 ; • for each i = 1, . . . , N and t ≥ 0, it results γ i,t = z t · w i . In determining the distributional hypothesis on the λ's, we basically take into account two types of investors: impulsive traders and long run traders. The former type of agents performs an analysis of the market, following a chartist approach, only in rare situation. The latter type of agents deals with a technical analysis of the market continuously in time.
We initially analyze homogeneity among agents, and then move to heterogeneity.
The first result concerns the case of a very general two-parameter distribution, able to describe several types of agents as the value of the parameters varies. Then, as N → +∞, the long-term memory property for P t holds, with Hurst's expo- Proof. To prove the result, we need to rewrite the process P t as the sum of three components: where By definition of the model, the processes Γ's are independent. Hence, we can analyze separately the long-term memory property of the Γ's.
Denote as λ and w the random identically distributed random variables λ i and w j .
Furthermore, denote as F the joint cumulative distribution function of (λ, w) and F Λ be the marginal distribution of λ.
In the limit for N → ∞ we have where Since λ ∼ B(a, b), we have: Therefore, Γ 1 t faces the same asymptotic behavior of an I(d) process, with d = −b−1. Since b > 0, we have that Γ 1 t can be represented as an integrated process of order d < −1. Hence, Γ 1 t does not have the long-term memory property. For what regards the process Γ 3 t , fixed h > 0, we have Then, [59] assures that: as N → +∞, the long-term memory property for Γ 3 t holds, with Hurst's exponent H 3 as follows: • b > 1 implies H 3 = 1/2: • b ∈ (0, 1) and the following equation holds: imply H 3 = (1 − b)/2. In this case it results H 3 < 1/2, and the process Γ 3 t is mean reverting.
thenP i,t is a stationary process, and the arguments carried out for Γ 3 t can be replicated to state that the long memory property holds for Γ 2 t as N → +∞. The Hurst exponent is H 2 .
By [37], we have that As the parameters of the Beta distribution vary, several types of continuous-time traders may be described. Furthermore, the proof of Theorem 5.4 evidences that the distributional hypothesis on λ may be relaxed. The following Corollary states immediately: Corollary 5.5. Assume that: Then, as N → +∞, the long-term memory property for P t holds, with Hurst's expo- We now move from homogeneity to agents gathered in several groups. Each group has its own impact on the market and exhibits organized heterogeneity among its components.
By a mathematical perspective, this assumption is equivalent to the study of the aggregate of a mixture of absolute continuous distributions for the parameters λ's.
More precisely, we introduce a group of investors that concentrate their attention in a small set of events, i.e. the behavior of these agents is given by not assuming a position for the most part of the market traffic, and take part heavily in some particular and rare situations. We formalize this kind of behavior by using Dirac measures δ x (y) as follows: Assume that there exists p j ∈ (0, 1) such that Furthermore, assume that λ i are sampled by independent random variables.
Then, as N → +∞, P t has the long-term memory, with Hurst's exponent H D ≤ 1/2.
Proof. The process P t can be disaggregated as follows: where In order to proceed, we need to study the behavior of the k−th moments of the Dirac distribution, with k ∈ N.
A direct computation gives: Therefore, the terms related to the processes Ψ's do not contribute to the long memory of the process P t .
By Theorem 5.4, we have that the process Φ j t has an Hurst exponent H j ≤ 1/2. Since the λ's are independent and by [37], we obtain that and this completes the proof.

Conclusions
We have shown the usage of the aggregation technique proposed in [37] for the theoretical proof of the long-term memory of the aggregate in financial markets populated by heterogeneous agents. The agents are supposed to drive actively the price formation of an asset, and heterogeneity mirrors in the way to make forecasts (chartist and fundamentalist) and in the way to technically analyze the market (distribution of the parameters). We extend some results present in the literature about the arise of the long memory property due to the aggregation of independent micro units. We provide a number of results: on the long-term memory of the aggregate, on the relevance of differences of contributions of agents to the long-term memory, amd on their heterogeneity. In this regard, it is worth focusing on the role played by the diversity between units. The analysis of the diversity has become a remarkable aspect of the decision theory for what concerning the selection of multiple elements belonging to different families of candidates. In some other contexts, diversity rules the connection among heterogeneous agents to share information and collaborate or compete. In this respect, the diversity may also be an indicator of the performance of the strategies in a dynamic optimization framework.

Appendix: Mathematical definitions
This sections summarizes the main definition and theorems that we used for the proofs in our models.

Long-term memory
The memory is defined "long-term" or, simply, "long" if the decay of the correlation is slow. In details: Definition 7.1. A stationary process {X t } is called stationary process with long memory if its autocorrelation function ρ(k) has asymptotically the following hyperbolic rate of decay: where d ∈ (−1/2, 1/2) and L(k) is a slowly varying function, i.e. L(λk)/L(k) → 1 as k → ∞, ∀λ > 0.
The parameter d summarizes the degree of long range dependence of the series.
If −0.5 < d < 0 the series is mean reverting; if d = 0 there is no correlation between the data and {X t } is a short memory process. If 0 < d < 0.5, the correlation function decays slowly with the lag k and the time series has a long range correlation, or long memory property [20].
The term slow, referred to the decay of the autocorrelation function, must be intended as compared to the autocorrelation function of a short memory process, that decays to zero at an exponential rate.
The definition is extended to the time series {x t } generated by {X t }.
The parameter d is related to the Hurst's exponent H, and this provides methods for its estimate.
Definition 7.2. Given a time series {x t } Hurst's exponent H describes the degree of dependence among the increments of the analyzed process. It can be defined as follows: Several methods are available for its estimate [49,51] and H = d + 1 2 . Spectral analysis can provide an estimate for H. The spectral density of a covariance stationary time series {X t } is given by where γ(h) = Cov(X t , X t−h ) is the autocovariance function.
The spectrum of stationary processes with long range memory can be approximated To avoid a cumbersome notation, we will refer briefly to x t ∼ I(d) as for an integrated process {x t } of order d.
Note that d need not be an integer [37]; d is also called the fractional degree of integration of the process.
[37] gives the following remark. The following result has been proved in [38]. Remark 7.9. Using the fact, derived from Sterling's theorem, that Γ(j+a) Γ(j+b) is well approximated by j a−b , it follows that ρ j ≃ A 1 j 2d−1 , b j ≃ A 2 j d−1 , where A 1 and A 2 are appropriate constraints . Hence, if d > 0, then the series x t possesses the longmemory property.
The algebra of integrated series is quite simple. By continuing to follow [37]: Proposition 7.10. If X t is an integrated process of order d X , and an integrating filter is applied to it, to form Y t = (1 − L) −d ′ X t , then Y t is an integrated process of The following result is proven in due to [37] as well: Proposition 7.11. If X t and Y t are independent integrated processes of order, respectively, d X and d Y , then the sum Z t := X t + Y t is an integrated process of order

Beta distribution and its properties
Definition 7.12. If Z is an ordinary beta-distributed random variable with support [0, 1], the probability density function of Z is where a e b are positive parameters and We refer to this distribution as B(a, b).
Proposition 7.13. If X ∼ B(a, b), then the random variable Y = 1 − X is a beta random variable with law B(b, a).
Let us now consider C > 0, h ∈ R and a new random variable X which is related to Z through the power transformation By the transformation in (80) we can define a generalization of the beta distribution.
Definition 7.14. The random variable x defined by (80) has a beta generalized distribution b(a, b, C, h) if its probability density function is defined by The moment M n of order n for X is given by M n = C n β(a + n h , b) β(a, b) = C n Γ(a + b)Γ(a + n h ) Γ(a + b + n h )Γ(a) .
Remark 7.15. A standard beta random variable is also a generalized beta random variable with parameters h = C = 1. Thus the properties of the beta standard random variable can be extended to the beta generalized random variable.
The beta generalized distribution is close with respect to the class of power transformations.
Proposition 7.16. Let X ∼ b(a, b, C, h) and consider where r, s ∈ R. Then Y ∼ b(a, b, rC s , h s ).