1 Introduction

Representing agents as heterogeneous and boundedly rational actors has become a common modeling assumption in several economic contexts. Such an assumption 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; Hommes2001; Kindleberger and Aliber 2005). The literature that stems from these ideas is burgeoning and widespread (see, e.g., Brock and 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; Liang2018).

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 A.

2 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.Footnote 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., \(\delta ^{e}_{t+1}=\bar {\delta },\) the fundamental value of the asset can be computed as \(F =\bar {\delta }/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 Xp = FΔ/2 and Xo = F + Δ/2, respectively, while that of unbiased agents is Xf = 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 Pt is adjusted by a market maker by means of a nonlinear mechanism. The demand functions of each type of agent are then described by di,t = ρ(XiPt),i ∈{p,o,f}, where Pt 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 ωp,t ∈ [0,1],ωo,t ∈ [0,1 − ωp,t] and ωf,t = 1 − ωp,tωo,t, the total excess demand is \(D_{t}=\rho {\sum }_{i\in \{o,p,f\}}\omega _{i,t}(X_{i}-P_{t}),\) which, recalling that \(X_{p}=F-\frac {{{{\varDelta }}}}{2}\) and \(X_{o}=F+\frac {{{{\varDelta }}}}{2},\) can be rewritten as \(D_{t}=\rho (F-P_{t}+\frac {{{{\varDelta }}}}{2}(\omega _{o,t}-\omega _{p,t}))\). The price variation is described by the nonlinear, bounded mechanism

$$ P_{t+1}-P_{t}=f(\gamma D_{t})=f\left( \gamma\rho\Bigl(F-P_{t}+\frac{{{{\varDelta}}}}{2}\left( \omega_{o,t}-\omega_{p,t}\right)\Bigr)\right), $$
(1)

where γ > 0 represents the price adjustment reactivity and \(f:\mathbb {R}\rightarrow (-a_{2},a_{1}),\) with − a2 < 0 < a1, is a twice differentiable sigmoidal function, i.e., an increasing function, satisfying \(f(0)=0, f^{\prime }(0)=1, f^{\prime \prime }(z)>0\) on \((-\infty ,0)\) and \(f^{\prime \prime }(z)<0\) on \((0,+\infty )\). 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,Footnote 2 respectively given by a1 or a2. 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 Dt is given by \(\gamma f^{\prime }(\gamma D_{t}),\) and attains its maximum value γ when Dt = 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

$$ \omega_{j,t+1}=\frac{e^{\beta U_{j,t+1}}}{{\sum}_{i\in\{p,o,f\}}e^{\beta U_{i,t+1}}}, j\in\{p,o,f\}, $$
(2)

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, Ui,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. 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 1995, 1998; Daniel et al. 1998; Barberis et al. 1998). To embody all these features, we introduce the sentiment index

$$ I_{t} = \overline{X}_{t}-F=\sum\limits_{i\in\{p,o,f\}}\omega_{i,t} X_{i} - F=\frac{{{{\varDelta}}}}{2}(\omega_{o,t}-\omega_{p,t}) , $$
(3)

which measures the difference between the average belief \(\overline {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 It provides information about the general degree of optimism or pessimism in the market. When It is positive (negative), portraying the underlying optimistic (pessimistic) perceived market mood, \(\overline {X}\) is larger (smaller) than F. The rightmost expression in Eq. 3 is obtained replacing the occurrences of Xi with their respective explicit expressions. Hence, It 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 It, 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 vp(It) = −It. 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 vo(It) = It. Finally, the value function corresponding to an unbiased strategy must be larger as It is close to zero, at which we must have the highest spread for an unbiased strategy, and therefore we set vf(It) = −|It|.

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 Xi would be πi for i ∈{p,o,f}, where

$$ \pi_{i,t+1} = (P_{t+1} - P_{t}) (X_{i} - P_{t}) $$

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 ≤ NsN agents that make decisions based on the perceived mood, and by 0 ≤ NNsN 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 i ∈{p,o,f} we have

$$ U_{i,t+1} = N_{s} v_{i} (I_{t}) + (N - N_{s}) \pi_{i,t+1} . $$

The fitness measures Up and Uo 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:

$$ \omega_{p,t+1} = \frac{e^{\beta (\sigma (-I_{t}) + (1 - \sigma) \pi_{p,t+1})}}{e^{\beta (\sigma (-I_{t}) + (1 - \sigma) \pi_{p,t+1})} + e^{\beta (\sigma I_{t} + (1 - \sigma) \pi_{o,t+1})}+e^{\beta(\sigma(-|I_{t}|)+ (1 - \sigma) \pi_{f,t+1})}} $$
(4)

and

$$ \omega_{o,t+1} = \frac{e^{\beta (\sigma I_{t} + (1 - \sigma) \pi_{o,t+1})}}{e^{\beta (\sigma (-I_{t}) + (1 - \sigma) \pi_{p,t+1})} + e^{\beta (\sigma I_{t} + (1 - \sigma) \pi_{o,t+1})}+e^{\beta(\sigma(-|I_{t}|)+ (1 - \sigma) \pi_{f,t+1})}}, $$
(5)

where σ ∈ [0,1], denoting the fraction Ns 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,+\infty )\times (0,1)^{2}\to \mathbb {R}^{3},\)(Pt,ωp,t,ωo,t)↦(Pt+ 1,ωp,t+ 1,ωo,t+ 1), with

$$({P_{t+1},\omega_{p,t+1},\omega_{o,t+1}})=(G_{1}(P_{t},\omega_{p,t},\omega_{o,t}),G_{2}(P_{t},\omega_{p,t},\omega_{o,t}),G_{3}(P_{t},\omega_{p,t},\omega_{o,t}))$$

where:

$$ \left\{\begin{array}{ll} G_{1}(P_{t},\omega_{p,t},\omega_{o,t})=P_{t} + f\left( \gamma(F-P_{t}+\frac{{{{\varDelta}}}}{2}(\omega_{o,t}-\omega_{p,t}))\right), \\ \\ G_{2}(P_{t},\omega_{p,t},\omega_{o,t})= \frac{e^{\beta U_{p,t+1}}}{{\sum}_{i\in\{p,o,f\}}e^{\beta U_{i,t+1}}}, \\ \\ G_{3}(P_{t},\omega_{p,t},\omega_{o,t})= \frac{e^{\beta U_{o,t+1}}}{{\sum}_{i\in\{p,o,f\}}e^{\beta U_{i,t+1}}}. \end{array} \right. $$
(6)

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 \(\sigma \rightarrow 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).

3 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

Let σ ∈ [0,1]. The system in Eq. 6 features up to five steady states, among which the (fundamental) steady state \(S^{\ast }= \left (F,\frac {1}{3},\frac {1}{3}\right )\) always exists. More precisely:

  • S is the unique steady state if

    $$ \sigma< \sigma^{f} \approx \frac{2.7456}{\beta {{{\varDelta}}}} ; $$
    (7)
  • five steady states, \(S^{-} \hat {S}^{-}, S^{\ast }, \hat {S}^{+}, S^{+}\), exist if \(\sigma \in \left (\sigma ^{f},\sigma ^{tc}\right )\) with \(\sigma ^{tc}=\frac {3}{\beta {{{\varDelta }}}};\)

  • three steady states, S,S,S+, exist if σ > σtc.

When existing, S+ and S are symmetric w.r.t. S, as well as \(\hat {S}^{+}\) and \(\hat {S}^{-}\) are, with \(I^{-}<\hat {I}^{-}<I^{\ast }=0<\hat {I}^{+}<I^{+}\). Finally, \(\hat {S}^{-}\) and \(\hat {S}^{+}\) are never locally asymptotically stable.

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 Pireddu2015), 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 towardFootnote 3\(\hat {S}^{\pm }\) 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 \(\omega _{o}^{+}\) is greater than both \(\omega _{p}^{+}\) and \(\omega _{f}^{+}\)) or pessimists (\(\omega _{p}^{-}\) is greater than both \(\omega _{o}^{-}\) and \(\omega _{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 \(\mathfrak {s}=\beta \sigma {{{\varDelta }}},\) which encompasses the effect of the sentiment weight σ enhanced by the evolutionary pressure β and by the heterogeneity degree Δ. From now on, we refer to \(\mathfrak {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 \(\mathfrak {s}\le 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,Footnote 4 we have that, on increasing σ,β or Δ, then S+ and S become more and more polarized, the former optimistically and the latter pessimistically; conversely, \(\hat {S}^{+}\) and \(\hat {S}^{-}\) 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 \(\hat {S}^{\pm },\) what actually occurs is that, as the polarization degree of \(\hat {S}^{\pm }\) 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.Footnote 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 measureFootnote 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.

Proposition 3

When σ = 0, the steady state S is locally asymptotically stable provided that \(\frac {3 (\gamma - 2)}{\gamma } < \beta {{{\varDelta }}}^{2} < \frac {6}{\gamma }\). When σ = 1, the steady state S is locally asymptotically stable provided that γ < 2 and βΔ < 3.

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 dynamicsFootnote 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 situationFootnote 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 Dt 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.

4 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 sigmoid function as

$$ f(z) =\left\{\begin{array}{ll} a_{1}\tanh\left( z/a_{1}\right) & \text{ if } z\geq 0,\\ a_{2}\tanh\left( z/a_{2}\right) & \text{ if } z< 0, \end{array}\right. $$

and we set F = 10,a1 = 2,a2 = 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.

Fig. 1
figure 1

In the left panel, for each (Δ,β) couple, different colors, according to the color bar, correspond to different stability scenarios of S on increasing σ. Red and yellow refer to the occurrence of a stabilizing (S) and a destabilizing (D) scenario, magenta and blue highlight the emergence of mixed (M) and unstable (UU) scenarios, and white is associated with an unconditionally stable (US) scenario. 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 diagrams in the central panel depict the stabilizing scenario occurring for P on varying σ, and the corresponding effect on the fractions of agents. The right panel contains the evolution of P and the population fractions for the values of σ corresponding to the dashed lines marked in the central plot. Other parameters for central and right plots are Δ = 4, β = 0.6, initial datum P = 10.5, ωo = 0.4, and ωp = 0.3

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 \(\hat {S}^{\pm }\) 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.

Fig. 2
figure 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

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 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.

Fig. 3
figure 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

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.

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.Footnote 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 Pt and returns Rt = 100((Pt+ 1Pt)/Pt) 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,Footnote 10 which is observed in stock markets time series and that is identified as a constitutive element of their complexity.

We recall (see, e.g., Calvet and Fisher 2002) that a stochastic process {X(t)} is named multifractal if it has stationary increments and if

$$ E(|X(t)|^{q})=c(q)t^{\tau(q)+1}, $$

where \(t\in [0,T]\subset \mathbb {R}\) and q ∈ [−q0,q0] are constants, while \(c:[-q_{0},q_{0}]\rightarrow \mathbb {R}\) and \(\tau :[-q_{0},q_{0}]\rightarrow \mathbb {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 \({{{\varDelta }}}\alpha =\alpha _{\max \limits }-\alpha _{\min \limits },\) where \(\alpha _{\max \limits }\) and \(\alpha _{\min \limits }\) are the maximum and the minimum values, respectively, of \(\alpha (q)=\tau ^{\prime }(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 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.

Fig. 4
figure 4

S&P 500 stylized facts. The plots in the first row show the time series of returns (left) and highlight the emergence of optimistic and pessimistic waves (right); in the second row we report the autocorrelation of returns (left) and absolute returns (right); in the third row we display the multifractality strength Δα on increasing the length N of the sample for the original time series (left) and the shuffled one (right)

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

$$ F_{t+1}=F_{t}+\varepsilon_{F,t} F_{t} , $$
(8)

where {εF,t} are normally distributed random variables with standard deviation s1 > 0 and zero mean. The deterministic version of the model is thus adapted by replacing the original variable Xi,i ∈{p,o,f}, with time-dependent Xp,t = FtΔ/2,Xo,t = Ft + Δ/2 and Xf,t = Ft. 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.,

$$ X_{i,t+1}=X_{i,t}+\varepsilon_{X_{i},t}P_{t}, i\in\{p,o,f\}, $$
(9)

where \(\{\varepsilon _{X_{i},t}\}\) are normally distributed random variables with standard deviation s2 > 0 and zero mean, which describe a temporary perturbation of the agents heterogeneity level.Footnote 11 This allows the stochastic version of the system in Eq. 6 to be obtained, with F replaced by Ft, 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, a1 = 2, a2 = 1, β = 1.5 while γ is set equalFootnote 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 s1 = 0.003 and s2 = 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 It 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 average \(\bar {I}_{t}\) of It on a suitable number of periods (in the reported simulation, \(\bar {I}_{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.

Fig. 5
figure 5

The plots in the first row show the time series of prices and returns; in the second row we show the autocorrelation of returns and absolute returns when σ = 1; in the third row we show the kurtosis of returns distribution as σ increases; the fourth row highlights the emergence of waves of optimism and pessimism in the market sentiment index for different values of σ; the fifth row portrays the behavior of the multifractality strength Δα as N increases

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.

6 Concluding remarks

In the economic literature, there exist several contributions (e.g., Cavalli et al.2017; De Grauwe and Rovira Kaltwasser 2012; Naimzada and Pireddu2015) 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.