Market sentiment and heterogeneous agents in an evolutive financial model

We study a financial market populated by heterogeneous agents, whose decisions are driven by “animal spirits”. Each agent may have either correct, optimistic or pessimistic beliefs about the fundamental value, which can change from time to time based on an evolutionary mechanism. The evolutionary selection of beliefs depends on a weighted evaluation of the general market sentiment perceived by the agents and on a profitability measure of the existent strategies. As the relevance given to the sentiment index increases, a herding phenomenon in agent behavior may occur and animal spirits can drive the market toward polarized economic regimes, which coexist and are characterized by persistent high or low levels of optimism and pessimism. This conduct is detectable from agents polarized shares and beliefs, which in turn influence the price level. Such polarized regimes can consist in stable steady states or can be characterized by endogenous dynamics, generating persistent alternating waves of optimism and pessimism, as well as return distributions displaying the typical features of financial time series, such as fat tails, excess volatility and multifractality. Moreover, we show that if the sentiment has no or low relevance on belief selection, those stylized facts are abated or are missing from the simulated time series.

relies on evidence that the complexity of the economic environment restricts the agent's capability to have complete knowledge so that agents make decisions that are unavoidably cursed by uncertainty (see, e.g., Sargent 1993). In the past years, the analysis of models that involve heterogeneous interacting agents (see, e.g., Iori and Porter 2018) has considerably improved the understanding of financial market functioning. Moreover, the psychological investigation about humans and hence about economic agents, shows that most decisions are made based on simple heuristics (see, among others, Gilbert 2002;Hommes 2013;Tversky and Kahneman 1974). Individuals, being affected by psychological and emotional factors, rely more on impressions and common feelings than on precise knowledge and evaluation of the environment they live in. In fact, even before the behavioral paradigm came to the forefront in finance and economics, the role of investor sentiment was perceived as a common phenomenon by financial analysts and market participants. The previous statement finds its foundation in the work by De Grauwe (2011), who claims that "the notions of animal spirits and rational expectations do not mix well". Since the widespread assumption in mainstream economic models is to endow agents with full rationality, no room for perceived sentiment or animal spirits actually remains in their decision mechanisms. Only recently has sentiment analysis grown in relevance and been considered as a key element in modeling financial markets (see e.g. Lee et al. 2002;Neal and Wheatley 1998;Stambaugh et al. 2012).
Currently, the approach based on boundedly rational agents is widely applied in financial market modeling (see Barberis and Thaler 2003;Conlisk 1996;Hommes 2001;Kindleberger and Aliber 2005). The literature that stems from these ideas is burgeoning and widespread (see, e.g., Hommes 1997, 1998;Chiarella and He 2002;Lux 1998;Lux and Marchesi 1999). Concerning the research that is closer to the present contribution, we mention the work by Brock and Hommes (1998), where asset price fluctuations are unpredictably characterized by the alternation of prices close to the fundamental with phases of optimism or pessimism; the paper by De Grauwe and Rovira Kaltwasser (2012), in which the emergence of waves of optimism/pessimism is explained in terms of evolutionary selection between optimistic/pessimistic exogenous beliefs about the fundamental value; and the paper by Cavalli et al. (2017), in which endogenously changing optimistic/pessimistic beliefs cannot be disentangled from their evolutionary selection considering the emergence of waves of optimism/pessimism. In all the abovementioned works, the main mechanisms (imitation and evolutionary selection) are based on precise evaluations of economic indicators (such as profits or forecasting errors), which are assumed to be correctly estimated by agents when making their choices.
However, the literature reviewed above does not model animal spirits directly, where a market average mood would affect an individual's behavior. Thus, a natural question arises, which constitutes the motivation for the present research. "What happens when decisions (in the present case, strategies in a financial market) are driven by animal spirits?" In the present contribution, we aim to provide rigorous formal modeling of animal spirits as one of the agents' drivers and, subsequently, of the market behavior. Motivation for our approach is the content of the survey by Franke and Westerhoff (2017). In fact, the abovementioned literature provides a "weak form" of animal spirits, in the sense that the model can generate waves of optimistic or pessimistic attitudes. Conversely, a "strong form" of animal spirits modeling approach exists if agents also rush toward an attitude or strategy simply because it is being applied by the majority of agents. In the present work, agents may rush toward optimism or pessimism depending on what they observe or feel about the behavior of the majority of the other agents, which is what we call the "general sentiment". Hence, the model that we propose provides a "strong" form of animal spirits modeling to retrieve the Keynesian seminal idea. The modeling approach we propose is also supported by the fact that investing in stock markets is a social activity, and it is thus reasonable that investors' behavior, as well as stock prices, are influenced by social interaction. Therefore, it is crucial to provide an alternative to the exclusive focus on the merely individual expectations. Since the long-term decisions of the agents are also based on a form of market mood derived from their social activity, what is needed is a setup in which the concept of market sentiment is coupled with the individual evaluation of the market. In this regard, a few recent approaches, which ground their arguments on the notion of market sentiment, incorporate some kinds of informational constraints that limit individual agents' full access to the market (see, e.g., Angeletos and La'O 2013;Benhabib et al. 2016;Flaschel et al. 2018;Gomes and Sprott 2017;Liang 2018).
It is against this background that we consider a financial market model populated by heterogeneous agents, namely, unbiased fundamentalists, as well as optimists and pessimists who overestimate and underestimate the true fundamental value, as in Cavalli et al. (2017) and that can change their beliefs from time to time based on an evolutionary mechanism. The evolutionary mechanism is based on a combination of a profitability measure of the existent strategies in terms of realized profits, and the average mood perceived by the agents about the market status (i.e., the sentiment index). Thus, the psychological and emotional components become a constitutive part of the decision process.
The results emerging from our analysis are interesting under several perspectives. Starting from a static analysis, in addition to the fundamental steady state, we find the existence of sentiment-connected non-fundamental steady states characterized by either a high or low price level. However, the analysis proceeds further. Namely, we show the emergence of herding phenomena, which occurs "because individual agents believe that the majority will probably be better informed and smarter than they themselves" (see Franke and Westerhoff 2017), and thus agents pay more attention to the general sentiment. Herding drives the occurrence of long-lasting waves of optimism and pessimism, which are a consequence of the (strong form of) animal spirits behavior of the agents. Furthermore, the eventuality of those herding behaviors is mirrored by the emergence of coexisting economic regimes that did not emerge in the abovementioned literature and that are characterized by persistently polarized levels of optimism and pessimism. When agents "endeavor to conform with the behavior of the majority or the average" (Keynes 1937), it is more likely that animal spirits generate outcomes that can be seen as the result of a herding phenomenon around a polarized situation. The present setting encompasses the possibility of endogenous dynamics with neat and persistent periods of optimism alternating with periods of pessimism, and the resulting dynamics provide a clear representation of the stylized facts occurring in real-world financial markets.
The remainder of the paper is organized as follows. In Section 2 we outline our model. Section 3 is devoted to the analytical results while Sections 4 and 5 discuss the findings with the help of numerical analysis based on both deterministic and stochastic simulations. Finally, Section 6 concludes. All the proofs of our analytical results and further dynamical considerations can be found in the Appendix.

The model
The evolutive financial market model we study grounds on a market in which, at each discrete time period t, a population of agents is composed of three types of boundedly rational fundamentalists, being either unbiased, pessimists or optimists. 1 The belief about price of unbiased fundamentalist is the true fundamental value F of the asset, while that of pessimistic and optimistic agents consist of a systematic underestimation and overestimation of F . Additionally, as in Brock and Hommes (1998), who introduced a simplified assumption postulating that the expected value of the future divided is constant, i.e., δ e t+1 =δ, the fundamental value of the asset can be computed as F =δ/r. Despite this, we assume that agents are boundedly rational, and they tend to make decisions based on a fast associative thinking instead of efforts to make computations that would be consistent with the hypothesis of rational expectations (see De Bondt and Thaler 1985;Thaler 1994;Tversky 1974). This gives rise to the different belief biases.
Assuming symmetric biases and denoting them by Δ > 0, the beliefs about the price of pessimists and optimists can be written as X p = F − Δ/2 and X o = F + Δ/2, respectively, while that of unbiased agents is X f = F . We stress that Δ gauges the degree of heterogeneity among agents, i.e., the maximum possible degree of belief polarization.
Fundamentalists buy/sell stocks in undervalued/overvalued markets and the stock price P t is adjusted by a market maker by means of a nonlinear mechanism. The demand functions of each type of agent are then described by d i,t = ρ(X i − P t ), i ∈ {p, o, f }, where P t is the asset price at time t and ρ > 0 is a demand reactivity parameter, which we can assume to be the same for the various types of agents being all fundamentalists. If at time t the shares of pessimists, optimists and unbiased fundamentalists are respectively can be rewritten as 1 There exist several papers in which agents are endowed with biased beliefs about the fundamental (or target) value of a certain economic variable, such as the price, inflation, output gap or exchange rate target (see, just to cite a few, Agliari et al. 2017;Anufriev et al. 2013;Brock and Hommes 1998;Hommes and Lustenhouwer 2019;Rovira Kaltwasser 2010). Moreover, in the experiments of Assenza et al. (2011), individuals frequently employ constant forecasting rules. We also refer the reader to the introduction of De Grauwe and Rovira Kaltwasser (2012) for a possible explanation of the empirical basis for the assumption that fundamentalists can either be optimistically or pessimistically biased.
. The price variation is described by the nonlinear, bounded mechanism where γ > 0 represents the price adjustment reactivity and f : R → (−a 2 , a 1 ), with −a 2 < 0 < a 1 , is a twice differentiable sigmoidal function, i.e., an increasing function, satisfying f (0) = 0, f (0) = 1, f (z) > 0 on (−∞, 0) and f (z) < 0 on (0, +∞). Moreover, as it is evident from Eq. 1, without loss of generality we can set ρ = 1, encompassing both the demand and the price adjustment reactivities in the parameter γ . The nonlinear mechanism introduces a cautious price adjustment, as from t to t + 1 prices can only increase or decrease by a bounded quantity, 2 respectively given by a 1 or a 2 . More precisely, due to the previous assumptions on f, from Eq. 1 the stock price increases or decreases when the excess demand is positive or negative, respectively, and the variation rate increases as the excess demand vanishes, since the derivative of the right-hand side of Eq. 1 with respect to D t is given by γf (γ D t ), and attains its maximum value γ when D t = 0.
The last part of the model regards the updating mechanism for the shares of agents, based on evolutionary competition among the three behavioral rules. Agents select a strategy within the pool of the available rules, and this can be represented by a discrete choice model along the lines of Manski and McFadden (1981). We assume that the strategy selection process is described by a logit model which provides the shares ω of optimistic (o), pessimistic (p) and unbiased (f ) agents and where β is a positive parameter representing the intensity of choice of the switching mechanism. Finally, U i,t+1 , for i ∈ {p, o, f }, is the fitness measure of pessimistic, optimistic and unbiased strategies, governing the evolutionary selection at time t + 1. Unlike Cavalli et al. (2017) and De Grauwe and Rovira Kaltwasser (2012) where the fitness measure relied only on the comparison between the profits that could be realized, in the present contribution, the evolutionary selection of beliefs also depends on the general feeling perceived by the agents about the market status. As noted in Baker and Wurgler (2007), perceived market feeling takes shape from agents' opinions, emotions and views and is not a variable that can be directly assessed objectively. It is also affected by heterogeneity of visions and expectations. 2 The mechanism in Eq. 1 describes a conservative behavior for the market maker, induced by a central authority that tries to limit overreaction phenomena with the consequent occurrence of excessive stock volatility, and imposes bounds to price variations (see France et al. 1994;Harris 1998;Kyle 1988). As a consequence, the market maker prudently adjusts prices in the presence of extreme excess demand, while when the excess demand is small, the price adjustment is nearly proportional to the excess demand. The price variation limiter mechanism can be modeled by a sigmoidal adjustment rule that determines a bounded price variation in every time period due to the presence of two asymptotes that limit the price changes. In the literature on behavioral financial markets, nonlinear price adjustment mechanisms have already been considered, among others, by Tuinstra (2002) and Zhu et al. (2009). Such a difference is ascribed to the role played by human psychology in investors' decisions. Market sentiment and the general market mood are also the result of social interactions among agents (see, e.g., Lux 1995Lux , 1998Daniel et al. 1998;Barberis et al. 1998). To embody all these features, we introduce the sentiment index which measures the difference between the average belief X about the fundamental value (corresponding to the first three addends in Eq. 3) and the true fundamental value F . The average belief about the fundamental value depends on both the beliefs and the shares, whose effects cannot be completely disentangled. The sign of I t provides information about the general degree of optimism or pessimism in the market. When I t is positive (negative), portraying the underlying optimistic (pessimistic) perceived market mood, X is larger (smaller) than F . The rightmost expression in Eq. 3 is obtained replacing the occurrences of X i with their respective explicit expressions. Hence, I t is positive (negative) when the share of optimists exceeds (is lower than) that of pessimists, and it increasingly deviates from zero as the belief heterogeneity increases. Equation 3 highlights how the sentiment index grounds both on the different beliefs about the fundamental, related to the presence of boundedly rational agents, and on their numerousness, compared with the true fundamental value. Such index can thus be considered publicly perceived by the agents due to their continuous interactions and exchange of opinions in the market and, accordingly, a positive or negative market mood, pushed by the corresponding value of the sentiment, can affect price patterns. This leads to a shared knowledge of the general market mood that can be proxied by the index I t , in line with attempts to measure market sentiment through a mood proxy (see, e.g., Baker and Wurgler 2007).
To present the fitness measure that governs the evolutionary selection mechanisms, we start focusing on two extreme situations. Let us assume that all the agents populating the market make decisions based on the perceived mood. Since the more negative the market mood is, the more pessimism will spread among the agents, the fitness measure related to a pessimistic strategy has to be a decreasing function of the perceived sentiment. To keep the model analytically tractable, we assume a linear dependency in the value function for a pessimistic belief through the simple specification v p (I t ) = −I t . Conversely, since the probability for an optimistic belief to become popular increases as the market mood increases, the value function corresponding to such a strategy must be an increasing function of the perceived sentiment. Symmetrically to the previous case, we can set v o (I t ) = I t . Finally, the value function corresponding to an unbiased strategy must be larger as I t is close to zero, at which we must have the highest spread for an unbiased strategy, and therefore we set v f (I t ) = −|I t |.
In contrast, according to De Grauwe and Rovira Kaltwasser (2012), if all the agents made decisions based on a profitability measure, in every time period the fitness measure of strategy X i would be π i for i ∈ {p, o, f }, where are profits that would have been realized by adopting a pessimistic, optimistic or unbiased strategy.
If the financial market is populated by N agents, with 0 ≤ N s ≤ N agents that make decisions based on the perceived mood, and by 0 ≤ N − N s ≤ N agents that make decisions based on the profitability signal, the overall fitness measure of each strategy is obtained aggregating the contribution of each agent. Namely, for The fitness measures U p and U o are thus directly affected by both a measure of profitability of the pessimistic or optimistic strategy (evaluated through the profits that would be realized by adopting that strategy) and by the value assigned by pessimists and optimists to the perceived market mood. Assuming a normalized population N = 1, we have that the fractions of pessimists and optimists evolve depending on a convex combination of the general market sentiment and the profits realized by the three kinds of agents, according to the following updating rules: and where σ ∈ [0, 1], denoting the fraction N s of agents that make decisions based on the perceived mood, represents the sentiment weight.
The model is obtained by collecting the price adjustment rule in Eq. 1 and the evolutionary mechanism in Eq. 2 and is described by map G = (G 1 , G 2 , G 3 ) : (0, +∞) × (0, 1) 2 → R 3 , (P t , ω p,t , ω o,t ) → (P t+1 , ω p,t+1 , ω o,t+1 ), with (P t+1 , ω p,t+1 , ω o,t+1 ) = (G 1 (P t , ω p,t , ω o,t ), G 2 (P t , ω p,t , ω o,t ), G 3 (P t , ω p,t , ω o,t )) where: The present framework needs some remarks. As explained above, the key economic element to be considered is that the choice between predictors is driven not only by a rational computation of the profitability of the existent strategies, but as σ rises, the psychological and emotional aspects assume an increasing relevance, and represent the unique impulse when σ = 1. This reinforces the behavior of agents as "animal spirits", which, as σ → 1, becomes the main motivational driver of the agents' choices. However, the significance of the considered framework is not limited to the economic interpretation of the model, but as it will become evident in further sections, the possible outcomes arising when the sentiment index drives stock market dynamics to significantly differ from those found in the existing literature, so that the proposed approach provides a "strong form" (according to Franke and Westerhoff 2017) of animal spirits modeling, which is different from the "weak form" by De Grauwe and Rovira Kaltwasser (2012) and Cavalli et al. (2017).

Analytical results on steady states and local stability
In this section, we determine the possible steady states of the model outlined above, and we provide analytical conditions for the local stability of the fundamental steady state. Moreover, we also present results on how the additional steady states vary when the relevant parameters change.
Let us start by investigating the number of steady states of the system in Eq. 6, and their stability. In Proposition 1, as well as in its proof, we deal with both fundamental and non-fundamental steady states S = (P , ω p , ω o ), i.e., steady states at which the price either corresponds or not to the fundamental value. In the former case, the steady state and its components are denoted by using * superscript. In the latter case, we denote them by using either superscript + or −, to specify the signs of the sentiment index at the corresponding steady state, which in turn highlight an optimistic/pessimistic characterization of the steady state, respectively. Moreover, we say that two steady states are symmetric when their components are symmetric with respect to the fundamental steady state.
Proposition 1 bears relevance for our analysis. In fact, differently from what is found in the existing literature (see e.g., Cavalli et al. 2017;De Grauwe and Rovira Kaltwasser 2012;Naimzada and Pireddu 2015), where the unique steady state is the fundamental steady state S * , when animal spirits affect economic decisions to a sufficient extent, non-fundamental steady states that are characterized by either pessimism or optimism exist. We stress that, as anticipated by Proposition 1 and as it will become more evident in Section 4, among the four possible arising additional steady states, only S − and S + play an active role and are economically relevant since trajectories almost never converge toward 3Ŝ± due to their unconditional instability. Given this background, when animal spirits drive the market, we have two more steady economic regimes that can be identified as either "pessimistically" (associated with S − ) or "optimistically" (associated with S + ), which can coexist with S * . Such polarized steady states are characterized by either greater (P + ) or smaller (P − ) prices than the fundamental value, and by a population consisting of a dominating share of optimists (i.e., in which ω + o is greater than both ω + p and ω + f ) or pessimists (ω − p is greater than both ω − o and ω − f ), respectively. This eventuality occurs if agents assign a sufficiently large relevance to the perceived market mood, as the additional steady regimes can emerge only for suitably large sentiment weight values. If agents only rely on a "rational" comparison of the performance of pessimism and optimism in terms of profits (as in Cavalli et al. 2017), the equilibrium configuration can solely consist of an even distribution of the agents, with the stock price corresponding to the true fundamental value, as in the analogous scenario occurring in Brock and Hommes (1998). However, as the sentiment weight approaches 1, the switching mechanism is increasingly influenced by the sentiment index, whose size is not only determined by the population shares but also by the distance Δ between optimistic and pessimistic beliefs. More precisely, if the relevance given by the agents to the perceived mood is small (i.e., β is low), agents will more likely choose one of the heuristics indifferently, so that deviations from a uniform distribution are neglectable and shares will settle back to a uniform distribution. Conversely, if the relevance is large (i.e., β is high), even a small excess of pessimistic agents triggers a diffusion of pessimism, which leads the majority of agents becoming pessimists, and symmetrically with optimists.
We return to this aspect after Proposition 4 with the help of the stability analysis and simulated time series. Moreover, as the factors characterizing the agents' behaviors become more extreme (i.e., as the intensity of choice and/or the polarization of the beliefs increase), the effect of the animal spirits is bolstered and a progressively reduced sentiment weight is enough to trigger the emergence of polarized steady states. In this respect, we stress that both the relevance given to the evolutionary selection of heuristics (β > 0) and the heterogeneity degree of beliefs (Δ > 0) are essential because otherwise, only the fundamental steady state would exist (as Eq. 7 is fulfilled).
In accordance with the previous considerations, we introduce the aggregate index s = βσ Δ, which encompasses the effect of the sentiment weight σ enhanced by the evolutionary pressure β and by the heterogeneity degree Δ. From now on, we refer to s as the sentiment strength. We stress that this nonnegative aggregate parameter regulates the threshold value at which S + and S − emerge, since Eq. 7 can be simply rewritten as s ≤ 2.7456.
Proposition 1 showed that the first effect of an evolutionary selection of strategies based on the perceived market mood is the emergence of additional polarized steady states, which are characterized in terms of optimism/pessimism. Now we focus on how the polarization of such non-fundamental steady states is affected by β, Δ and σ, i.e., by the sentiment strength. Supported by a clear rationale, we can say that a steady state becomes more optimistically (resp. pessimistically) polarized if all its components are increasingly characterized in terms of optimism (resp. pessimism), namely, if the steady-state price and the share of optimists increase, while that of pessimists decreases (resp. if the steady-state price and the share of optimists decrease, while that of pessimists increases). Accordingly, we have the following result.
Proposition 2 Provided that σ, β and Δ are such that non-fundamental steady states exist, 4 we have that, on increasing σ, β or Δ, then S + and S − become more and more polarized, the former optimistically and the latter pessimistically; conversely, S + andŜ − become less and less polarized, the former optimistically and the latter pessimistically.
This result reinforces that in Proposition 1, the more the psychological and emotional components are determinant for the choice of optimistic/pessimistic heuristics, the more such polarized steady states divert from the fundamental equilibrium. Indeed, increasing the relevance of the perceived market mood leads to final outcomes that are more strongly characterized (in terms of both prices and shares) by optimism and pessimism. Such a feature reflects the resulting sentiment index at the polarized steady states, which is not "neutral" (I = 0) as at S * , but, in contrast, portrays the pessimistic (I − < 0) and optimistic (I + > 0) mood perceived in the market. Psychological factors can thus strengthen the role of the market sentiment in determining the prices and the shares. Although the opposite may seem to be true regarding the effect onŜ ± , what actually occurs is that, as the polarization degree of S ± decreases, the relevance of S ± increases and that of the fundamental steady state becomes more marginal. This will be more evident in Section 4, when we investigate how the basins of attraction of S * and S ± change depending on the parameters.
The next level of investigation concerns how the stability of S * is affected by the sentiment weight and, more generally, we analyze the effects of the sentiment index on the resulting dynamics. 5 Before presenting such results, we compare the roles of β, Δ and γ on the stability of S * when the evolutionary mechanism is only driven either by the profitability measure 6 (σ = 0) or by the perceived sentiment (σ = 1). Thus we recall that if we consider homogeneous beliefs (Δ = 0) and we consequently neglect the evolutionary switching mechanism (β = 0), it is easy to see that dynamics only consist of the price adjustment mechanism and that S * is stable when γ < 2.
When the price mechanism does not introduce instabilities (γ < 2), increasing the intensity of choice and the heterogeneity degree has a destabilizing effect for both extremal choices of fitness measures (i.e., σ = 0 and σ = 1). Conversely, when the price mechanism introduces instability (γ > 2), suitable intermediate values of β and Δ can stabilize S * when agents choose their strategy based on the profitability measure. Such stabilization does not occur when the fitness measure is given by the sentiment index, as the steady state S * is unstable regardless of Δ and β.
Proposition 3 shows that the same degree of belief heterogeneity has a different effect when the fitness criterion is represented by the profitability measure or by the sentiment index. In the latter case, the role of the parameters affecting the selection mechanism (β) and the agents heterogeneity (Δ) is essentially the same as the stability of S * depends on Δβ; therefore, increasing either β or Δ by the same amount has an identical effect. Conversely, belief heterogeneity has a more intense effect when the strategy choice depends only on profits, since in that case the stability of S * is affected by βΔ 2 . Such dissimilarity can be easily understood in terms of the effect of belief polarization on the fitness measure: the degree of heterogeneity affects the sentiment index through beliefs only once while it affects the profits twice, through the excess demand and through prices, resulting in a "squared" influence. This may occur since agents assign more emphasis to the possibility of realizing a profit evaluating their strategy rather than considering the general mood perceived by the market, which can manifest sluggishly due to some form of slowness in news diffusion about market status.
Concerning the different dynamics 7 associated with the stability loss for σ = 0 and σ = 1, if the reactivity of the price mechanism is suitably small, the fundamental steady state becomes unstable as the intensity with which the agents choose between increasingly polarized beliefs grows. However, while in the former situation 8 we have nonconvergent quasiperiodic trajectories, in the latter case, recalling the comments that follow Proposition 1, if the distance between biased beliefs is suitably large and under strong evolutionary pressure, agents with unbiased beliefs are increasingly attracted by the growing number of agents having biased beliefs. Accordingly, a small perturbation in an equally distributed population of beliefs creates a contagion phenomenon and most agents herd at either the pessimistically or optimistically biased strategy. We stress that with an endogenously nervous price adjustment, if agents choose among strategies on the basis of a profitability evaluation, a partial stabilization of dynamics is possible in the presence of mild belief heterogeneity and intensity of choice. This is evident by recalling that the excess demand D t is affected both by price deviations with respect to the fundamental and by a heterogeneous distribution of agents beliefs. For instance, if the asset is overvalued, when the agents choose their strategy based on a profitability evaluation, which is directly determined by prices, there is an increase in the number of optimistically biased agents, which counterbalances the intrinsic tendency to sell of fundamentalists, allowing for a milder price adjustment. This is not possible when agents make decisions on the basis of the perceived market mood, since it is not directly affected by price dynamics. In such cases, if belief polarization and evolutionary pressure do not trigger a herding effect, the agents tend to randomly choose their strategies, equally distributing among biased and unbiased strategies, and the market marker adjusts prices only overreacting to their deviations from the fundamental.
To better focus on the role of the sentiment index, in what follows we consider the case γ < 2, i.e., the price adjustment mechanism is not responsible for introducing instability. The robustness of the results for γ > 2 are tested in Appendix A, in which we show that, despite some differences in the dynamical scenarios, the economic explanations of the present section and Section 4 about the role of the sentiment component still hold true. In the next result, we study the stability of S * on increasing σ .

Proposition 4
On varying σ ∈ [0, 1], we have that the sentiment weight can produce a destabilizing, stabilizing, mixed or neutral effect on the stability of S * when γ < 2. In particular, both the unconditionally stable and unstable scenarios can occur.
The previous proposition notes the richness of outcomes that can be described by the model as the importance of the sentiment index increases. In addition to the dynamical relevance, explaining each scenario is significant to understand the role of the sentiment index. We postpone the discussion of Proposition 4 to the next section to concentrate on suitably general numerical examples that allow an explanation of the rationale of each arising scenario.

Discussion of the results
In the present section, with the help of numerical simulations, we discuss the analytical results of Section 3 to deepen the understanding of the economic relevance of the dynamical behaviors arising from Eq. 6 focusing on the role of the sentiment index. In particular, the left panel of Fig. 1 contains a comprehensive sketch of the scenarios occurring in the (Δ, β)−space, obtained with γ = 1 and increasing the weight σ associated with the market sentiment. The setting we consider is consistent with that in Proposition 4, namely, instability does not endogenously emerge from the price mechanism (since γ < 2), while erratic dynamics are associated with the switching of agents among strategies driven by profitability evaluations and/or perceived mood. To support the discussion of Fig. 1, we use bifurcation diagrams on increasing σ and time series. In more detail, we run simulations for which we specify the and we set F = 10, a 1 = 2, a 2 = 1, and γ = 1. The remaining parameters β, σ and Δ vary from time to time according to the different regions on the left panel of Fig. 1. We start by focusing on the white region in the left panel of Fig. 1. If Δ and β are suitably small, the increasing relevance assigned to the perceived sentiment has no effect on stability, as both extreme situations in which most agents adopt either the profitability signal or the perceived mood to select strategies lead to a uniform distribution of beliefs. The rationale underlying such scenarios is quite evident. If the context is affected by a very reduced heterogeneity, even if agents are sensitive to differences in strategy performances, the profitability signal given by each strategy is small, even in the presence of an excess of one type of biased agents (e.g., optimists), as their bias is reduced. The result is that any inhomogeneity in the agent distribution is not sustained by the opportunity to realize profits adopting the most diffuse strategy, and the mean reverting mechanism of the fundamentalist belief drives the agents to uniformly distribute among the three strategies. A similar scenario occurs when agents make decisions based on the sentiment. For instance, even if the market is initially populated by many pessimists, their negative bias is small, and the overall sentiment is too weakly characterized by pessimism to self sustain so that again, agents randomly choose among the possible strategies. The symmetric situation, in which beliefs are polarized but agents do not rely on them very much, can be explained similarly. In such case, the agents observe a difference in the performance of each strategy, but they are slightly sensitive to this, and again a uniform distribution of agent types is the only possible distribution. Considering intermediate scenarios for the agent distributions, realized by 0 < σ < 1, we obtain the same effects, and hence, S * is stable regardless of the adopted fitness measure.
Let us now increase agent heterogeneity, keeping their intensity of choice small (red region in the left panel of Fig. 1). In this case, the effect of heterogeneity plays a stronger role on the profitability measure than on the general sentiment, so that we have a situation in which S * is unstable for σ = 0 and stable for σ = 1 (see the comments after Proposition 3); thus, the sentiment index has a stabilizing effect on S * , which is also evident from the one-dimensional bifurcation diagram in the central plot of Fig. 1, obtained for sufficiently polarized (Δ = 4) beliefs and for a small value of the intensity of choice (β = 0.6). When the sentiment index has no relevance (σ = 0, dashed red line), we detect a continuous switch between phases characterized by optimism and pessimism that, in turn, generates the quasiperiodic dynamics also observed in the red time series shown in the right panel of Fig. 1.
In this setting, evolutionary selection only depends on the profitability measure, which in turn is affected by excess demand and agents heterogeneity. The endogenous oscillations around the fundamental equilibrium can be explained as follows, focusing on, e.g., an initial setting characterized by an optimistic bias, as in the red plot in the right panel of Fig. 1. In such case, the profitability signal is influenced more by overestimating the price than by excess optimistic agents, so that the price slightly decreases, still remaining above the fundamental. However, that signal leads many agents to change their strategy and pessimism spreads. This, jointly with the price overestimation, leads to a decrease in the price, which further bolsters the diffusion of pessimistic agents. At such point, the price lies below the fundamental, and hence the excess demand is influenced more by the purchases of both optimistic and unbiased agents than by the sales of pessimists. The price starts increasing, and the wave of pessimism begins to move back, so that after a few time periods, we have a configuration close to the fundamental equilibrium but now with an underestimation of the price together with dominant optimism, which triggers a symmetric phenomenon with respect to that described above. We note that the switching mechanism mostly affects biased strategies, while fluctuations in the share of unbiased agents are small. The economic motivation of this is clear; for instance, if the profitability signal fosters a diffusion of pessimism, an optimistic agent will more likely adopt an unbiased strategy, while an unbiased agent will more likely become a pessimist so that the number of unbiased agents will not change.
When σ = 1, the previous phenomena do not take place, as the selection mechanism does not depend on excess demand and the scenario is the same as that in the situation of large Δ and small β described by the white region in the left panel of Fig. 1. Hence, by increasing σ , the strength of the interplay between prices and shares decreases, as the switching mechanism is more affected by the sentiment index and less affected by profits, which are the source of instability in this setting. The result is that the oscillating motion is partially tamed when the weight of the market sentiment increases (σ = 0.28, green color) since agents are also affected by the perceived market mood, which pushes them to switch to another strategy less impetuously. Finally, when agents consider the market sentiment (σ = 0.48, yellow color) more, the dynamics of the price and the shares stabilize. Accordingly, agents equally distribute among biased and unbiased strategies, the market maker adjusts prices only reacting to their deviations from the fundamental and the final effect is a stabilization in the price and the population fractions. Conversely, if the belief polarization is small (Δ < 2) and we increase the intensity of choice, since in this case the effect of heterogeneity on the profitability measure is weaker than before, we have a situation in which S * is stable for σ = 0 and unstable for σ = 1. The consequence is that, as σ increases, S * can lose stability (yellow region of Fig. 1, left plot). However, such instability does not mean that dynamics become erratic but rather that agents start herding toward the same strategy, and this drives the evolution of prices toward either the optimistically or the pessimistically biased new steady state. The economic rationale for those polarized steady states can be ascribed to an increased sensitivity assigned to the utility of being either pessimistic or optimistic, as also remarked in the comments after Proposition 1. Depending on the initial deviation in the shares toward one of the biased strategies, most of the agents herd around pessimism (blue bifurcation diagram) or optimism (red bifurcation diagram). This kind of herding phenomenon starts occurring if the sentiment index is suitably relevant in selecting strategies among the agents. In such an intermediate situation, all the three strategies coexist. This is illustrated in the central plot of Fig. 2 where the time series of the relevant variables are reported for different initial conditions. We observe that an initial degree of optimism or pessimism can determine the convergence toward an attractor that reflects the same polarized optimism or pessimism only, while if this degree is not significant, the contagion effect does not occur and agents converge toward the fundamental steady state. This can be explained by noting that in such intermediate framework, the relevance of the perceived market mood is still opposed by the profitability signal. Hence, only in the presence of an initial situation that is already strongly characterized in terms of optimism/pessimism the contagion effect takes place; otherwise, biased agents are too few to attract other agents. This is also confirmed by looking at the right plot of Fig. 2, in which we report the corresponding basins of attraction of the different steady states (green is associated with S + , gray with S * and yellow with S − ). We remark that, as we mentioned in the comments following Propositions 1 and 2, unconditionally unstable steady statesŜ ± do not play an active role, but they pinpoint the position and the extent of the basins of attraction of biased equilibria, indirectly determining their strength and relevance. If σ further increased, we would observe that the basin of the unbiased fundamental steady state continues to shrink until S * becomes unstable. In this scenario, the role of the sentiment index is so large that the contagion phenomenon affects all agents, who are all pushed toward a polarized strategy. The final state to which the economic variables converge is then affected by the sentiment perceived by the agents, which self-sustains and reinforces the occurrence of more extreme levels of optimism/pessimism associated with the emerging steady states.
The remaining scenarios corresponding to the magenta and blue regions in the right panel of Fig. 1 can be explained by combining elements of the above discussion. For example, for an intermediate degree of heterogeneity and evolutionary pressure, we have that the fundamental steady state is unstable in the two extremal frameworks identified by σ = 0 and σ = 1, giving rise to oscillations between optimistically and pessimistically biased scenarios for σ = 0 and to a herding phenomenon when σ = 1. However, for intermediate values of σ , the negative feedback of the profitability measure is offset by the positive feedback of the sentiment index and their effects  Fig. 2 The bifurcation diagram in the left panel shows the emergence of the new polarized steady states, highlighted in red (optimistic) and blue (pessimistic), as a consequence of a fold bifurcation. The central panel depicts the time series evolution for the price and the shares obtained for σ = 0.75 while the right panel portrays the basins of attraction for the three steady states (green color is associated with S + , gray to S * and yellow to S − ). Other parameters are: Δ = 1.5, β = 2.5, and initial conditions are taken suitably close to S * . For the orbits converging to S + we selected initial conditions P = 10.25, ω o = 0.6, ω p = 0.1 while for those converging to S − they are P = 9.75, ω o = 0.1 and ω p = 0.6 cancel out, giving rise to stable dynamics (magenta region). This is also highlighted by the bifurcation diagram in the left panel of Fig. 3, where we observe the occurrence of the mixed scenario with an intermediate stabilization of quasiperiodic dynamics after which S * undergoes a fold bifurcation, which gives rise to the two polarized steady states, S + and S − .
Finally, when the evolutionary pressure β is very strong, agents sharply switch between the strategies, a more polarized steady-state configuration occurs, and the stability of the fundamental steady state cannot be recovered (blue region). Nonetheless, we can still observe stable configurations with the spread of optimism or pessimism that leads the majority of agents to adopt a biased strategy (middle panel of Fig. 3). The right panel of Fig. 3 reports the basins of attraction of the latter dynamics. Again, the polarization of the dynamics associated with the possible herding behavior of the agents is clearly visible. Fig. 3 The bifurcation diagram in the left plot, obtained for β = 1.5, portrays a mixed scenario on varying σ while the central panel, obtained with β = 4, depicts a situation in which S * is always unstable. The basins of attraction corresponding to the latter framework are reported in the right panel. Other parameters are Δ = 2.5 and initial conditions are taken suitably close to S * . For the dynamics converging to S + we selected initial conditions P = 10.4, ω o = 0.5, ω p = 0.1 while for those converging to S − they are P = 9.6, ω o = 0.1 and ω p = 0.5

Stochastic simulations
The analysis performed in the previous section showed how animal spirits can drive the market toward economic regimes characterized by either optimism or pessimism. We now consider a stochastically perturbed version of the model to determine whether the model can reproduce the qualitative properties of the time series of real-world financial markets. 9 In what follows, we focus on different, increasingly refined, peculiar characteristics of the economic observables time series. A first class of stylized facts consists in some qualitative properties of prices P t and returns R t = 100((P t+1 − P t )/P t ) time series, such as the emergence of bubbles and crashes of stock prices and volatility clustering. A second class includes indicators that aim to estimate the deviation from normality and the persistence of autocorrelation in returns distribution. These two families of stylized facts are those usually considered in the existing literature. Additionally, we also consider a third element of investigation, i.e., multifractality, 10 which is observed in stock markets time series and that is identified as a constitutive element of their complexity.

E(|X(t)| q ) = c(q)t τ (q)+1 ,
where t ∈ [0, T ] ⊂ R and q ∈ [−q 0 , q 0 ] are constants, while c : [−q 0 , q 0 ] → R and τ : [−q 0 , q 0 ] → R are functions of q. The latter, called the scaling function, is useful for discriminating between a monofractal process (where τ linearly depends on q) and a multifractal process (for which τ is a concave function of q). To estimate τ (q), we perform the MultiFractal Detrended Fluctuation Analysis (MFDFA) introduced in Kantelhardt et al. (2002). In agreement with the abovementioned literature, in detecting multifractality, we adopt the following strategy. We evaluate the strength of the multifractality process, which is defined by Δα = α max − α min , where α max and α min are the maximum and the minimum values, respectively, of α(q) = τ (q). This is an index of the concavity (and hence, multifractality) degree of τ (q). Moreover, we study the behavior of Δα on increasing the length N of the considered time series, which has to be monotonically increasing for multifractality to be present. Finally, to rule out the possibility that multifractality is due to a broad probability density function of the time series rather than long-time correlations, we repeat the evaluation of Δα considering randomly shuffled time series.
As a reference example, in Fig. 4, we report the time series of the returns, the autocorrelograms, the plots of Δα depending on N for the S&P 500 time series and for the shuffled time series. The top-right panel in Fig. 4 represents an estimation of the sentiment perceived by the agents, obtained by removing the trend from the 9 For a survey about stylized facts in financial time series, we refer to Bouchaud et al. (2000), Cont (2001), Kukacka and Kristoufek (2020), and Lux and Segnon (2018). 10 More precisely, multifractality is an index to identify the presence of different long-range temporal correlations of observables. A detailed description of what multifractality is can be found in Kantelhardt et al. (2002). Understanding the origin of multifractality in financial markets is an issue that has been addressed in, e.g., Barunik et al. (2012) and that in many real cases stemmed from the large fluctuations of prices (Zhou 2012). price series and plotting the resulting zero mean detrended time series (blue line), which actually provides an estimation of the market sentiment. We identify optimistic and pessimistic periods by simply observing the index sign, and we highlight them through the orange lines. As we can see, we have the alternation of long-lasting periods of optimism and pessimism. We stress that the common features in financial market time series are the presence of spikes and perceptible volatility clustering in the returns time series (top-left panel in Fig. 4), polarization of consecutive periods of optimistic and pessimistic behavior (top-right panel in Fig. 4), uncorrelated returns, a slowly decreasing correlation of absolute returns (second row in Fig. 4), and multifractality due to a long-range correlation of returns (third row in Fig. 4).
Consistent with the literature on financial markets, in what follows, we perform a model evaluation to determine whether the introduction of the sentiment index can improve the qualitative representation of the abovementioned aspects. To this aim, we now move to the description of the stochastically perturbed version of the model in Eq. 6. In particular, we assume that the true fundamental value follows the random walk where {ε F,t } are normally distributed random variables with standard deviation s 1 > 0 and zero mean. The deterministic version of the model is thus adapted by replacing the original variable X i , i ∈ {p, o, f }, with time-dependent X p,t = F t − Δ/2, X o,t = F t + Δ/2 and X f,t = F t . We stress that also in De Grauwe and Rovira Kaltwasser (2012), the bias about the fundamental remains unchanged, while the fundamental may vary. Moreover, as in Franke (2010), we introduce a random perturbation of beliefs, proportional to the price, i.e., where {ε X i ,t } are normally distributed random variables with standard deviation s 2 > 0 and zero mean, which describe a temporary perturbation of the agents heterogeneity level. 11 This allows the stochastic version of the system in Eq. 6 to be obtained, with F replaced by F t , to which Eqs. 8 and 9 have to be added.
We report the outcomes of our stochastic model in Fig. 5, where the parameter setting is F = 10, Δ = 2.7, a 1 = 2, a 2 = 1, β = 1.5 while γ is set equal 12 to 0.02. In the presence of exogenous shocks on the fundamental value, periods of high volatility in the price course may alternate with periods in which prices do not depart too much from the fundamental value. Such behavior can arise when the parameter setting is located near the bifurcation boundary and exogenous noise can occasionally spark long-lasting endogenous fluctuations around the new occurring steady states. More precisely, the top left panel in Fig. 5 displays a typical plot for the price time series obtained for s 1 = 0.003 and s 2 = 0.035, which highlights the very erratic price course with alternating bubbles and crashes. The corresponding returns time series is reported in the top-right panel of Fig. 5, which reflects the alternating periods of high and low volatility and exhibits volatility clustering, highlighted by the strongly positive, slowly decreasing autocorrelation coefficients of absolute returns (right plot in the second row of Fig. 5) in contrast to the insignificant autocorrelation coefficients of returns displayed in the left plot of the second row. Moreover, deviation from normality in the returns distribution only occurs as the herding phenomenon takes place, i.e., as the sentiment index plays an increasingly relevant role in determining agents choices, as shown in the third row of Fig. 5. The reported kurtosis analysis is in good agreement with that of S&P 500 returns. In fact, Corrado and Su (1996) showed that kurtosis of S&P 500 returns is estimated to be larger than 3, and on average equal to 3.47. The presence of fat tails implies that, when the sentiment index drives the market, large returns often occur, corresponding to strong movements in prices and thus to more volatility in the financial market in agreement with the well-known empirically observed stylized facts. The panels in the fourth row of Fig. 5 contrast the time series of the sentiment index I t when σ = 0 and σ = 1 (in the left and right plots, respectively). When σ = 0, it is possible to observe the emergence of periods of prevailing optimism or pessimism only if we deal with a moving averagē I t of I t on a suitable number of periods (in the reported simulation,Ī t is computed considering the last 5 values assumed by the sentiment index at each time period t). This means that there is alternation of periods characterized by the prevalence of a certain sentiment, but such phenomenon is quite weak and can be perceived only considering an average behavior over a proper number of periods. Conversely, when agents choose strategies based on the sentiment index, there exist waves of optimism and pessimism that are much more long-lasting than when the influence from behavioral aspects is neglected in agent choices. Namely, in such latter case, optimism and pessimism quickly alternate due to a continuous and recurrent evaluation of market beliefs based only on market performance. The rationale for the waves of optimism and pessimism occurring can be explained as follows: assume that agents have the choice of using biased beliefs about the fundamental value of the asset and that they seek to opt for the one that provides them higher profitability. When the price volatility is low, the biases do not diverge too much from the fundamental and agents act more or less independently (some of them being optimists and the others pessimists). Accordingly, the market maker price adjustment will not be too strong, and the price volatility remains low. In other words, the negative feedback induced by the traders compounds the one induced by the market maker, and prices may converge, with alternating periods of optimism and pessimism. However, when the price dynamics are more turbulent, agents may prefer to observe other agents' choices more closely and possibly imitate them. The resulting herding behavior implies that agents' choices become increasingly aligned (i.e., they behave less independently) on values that differ from the fundamental steady state. This may be the case in which the optimistic and pessimistic steady states emerge. In such an eventuality, agents' orders are less balanced around the fundamental value and the market maker can no longer mediate among them. Therefore, the market maker's price adjustments over/under react to those misalignments and the volatility remains high.
The emergence of long-lasting alternating periods of optimism and pessimism can be understood in light of the stability analysis. As we have shown in Section 3, the most economically relevant phenomenon occurring when the market is driven by the general mood is that polarized regimes emerge, in terms of both possible steady states, attractors and basins of attraction. In the simulation reported in Fig. 5, for σ = 1, the fundamental steady state is unstable, and deterministic trajectories can converge toward the polarized steady states. Since the stock price is affected by shocks, due to the "polarized" structure of the basins of attraction, the trajectories persist in the basin of the same attractor (e.g., of the optimistic attractor) for several periods until a random deviation moves them into the basin of the other attractor (e.g., of the pessimistic one), in which trajectories wander until a similar phenomenon drives them back into the basin of the former attractor. In this process, prices are close to a random walk, with optimistic and pessimistic agents frequently switching between the two strategies.
Finally, in the last row of Fig. 5, we compare the multifractality of the time series when agents choose their strategy only based on the profit evaluation (σ = 0) or only considering the sentiment perception (σ = 1). The results are obtained considering the average values derived from 1,000 simulations. As we can see, in the former case Δα remains constant, in contrast with a typical multifractal pattern. For such reason, we do not report the plot of Δα obtained with shuffled time series, which is similar to the original time series and does not provide further relevant information. Conversely, in the latter case Δα is increasing (right panel of Fig. 5, solid line), providing evidence for multifractality with a significant strength when N = 16, 000. The result is corroborated by the decreasing behavior of the shuffled time series (right panel of Fig. 5, dashed line), which confirms that the source of multifractality is the long-time correlation of the observables. All the previous considerations suggest that the more refined modeling of animal spirits behavior allows for a better agreement between simulated and real time series.

Concluding remarks
In the economic literature, there exist several contributions (e.g., Cavalli et al. 2017;De Grauwe and Rovira Kaltwasser 2012;Naimzada and Pireddu 2015) showing that diverting from the perfect rationality assumption on the agents' behavior, the waves of optimism and pessimism observed in financial markets can be explained in terms of endogenous fluctuations originated by the evolutionary selection of simple heterogeneous heuristics and/or by imitation mechanisms. However, changes in the psychological and emotional perceptions of the market are not only consequences of the agents' choices being also part of the process on which decisions are made. In this work, we developed a financial market model with heterogeneous agents whose decisions are not only based on an individual evaluation of the market performances but also consider a form of market sentiment. When the mechanism which regulates the evolutionary selection of forecasting rules is based on a combination of the average mood perceived by the agents about the status of the market and a precise evaluation of the profits, new economic regimes arise, different from those occurring when agents decisions are not driven by "animal spirits". Such regimes are characterized by persistently polarized levels of optimism and pessimism, highlighted by high/low beliefs and prices, as well as by a large share of optimists or pessimists. An excess of optimism or pessimism may endogenously give rise to outcomes that can be seen as the result of a self-sustaining herding phenomenon. Endogenous waves of optimism and pessimism may be generated by animal spirits, especially when decision mechanisms are based on both market sentiment and profits evaluation. Moreover, as the role of the sentiment index becomes predominant, those waves are reinforced by possible endogenous dynamics around self-fulfilling economic regimes and, when nondeterministic effects are considered, give rise to alternating long-lasting periods of polarized economic regimes. Our future research will aim to deepen the study of the role of animal spirits as the drivers of economic decisions, extending the pursued approach to other macroeconomic frameworks, also involving the real market side.

Appendix A: Case with γ > 2
In the next result, we study the stability of S * on increasing the role of the sentiment weight for γ > 2, i.e., when the price mechanism is the source of instability.
Proposition 5 On varying σ ∈ [0, 1], we have that the sentiment weight can have a destabilizing, mixed or neutral effect on the stability of S * when γ > 2. In particular, only the unconditionally unstable scenario can occur, while the unconditionally stable scenario can not.
The possible scenarios are reported in the left plot of Fig. 6. In what follows, we give an idea of the economic explanation of those scenarios, since the unique new element to be considered is the instability of the price mechanism, while the other Fig. 6 In the left panel, for each pair of Δ and β, different colors correspond to different stability scenarios of S * on increasing σ , each scenario is denoted by different colors according to the color bar: yellow refers to the destabilizing (D) scenario, magenta and blue are employed to highlight the emergence of mixed (M) and unstable (UU) scenarios. Above the dashed line we have the (Δ, β) combinations for which, for suitably large values of σ, non-fundamental steady states exist, coexisting with S * . The bifurcation diagram in the central panel (Δ = 1.4, β = 0.8) depicts the destabilizing scenario on varying σ, while that in the right panel (Δ = 2, β = 2.5) depicts a mixed scenario. Initial conditions are chosen suitably close to S * , S + and S − in the black, red and blue diagrams, respectively aspects have already been discussed for γ < 2 in Section 4. According to Proposition 3, when both Δ and β are small (blue region in the left lower part of the left plot of Fig. 6), the fundamental steady state is unstable because of the overreaction of the market maker in adjusting prices based on the excess demand. Such nervous price adjustment can be compensated by the distribution of agent shares only if they give suitable relevance to the profitability signal and if strategies are sufficiently heterogeneous, so that for larger values of Δ and β, we have that S * is stable for σ = 0. However, the more the agents consider the sentiment index, the less the price affects their choice about the strategy to adopt, and thus the previous compensation effect fails, and the price turbulence leads to a nervous switching among strategies. In this case, the sentiment weight plays a destabilizing role (yellow region in the left plot of Fig. 6), and it can foster the emergence of periodic and chaotic dynamics, as evident from the bifurcation diagram in the middle plot of Fig. 6. As Δ and β further increase, we again find the mixed scenario (magenta region in the left plot of Fig. 6), similar to that in Fig. 1. The main difference is that now the instability of the price mechanism can lead to unstable, chaotic dynamics around the non-fundamental steady states, as highlighted by the bifurcation diagram in the right plot of Fig. 6.

Appendix B: Proof of the analytical results
To prove some of the results of Section 3, we make use of the following The associated dynamical equation A t+1 = h(A t ) always has the steady state A * = 0, which is unique if q < 2.7456. At q f ≈ 2.7456 a double fold bifurcation occurs, and four additional steady statesÂ + , A + ,Â − , A − exist for q ∈ (2.7456, 3), withÂ + = −Â − > 0 and A + = −A − > 0. At q = 3 a double transcritical bifurcation occurs, and bothÂ + andÂ − collide with A * , disappearing, so that the dynamical equation has just two additional steady states A + , A − , with A + = −A − > 0. When existing,Â + andÂ − are always unstable and their absolute value decreases as z = e qA increases, while the absolute value of A − and A + increases as z increases.
Note that the fold bifurcation could not occur if A 2 = log(z 2 ) q > 1, but this is not the case. Namely, for q > 8/3 it holds that log(z 2 ) < log 3q+ where the last inequality can be proven by observing that 3q < q + q 2 2 + q 3 3 < e q for q > −3+ √ 57 2 and that −3+ √ 57 2 < 8 3 . A simple geometrical consideration allows concluding thatÂ + is strictly decreasing with respect to q, while A + is strictly increasing with respect to q. For increasing values of σ ∈ (σ f , σ tc ) = (2.7456, 3), the unstable equilibriumÂ + decreases as long as it collides for σ = σ tc with A = 0, which loses its stability, due to a transcritical bifurcation. Namely,Â + collides with A = 0 when P (1) = 0, i.e., when q = 3.
Recalling the oddness of h (and hence of g, as well), we can infer by symmetry the properties onÂ − and A − .
Proof of Prop. 1 Setting P t+1 = P t = P and ω p,t+1 = ω p,t = ω p , ω o,t+1 = ω o,t = ω o from Eq. 1 we obtain F − P + Δ 2 (ω o − ω p ) = 0, from which it follows that P = F + I, which, used in Eqs. 4 and 5, provides Computing ω o − ω p we find when setting A = ω o − ω p and q = s = Δβσ . From Eq. 13 we have that the steady states of the system in Eq. 6 are in one to one correspondence with the fixed points of map h studied in Lemma 1. Recalling that at the equilibrium it holds that P = F + I and using Lemma 1, the fixed point A * = I * = 0 corresponds to the fundamental steady state S * = (F, 1 3 , 1 3 ), which always exists, as well as S i andŜ i correspond to A i andÂ i for i ∈ {+, −}. Existence intervals with respect to βΔσ in Proposition 1 are obtained from those with respect to q in Lemma 1. We conclude the proof by checking that the instability ofŜ + and S − is inferred by that ofÂ + andÂ − . We just focus onŜ + (i.e., we can assume ω o − ω p > 0) and we shall omit the explicit proof thatŜ − is unstable for the system in Eq. 6, due to its similarity.

Proof of Prop. 2
The comparative statics results on equilibria S can be inferred from those obtained for A in Lemma 1. We recall that function h defined in Eq. 10 is odd, increasing and continuous on (−1, 1). Since the role of σ, Δ and β in the expressions in Eq. 12 is exactly the same as that of q in h, being q = s = Δβσ, we can only deal with one parameter, e.g. β. From P = F + I , with I = Δ 2 A, it immediately follows that at the various non-fundamental steady states of Eq. 6 both P and I react in the same manner as the non-null steady states of h to a variation in β.