1 Introduction

In the last few years an increasing interest emerged on epidemic models involving changes in socio-cultural norms and behaviors, partly motivated by the emergence of anti-vaccine movements in different countries and the challenge they pose to the control of epidemic outbreaks.

Several authors divided the susceptible population in three (or more) different groups, the vaccinated, the non-vaccinated individuals, and the ones that decided to remain non-vaccinated, see for instance (Bauch 2005; Bauch and Earn 2004; Pires and Crokidakis 2017). Also, related models considered two groups of susceptible agents, the ones who are aware and those who are not aware of the threat of an infection (Clancy 2018; Misra et al. 2011; Yang et al. 2017). In those cases, each group has its own rate of contagion. Groups with different degrees of susceptibility, such as age-dependent groups, and a class of exposed agents were considered. The difficulty to analyze the corresponding models increases with the amount of classes and groups since they lead to coupled systems of differential equations involving many parameters describing the transitions between different groups.

Usually, agents can move from one group to another due to the mechanisms of the disease (for instance, a susceptible agent was exposed and becomes infected, or an infected agent recovers after the infection), or due to a personal decision based on its own beliefs or the influence of other agents. So, the transitions involve a set of ordinary differential equations modelling the disease dynamics coupled with different social contact processes like the voter model, Axelrod’s cultural transmission model (Axelrod 1997), imitation dynamics (Bauch 2005), or other discrete opinion dynamics models like Galam’s, Sznajd’s, or Ochrombel’s (Galam and Zucker 2000; Ochrombel 2001; Slanina and Lavicka 2003; Sznajd-Weron and Sznajd 2000). Now, the possibility of an epidemic outbreak, and its long-term impact, will depend on the size of those groups, the mechanisms of transmission of the disease, the social contact process, and also on the clustering or other properties of the network modelling the social structure of the population, see for instance (Dorso et al. 2017; da Silva et al. 2019; Su et al. 2018; Tyson et al. 2020; Zhou et al. 2019).

In particular, when vaccines are available, opinion-based models were used to analyze the transition from susceptible to vaccinated states, as a result of social interactions, see (Dorso et al. 2017; Pires and Crokidakis 2017). However, the decision of being vaccinated depends on other factors like their cost, risks, and perceived advantages, see for instance the Bauch’s work (Bauch 2005), where a replicator-type equation was added to a classical SIR model, and the payoff of being vaccinated changes depending on the risk of contagion.

However, there are many infectious diseases that can not be analyzed with these kind of models because their prevention depends on a sustained effort over time through preventive measures, and there are no vaccines available. As a paradigmatic examples we can consider the actual Covid-19 pandemic, the 2009 flu pandemic caused by the H1N1 virus, or the outbreaks of Dengue, Zika, and Chikungunya (Fauci and Morens 2016). In those cases it is possible to analyze the spread of behaviors (and misbehaviors) related to infectious diseases using continuous opinion dynamics models, like the ones considered by Bellomo, Deffuant, Toscani, Weisbuch and their collaborators, see for instance (Aletti et al. 2007; Bellomo 2008; Bellomo et al. 2013; Deffuant et al. 2000; Pedraza et al. 2020; Pérez-Llanos et al. 2018; Toscani 2006).

So, we present here a variant of a classic Susceptible-Infected-Susceptible (SIS) model coupled with a continuous opinion dynamics model. Briefly, the state of any agent j in the society is characterized by the pair \((a_j, p_j)\), where \(a_j\in \{I, S\}\) means that the agent is infected or susceptible, respectively, and \(p_j\in (0,1)\) is a factor reducing the transmission of the disease; \(p_j\) is related to its level of effort to avoid the infection, the lower is \(p_j\), the greater are the prevention measures taken by the agent to avoid contagion.

Let us mention a related model by Funk, Gilad, Watkins and Jansen (Funk et al. 2009), where the discrete set of positive integers \(\{k\}_{k\ge 0}\) represents different levels of awareness or effort (being 0 the maximum level of awareness, which implies immunity against the disease). The spreading of awareness on the population depends on several mechanisms: information transmission due to interaction among agents, a decay term since individuals forget the acquired information, and a reset term since each infected agent becomes fully informed and goes to 0. A Susceptible-Infected-Recovered (SIR) model was considered, which always converges to an equilibrium without infected people. When an infected agent interacts with a susceptible agent at level k, the probability of infection is proportional to \((1-\rho ^k)\) for some fixed \(\rho \in [0,1]\). The authors studied this model using agent-based simulations, and derived a SIR system coupled with an equation for the information diffusion which is non-closed since it depends on the location of agents. Let us observe that long range jumps of agents awareness levels are allowed, since infected agents go directly to zero. This introduces some kind of non-locality to the equations.

In our model, when two agents interact, they change their states as a consequence of both the epidemic and opinion dynamics as detailed in Sect. 2. Informally, although the rates of contact \(\beta \) and recovery \(\gamma \) remain unchanged, a susceptible agent i is infected with probability \(p_i\beta \) after a contact with an infected agent j. Then, both agents i and j increase or decrease their levels of effort depending on the existence or not of contagion after the interaction. We also examine the possibility where the contagion probability depends on the infected agent, \(p_j\beta \), or depends on both agents measures, \(p_ip_j\beta \).

On the other hand, if two susceptible or two infected agents interact, each one moves its own effort level toward the other agents value as in continuous opinion dynamics models (Aletti et al. 2007; Toscani 2006), depending on a third parameter which does not enter in the coefficients of the system of equations. It plays a role only on the formation of consensus, see (Pinasco et al. 2017), since the mean value of the level of effort remains unchanged after this kind of interaction.

We are mainly interested here in the extinction or not of the disease. To this end, in Sect.  3 we derive a system of ordinary differential equations describing the proportion of susceptible agents and the mean value of the level of efforts of the population, \(\langle p \rangle \), in the mean field approximation.

Although the system depends on \(\langle p_S \rangle \), the mean value of the level of efforts of the susceptible population, simulations show that \(\langle p \rangle \) and \(\langle p_S \rangle \) are very similar, and coincide when the parameter in the social interaction goes to zero. So, assuming \(\langle p \rangle =\langle p_S \rangle \), we study the system of ordinary differential equations satisfied by \(\langle p \rangle \) and the proportion S of susceptible agents. We find the fixed points and classify them according to their stability in Sect. 4.

In the long-time limit, when the increase or decrease of the level of effort depends on the same parameter, the value \(\langle p \rangle \) converges to \(\langle p \rangle _\infty =(1+\beta )^{-1}\), independently of the initial distribution of values of p in the population. If they depend on different parameters, we get two values \(\langle p \rangle _\infty ^\pm \), depending on which one is greater, and analogous results hold. We show, in particular, the existence of a threshold depending only on the contact rate \(\beta \) and on the recovery rate \(\gamma \), and not in the initial value of \(\langle p\rangle \), such that the disease does not become endemic if and only if

$$\begin{aligned} R_m:=\langle p \rangle _\infty R_0=\frac{2\beta }{\gamma (1+\beta )}\le 1. \end{aligned}$$

Notice that \(2\beta \) is the rate of contagion in this model, and that \(R_0=2\beta /\gamma \) is the basic reproduction number of the standard SIS model. We call this modified reproduction number \( R_m\) the behaviorally reduced reproduction number, since the factor \(1+\beta \) appears due to the social process and helps to reduce the propagation of the disease, decreasing the basic reproduction number \(R_0\) of the standard SIS model. Notice that this modified reproduction number \(R_m\) is obtained asymptotically when both the SIS and the social dynamics evolve. A discussion of the significance of \(R_m\) is given in Sect. 5. Agent-based simulations of the dynamics strongly agree with the theoretical results.

We conclude in Sect. 6, and we add a short “Appendix” with the derivation of the equation for the evolution of the proportion of susceptible agents, and the corresponding equations for other contagion rules.

2 The Model

Let us assume that we have a population of n agents, each one characterized by a pair \((a_i, p_i)\), where \(a_i\) represents the state of agent i, namely \(a_i=S\) if it is susceptible and \(a_i=I\) if it is infected, and \(p_i \in [0,1]\) denotes its level of effort to avoid infection.

The purely epidemiological parameters are the recovery rate \(\gamma \), and the contact rate \(\beta \). Both are assumed to be constant.

When two agents i, j interact, they will change their parameters from \((a_i,p_i)\) to \((a_i^*,p_i^*)\), and from \((a_j,p_j)\) to \((a_j^*,p_j^*)\) respectively. The recovery dynamic is similar to the classical SIS model: an infected agent becomes susceptible in a unit of time with probability \(\gamma \), without interactions. On the other hand the dynamics of infection depends on the social parameter: if a susceptible agent i interacts with an infected agent, it becomes infected with probability \(p_i \beta \).

Remark 2.1

We are assuming here that only the level of effort of the susceptible agent matters, as in Funk et al. (2009). Alternative rules can be imposed here. For instance, the contagion dynamic could depend on \(p_i\), \(p_j\), or both. These rules can be studied in the exact same way. We present the corresponding equations below, and their derivation can be found in the “Appendix”.

However, drastic changes in effort levels, such as those that occur in Funk et al. (2009), need a different approach, since this model includes long jumps in their values of awareness.

When two agents i and j, either both susceptible or both infected, interact, their level of measures of prevention \(p_i\) and \(p_j\) will change following a social dynamic rule similar to the one introduced by Deffuant and Weisbuch (see (Deffuant et al. 2000; Pérez-Llanos et al. 2018; Toscani 2006)): each agent moves its parameter p toward the other agent’s value. More precisely, following (Deffuant et al. 2000), we introduce a positive fixed parameter \(h \in [0,1]\), the compromise parameter, which measures the ability of an agent to adapt its own level of effort in social interactions. After an interaction with agent j, agent i will change its level to

$$\begin{aligned} p_i^*=p_i + h(p_j - p_i). \end{aligned}$$

When \(h=0\) no change occurs, while for \(h=1/2\) both agents choose the mean value of their levels of effort. This compromise parameter h represents the susceptibility to persuasion, the extent to which an agent is willing to modify its behavior due to the influence of other agents. Different theories from social sciences support this behavior: Asch’s social pressure theory (Asch 1955), where an agent tries to adapt its opinion to others agents opinions, and the persuasive argument theory of Burnstein and Vinokur (1977), where agents exchange arguments and modify their positions after analyzing them.

On the other hand, if a susceptible agent interacts with an infected agent, both will increase (respectively, decrease) their levels of effort whenever the agent remains susceptible (resp., becomes infected). We can think this rule as if both agents have a social interaction with a third hypothetical agent who has the maximum (resp., minimum) level of effort \(p=0\) (resp., \(p=1\)), with two different compromise parameters \(h_1\), \(h_2\in [0,1/2]\). Hence, we have

$$\begin{aligned} p_i^*=p_i - h_1 p_i, \quad \text { or } \quad p_i^*=p_i + h_2(1 - p_i) \end{aligned}$$

if contagion occurs or not.

Let us state precisely the rules of the dynamics, together with their interpretation:

  • Persuasion or imitation: a susceptible (respectively, infected) agent i remains susceptible if he interacts with another susceptible (resp., infected) agent j. Both change their levels of effort to

    $$\begin{aligned} p_i^*= & {} p_i + h(p_j - p_i), \\ p_j^*= & {} p_j + h(p_i - p_j), \end{aligned}$$

    that is, each one adopts an effort level intermediate between its own value and the one of the other agent.

  • Contagion and Fear: a susceptible agent i becomes infected with probability \(p_i \beta \) after an interaction with an infected agent j. In this case, i and j feel that their efforts are not enough, and change their p parameters to

    $$\begin{aligned} p_i^*= & {} p_i- h_1 p_i, \\ p_j^*= & {} p_j- h_1 p_j. \end{aligned}$$
  • Confidence: a susceptible agent i remains susceptible with probability \(1-p_i \beta \) after an interaction with an infected agent j. In this case, i and j feel that their efforts are excessive and change them to

    $$\begin{aligned} p_i^*= & {} p_i+h_2(1-p_i), \\ p_j^*= & {} p_j+h_2(1-p_j). \end{aligned}$$
  • Recovery: a random agent i is selected and becomes susceptible with probability \(\gamma \) if it was infected, and no change of \(p_i\) occur.

Let us observe that both dynamics are coupled, in the sense that the same contact can produce a new infection and a change in the levels of effort of both agents. It is easy to add a separate dynamic which only impacts on the effort of agents.

3 Theoretical Analysis

In this section we derive an ordinary differential equation for \(\langle p\rangle \), the mean value of agents levels of effort, and another one for S, the proportion of susceptible agents.

Let us mention that if \(h_1\ne h_2\), the system is not closed, since it involves the second moment \(\langle p_S^2\rangle \), and we need an extra equation for it. However, this new equation depends on \(\langle p_S^3\rangle \), and so on. This way we get an infinite hierarchy of coupled equations.

There are several ways to deal with this problem. In statistical mechanics and many other problems, under appropriate hypotheses, a closure of moments is introduced to truncate this kind of hierarchies. Another option is to introduce a measure valued function \(\mu _t\) for the distribution of agents on the levels of effort and it is possible to obtain a more detailed description through a Boltzmann-like equation coupled with a SIS system describing the infection dynamics. We prefer to defer the technical details and the mathematical proofs of existence, uniqueness and stability of such equations to another work.

In the next section we consider two simpler approaches.

Let us first introduce the following notation which will be used below. We assume that there are finitely many agents, say n, and denote k(t) the expected number of susceptible agents at time t. The proportions S(t) and I(t) of susceptible and infected agents are then given by

$$\begin{aligned} S(t)=\frac{k(t)}{n},\qquad I(t) = 1-S(t). \end{aligned}$$

The mean values \(\langle p \rangle \), \(\langle p_S \rangle \) and \(\langle p_S^2 \rangle \) of the p parameter in the susceptible population and the mean of p in the whole population are

$$\begin{aligned} P_S =&\sum _{i\in \mathrm{Sus}} p_i, \qquad \qquad \langle p_S \rangle = \frac{P_S}{k(t)}, \\ \langle p_S^2 \rangle =&\frac{1}{k(t)} \sum _{i\in \mathrm{Sus}} p_i^2, \qquad \langle p \rangle = \frac{1}{n}\sum _i p_i, \end{aligned}$$

where we denote by Sus and Inf the (time dependent) subsets of susceptible and infected agents respectively.

We assume that interactions between agents occur following a Poisson process with constant rate, that can be assumed equal to 1 without loss of generality, rescaling time if necessary, In particular the probability of an interaction in a small time interval \([t,t+\Delta t]\) is \(\Delta t+o(\Delta t)\), no interaction occurs with probability \(1-\Delta t+o(\Delta t)\), and two or more interactions occur with a negligible probability \(o(\Delta t)\). In what follows we will neglect the \(o(\Delta t)\). When an interaction occurs, two agents are selected at random (uniformly across all agents), and they interact following the rules described in Sect. 2.

Our main objective in this section is to derive the differential equations describing the evolution of the expected values of S(t) and \(\langle p\rangle \).

3.1 Evolution of the effort level of a single agent.

Let us fix a single agent i, and study the evolution of its effort level at time t, i.e. the expected change \(p_i(t+\Delta t)-p_i(t)\) in a small time window \([t,t+\Delta t]\). We have the following master equation for \(p_i(t+\Delta t)\):

$$\begin{aligned} p_i(t+\Delta t) = (1-\Delta t) \, p_i(t) + \Delta t \, p_i^*(t), \end{aligned}$$
(1)

where the first term is the probability that no interaction occurs and \(p_i\) remains the same, and, in the second one, we have the expected value of \(p_i^*\) when a single interaction occurs. In order to compute \(p_i^*\) we need the possible values it can take and their probabilities, which depend on the state of agent i.

The probability that agents i and j are selected is \(\frac{2}{n(n-1)}\). Notice that the factor 2 comes from the fact that agent i can be selected as the first or second agent in the interaction. If we derive a classical SIS model under this assumption, we get \(R_0=2\beta /\gamma \), a fact that must be remembered in order to compare it to the modified reproduction number when agents behaviors are considered.

Let us assume first that i is a susceptible agent at time t. The new value \(p_i^*\) will change depending on the following two things: that an infection occurs if the other agent is infected, and the specific level of effort of agent j if it is susceptible. We have

  • \(p_i^*=p_i -h_1p_i\), when i becomes infected after interacting with one of the \(n-k\) infected agents. This event occurs with probability \(\frac{2}{n}\frac{n-k}{n-1}\beta p_i\);

  • \(p_i^*=p_i + h_2(1-p_i)\) when i remains susceptible after interacting with one of the \(n-k\) infected agents, which occurs with probability \(\frac{2}{n}\frac{n-k}{n-1} (1-\beta p_i)\);

  • \(p_i^*=p_i-h(p_i-p_j) \) when i interacts with another susceptible agent j, which occurs with probability \(\frac{2}{n(n-1)}\), for any susceptible agent j we can choose.

After replacing in Eq. (1) and rearranging terms, we get

$$\begin{aligned} \begin{aligned} p_i(t+\Delta t) - p_i(t) =&\frac{2 \Delta t}{n(n-1)} \left[ - h_1(n-k)\beta p_i^2 + h_2(1-p_i)(n-k) (1-\beta p_i) \right. \\&\qquad \qquad \qquad \left. - h \sum _{j\in \mathrm{Sus}} (p_i-p_j) \right] . \end{aligned} \end{aligned}$$
(2)

Remark 3.1

Let us remark that in the last term of the sum all the susceptible agents appear since the expected level of effort depends on the particular agent we choose, while in the first and second terms we can select any of the \(n-k\) infected agents and their parameters do not enter in the computation.

If the probability of contagion depends on the parameter of the infected agent, or on the parameters of both agents, we must change the probability of contagion and the selection of the involved agents accordingly, see Sect. 3.3 below.

Now we consider the case that i is an infected agent. The value \(p_i^*\) will depend on the specific parameter of the susceptible agent j we choose, and whether or not contagion occurs. The probabilities that i infects or not j are

$$\begin{aligned} Prob(i \text { infects }j) =&\frac{2}{n(n-1)}\beta p_j,\\ Prob(\text {i does not infect j}) =&\frac{2}{n(n-1)}(1-\beta p_j). \end{aligned}$$

We write again the expected change of \(p_i^*\) as a conditional probability on the effort of the particular susceptible agent:

  • \(p_i^*=p_i -h_1p_i\) when the other agent becomes infected, and this occurs with probability \(\frac{2\beta }{n(n-1)}\) for each susceptible agent j;

  • \(p_i^*=p_i + h_2(1-p_i)\) when the other agent remains susceptible,and this occurs with probability \(\frac{2\beta p_j}{n(n-1)}\) for each susceptible agent j;

  • \(p_i^*=p_i-h(p_i-p_j) \) when i interacts with any other infected agent j, which occurs with probability \(\frac{2 (1-\beta p_j))}{n(n-1)}\).

Hence, after replacing in the master Eq. (1) we obtain

$$\begin{aligned} p_i(t+\Delta t) - p_i(t) =&\frac{2 \Delta t}{n(n-1)} \left[ - h_1 p_i \sum _{j\in \mathrm{Sus}} p_j\beta + h_2(1-p_i) \sum _{j\in \mathrm{Sus}} (1- p_j\beta ) \right. \\&\qquad \qquad \qquad \qquad \left. - h\sum _{j\in \mathrm{Inf}}(p_i-p_j)\right] . \end{aligned}$$

We can write the last equation in a more compact way noticing that

$$\begin{aligned} \sum _{j \in \mathrm{Sus}}p_j = P_{S}, \qquad \sum _{j \in \mathrm{Sus}} (1 - p_j\beta ) = k - \beta P_{S}, \end{aligned}$$

and we obtain

$$\begin{aligned} \begin{aligned} p_i(t+\Delta t) - p_i(t) =&\frac{2 \Delta t}{n(n-1)} \left[ -h_1\beta p_i P_{S} +h_2(1-p_i)(k - \beta P_{S}) \right. \\&\qquad \qquad \qquad \left. -h\sum _{j\in \mathrm{Inf}} (p_i-p_j) \right] . \end{aligned} \end{aligned}$$
(3)

Finally, dividing by \(\Delta t\) in (2) and (3), and taking the limit as \(\Delta t\rightarrow 0\), we obtain an ordinary differential equation for \(p_i\) when i is a susceptible or infected agent,

$$\begin{aligned} \frac{\text {d}}{\text {d}t} p_i(t)= & {} \frac{2 }{n(n-1)} \Big [ - h_1(n-k)\beta p_i^2 + h_2(1-p_i)(n-k) (1-\beta p_i)\nonumber \\&- h \sum _{j\in \mathrm{Sus}} (p_i-p_j) \Big ] \end{aligned}$$
(4)
$$\begin{aligned} \frac{\text {d}}{\text {d}t} p_i(t)= & {} \frac{2 }{n(n-1)} \Big [-h_1\beta p_i P_{S} +h_2(1-p_i)(k - \beta P_{S})-h\sum _{j\in \mathrm{Inf}} (p_i-p_j) \Big ]. \end{aligned}$$
(5)

3.2 Derivation of the mean-field equations.

We can now obtain the equation for \(\langle p\rangle =\frac{1}{n}\sum _{i=1}^n p_i\), the mean value of p. Splitting the sum as \(\sum _{i=1}^n p_i =\sum _{i\in \mathrm{Sus}} p_i+\sum _{i \in \mathrm{Inf}}p_i\), and using (4) and (5), we obtain

$$\begin{aligned}&\frac{n^2(n-1)}{2}\frac{\text {d}}{\text {d}t} \langle p(t)\rangle \\&=\sum _{i \in \mathrm{Sus}} \Big [ - h_1(n-k)\beta p_i^2+ h_2(1-p_i)(n-k) (1-\beta p_i) - h \sum _{j\in \mathrm{Sus}} (p_i-p_j) \Big ] \\&\quad + \sum _{i \in \mathrm{Inf}}\Big [-h_1\beta p_i P_S+ h_2(1-p_i)(k - \beta P_S)-h \sum _{j\in \mathrm{Inf}} (p_i-p_j)\Big ]. \end{aligned}$$

Noticing that

$$\begin{aligned} \sum _{i \in \mathrm{Sus}} \sum _{j\in \mathrm{Sus}} (p_i-p_j) = \sum _{i \in \mathrm{Inf}} \sum _{j\in \mathrm{Inf}} (p_i-p_j) = 0, \end{aligned}$$

we observe that the parameter h has no influence in \(\langle p \rangle \) since the levels of effort of both agents get closer to each other and the mean does not change. Hence, the competition between fear and confidence drives the dynamics.

Letting \(g:=h_1-h_2\) i.e. \(h_1 = h_2+ g\), after rearranging terms we have

$$\begin{aligned} \frac{n^2(n-1)}{2}\frac{\text {d}}{\text {d}t} \langle p(t)\rangle&=h_2 (n - k)\sum _{i \in \mathrm{Sus}} (1- (1+\beta ) p_i ) + h_2 \sum _{i \in \mathrm{Inf}} (k - \beta P_{S}-p_ik) \\&\qquad - \sum _{i \in \mathrm{Sus}} g(n-k)\beta p_i^2 - \sum _{i \in \mathrm{Inf}} g \beta p_i P_S \\&= h_2(n - k) [2k-(1+2\beta )P_S] - h_2 k \sum _{i \in \mathrm{Inf}}p_i \\&\qquad -\sum _{i \in \mathrm{Sus}} g(n-k)\beta p_i^2 - \sum _{i \in \mathrm{Inf}} g \beta p_i P_S . \end{aligned}$$

Writing

$$\begin{aligned} \sum _{i \in \mathrm{Inf}}p_i = \sum _{i=1}^np_i-\sum _{i \in \mathrm{Sus}}p_i =n\langle p\rangle - k\langle p_S\rangle = n(\langle p\rangle - \langle p_S\rangle ) + (n-k)\langle p_S\rangle , \end{aligned}$$

we obtain

$$\begin{aligned} \frac{n^2(n-1)}{2}\frac{\text {d}}{\text {d}t} \langle p(t)\rangle&= 2 h_2 (n - k)k [1-(1+\beta )\langle p_S\rangle ] - h_2 k n(\langle p\rangle - \langle p_S\rangle ) \\&\qquad - g(n-k)\beta k\langle p_S^2\rangle - g\beta P_s [ n(\langle p\rangle - \langle p_S\rangle ) + (n-k)\langle p_S\rangle ], \end{aligned}$$

and by dividing by \(n^2\),

$$\begin{aligned} \frac{(n-1)}{2}\frac{\text {d}}{\text {d}t} \langle p(t)\rangle =&2 h_2 S(1-S) [1-(1+\beta )\langle p_S(t)\rangle ] - h_2 S ( \langle p\rangle - \langle p_S\rangle ) \\&\qquad - g\beta S\Big [ (1-S) \langle p_S^2\rangle + \langle p_S\rangle [ (\langle p\rangle - \langle p_S\rangle ) + (1-S)\langle p_S\rangle ]\Big ]. \end{aligned}$$

Finally, we can rescale time to get rid off the factor \(n-1\). Rearranging the terms we obtain the equation

$$\begin{aligned} \begin{array}{rl} \frac{\text {d}}{\text {d}t} \langle p\rangle =&{} 4h_2 S(1-S) [1-(1+\beta )\langle p_S\rangle ] - 2h_2S ( \langle p\rangle - \langle p_S\rangle ) \\ &{} \qquad - 2 g \beta S \Big [(1-S) \Big ( \langle p_S^2\rangle + \langle p_S\rangle ^2\Big ) + \langle p_S\rangle \Big (\langle p\rangle - \langle p_S\rangle \Big ) \Big ]. \end{array} \end{aligned}$$
(6)

Remark 3.2

Let us recall that \(h_1-h_2 = g\), so the last term is not present if \(h_1 = h_2\).

Remark 3.3

In much the same way, we get the equation

$$\begin{aligned} \frac{\text {d}}{\text {d}t} S = (1-S)(\gamma -2\langle p_S\rangle \beta S). \end{aligned}$$
(7)

Its derivation can be found in the “Appendix”. It is similar to the usual derivation of the SIS model. The main differences with classical models are the mean susceptibility \(\langle p_S \rangle \beta \), and the factor 2, which appears since both selected agents can infect or get infected (as opposed to the derivation of the classical SIS equation where only one agent, usually selected first, can get infected).

3.3 Other contagion rules

It is possible to derive the mean field equations for other contagion rules in a similar way. To this end, let us call

$$\begin{aligned} \langle p_I\rangle = \frac{1}{n-k} \sum _{j\in \mathrm{Inf}} p_j, \qquad \langle p_I^2\rangle = \frac{1}{n-k} \sum _{j\in \mathrm{Inf}} p_j^2. \end{aligned}$$

Suppose that when a susceptible agent i interacts with an infected agent j, contagion occurs with probability \(p_j\beta \). In this case, after changing the probability of the different events accordingly, we get the following equations:

$$\begin{aligned} \frac{\text {d}}{\text {d}t}\langle p\rangle =&2h_2 S (1-S)(2-2\beta \langle p_I\rangle -\langle p_S\rangle -\langle p_I\rangle ) \nonumber \\&+ 2 (h_2-h_1) \beta S(1-S)(\langle p_I\rangle \langle p_S\rangle + \langle p_I^2\rangle ), \end{aligned}$$
(8)
$$\begin{aligned} \frac{\text {d}}{\text {d}t} S =&(1-S)(\gamma -2\langle p_I\rangle \beta S). \end{aligned}$$
(9)

On the other hand, if the probability of contagion depends on both effort levels, that is, contagion occurs with probability \(p_ip_j\beta \), we get

$$\begin{aligned} \frac{\text {d}}{\text {d}t}\langle p\rangle =&2 h_2 S (1-S)(2- \langle p_I\rangle -\langle p_S\rangle -2 \beta \langle p_S\rangle \langle p_I\rangle ) \nonumber \\&+ 2 (h_2-h_1) \beta (\langle p_S^2\rangle \langle p_I\rangle + \langle p_S\rangle \langle p_I^2\rangle ), \end{aligned}$$
(10)
$$\begin{aligned} \frac{\text {d}}{\text {d}t} S =&(1-S)(\gamma -2\langle p_I\rangle \langle p_S\rangle \beta S) . \end{aligned}$$
(11)

See the “Appendix” for details.

4 Qualitative study of the dynamic

Let us note that the definition of the microscopic interaction rules given in Sect. 2 concerning the level of effort implies that both susceptible and infected agents react in the same way. This suggests that their mean level of effort would be the same. The agent simulations in the left panel of Fig. 1 confirm this intuition, showing that the difference between \(\langle p_S \rangle \) and \(\langle p \rangle \) is of order h. Thus, taking \(h\ll 1\), we will assume from now on that \(\langle p_S\rangle = \langle p\rangle \).

Notice the Eq. (6) for \(\langle p \rangle \) involves \(\langle p^2 \rangle \), and an equation for \(\langle p^2 \rangle \) would involve \(\langle p^3 \rangle \), and so on, thus resulting in an infinite hierarchy of equations. In order to avoid the infinite hierarchy of moments, we consider two options. The first and simplest one is to limit ourselves to the case \(h_1 = h_2\). Indeed in that case, \(g=0\) and, recalling we assumed \(\langle p_S\rangle = \langle p\rangle \), (6) reduces to

$$\begin{aligned} \frac{\text {d}}{\text {d}t} \langle p\rangle = 4h_2 S(1-S) [1-(1+\beta )\langle p\rangle ]. \end{aligned}$$
(12)

The second one comes from the fact that the variance \(Var(p)=\langle p^2\rangle - \langle p\rangle ^2\) goes to zero, so \( \langle p^2\rangle \sim \langle p\rangle ^2\), and this enables us to deal also with the case \(h_1 \ne h_2\). We show in the right panel in Fig. 1 the evolution of Var(p) for three values of h, and \(h=h_1=h_2\). We observe in the simulations that \(Var(p)=o(h)\).

Moreover, let us note that h disappeared in the limit equation since \(\langle p \rangle \) is invariant under this interaction. Hence, by considering the approximation \(h \gg h_1\), \( h_2\), a consensus is reached in a shorter time scale, see for instance (Pinasco et al. 2017).

Fig. 1
figure 1

Agent based simulations with \(n=10000\) agents, \(\beta =0.7\), \(\gamma =0.3\), and p initially uniformly distributed in [0.7, 0.9]. Left panel: plot of \(\langle p_S\rangle -\langle p\rangle \) for \(h_1=h_2=h=0.1\), 0.01, 0.001, and 0.0001. Right panel: plot of the variance \(Var(p)=\langle p^2\rangle -\langle p\rangle ^2\) for \(h_1=h_2=h=0.01\), 0.001, and 0.0001

4.1 The case \(h_1 = h_2\)

Since \(g=0\), and recalling we assumed \(\langle p_S\rangle = \langle p\rangle \), Eqs. (6) and (7) for \(\langle p\rangle \) and S become

$$\begin{aligned} \frac{\text {d}}{\text {d}t} \langle p\rangle= & {} 4 h_2 (1-S) S [1-(1+\beta )\langle p\rangle ], \end{aligned}$$
(13)
$$\begin{aligned} \frac{\text {d}}{\text {d}t} S= & {} (1-S)\Big ( \gamma -2\langle p\rangle \beta S\Big ). \end{aligned}$$
(14)

Notice that the square \([0,1]\times [0,1]\) is clearly invariant for the system, and that its fixed points in \([0,1]\times [0,1]\) are the line \(\{S=1\}\) and the point \((\langle p\rangle ,S)=\Big (\frac{1}{1+\beta },\frac{\gamma (1+\beta )}{2\beta }\Big )\) with \(\frac{\gamma (1+\beta )}{2\beta }\le 1\).

Let us study the asymptotic behaviour of a solution starting from a point \((\langle p\rangle (0),S(0))\in [0,1]\times [0,1)\). Since \(S(t)<1\) for any t and noticing that \(\frac{\text {d}}{\text {d}t}\langle p\rangle \) has same sign as \(1-(1+\beta )\langle p\rangle \), we see that

$$\begin{aligned} \lim _{t\rightarrow +\infty } \langle p\rangle = p_\infty = \frac{1}{1+\beta }. \end{aligned}$$

We can then rewrite (14) as

$$\begin{aligned} \frac{1}{2\beta }\frac{\text {d}}{\text {d}t} S&= \langle p\rangle (1-S)\Big ( \frac{\gamma }{2\beta \langle p\rangle } - S\Big ) \\&= \langle p\rangle (1-S)\Big ( R_m^{-1}+\varepsilon (t) - S\Big ), \end{aligned}$$

where \(R_m^{-1} := \frac{\gamma (1+\beta )}{2\beta }\) and \(\varepsilon (t){\mathop {\longrightarrow }\limits ^{t\rightarrow +\infty }}0\). We now distinguish three cases.

\(\underline{If R_m^{-1}>1}\) then there exists \(T>0\) such that \(R_m^{-1}+\varepsilon (t) \ge 1\) for any \(t\ge T\). It follows that for \(t\ge T\) we have \(\frac{\text {d}}{\text {d}t}S\ge 0\) with equality only when \(S=1\). We conclude that \(\lim _{t\rightarrow +\infty }S(t)=1\).

\(\underline{If R_m^{-1}<1}\) then for any \(a,b\in [0,1)\), \(a<R_m^{-1}<b\), there exists \(T'>0\) such that for \(t\ge T'\) we have

$$\begin{aligned}&\langle p\rangle (1-s)\Big ( R_m^{-1}+\varepsilon (t) - s\Big ) > 0 \qquad \forall \,s\in [0,a], \\&\langle p\rangle (1-s)\Big ( R_m^{-1}+\varepsilon (t) - s\Big ) < 0 \qquad \forall \,s\in [b,1) \end{aligned}$$

Thus S enters the interval [ab] at some time \(T\ge T'\) and stays there forever. Since this holds for any \(a,b\in [0,1)\) with \(a<R_m^{-1}<b\), we deduce that \(\lim _{t\rightarrow +\infty }S(t)=R_m^{-1}\).

\(\underline{If R_m=1}\) then for any \(\delta \in (0,1)\), there exists \(T'>0\) such that for \(t\ge T'\), \(|\varepsilon (t)|<\delta /2\) so that

$$\begin{aligned} \langle p\rangle (1-s)\Big ( R_m^{-1}+\varepsilon (t) - s\Big ) > 0 \qquad \forall \,s\in [0,1-\delta ]. \end{aligned}$$

Thus if \(S(0)<1-\delta \), then S(t) must enter the interval \([1-\delta ,1]\) at some time \(T\ge T'\) and stay there forever. If \(S(0)\ge 1-\delta \) then \(S(t)\ge 1-\delta \) for any \(t\ge 0\). Since this holds for any \(\delta >0\) we deduce that \(\lim _{t\rightarrow +\infty }S(t)=1\).

We can summarize the previous discussion in the following Theorem.

Theorem 4.1

For any initial condition \((\langle p\rangle (0),S(0))\in [0,1]\times [0,1]\), the solution \((\langle p\rangle ,S)\) of (13)–(14) satisfies

$$\begin{aligned} \lim _{t\rightarrow +\infty } \langle p\rangle = p_\infty =\frac{1}{1+\beta }. \end{aligned}$$

If \(S(0)=1\) then \(S(t)=1\) for any \(t\ge 0\), and if \(S(0)<1\) then

$$\begin{aligned} \lim _{t\rightarrow +\infty } S(t)= {\left\{ \begin{array}{ll} 1 \quad \quad \text {if } R_m\le 1,\\ R_m^{-1} \quad \text {if } R_m>1, \end{array}\right. } \end{aligned}$$

where \(R_m = \frac{2\beta }{\gamma (1+\beta )}\).

4.2 The case \(h_1\ne h_2\)

Assuming that \(h\gg h_1\), \(h_2\), or \(\langle p^2\rangle \sim \langle p\rangle ^2\), Eqs. (6) and (7) for \(\langle p\rangle \) and S read now

$$\begin{aligned} \frac{\text {d}}{\text {d}t}\langle p\rangle= & {} 4h_2 S (1-S) \Big [ 1-(1+\beta )\langle p\rangle + (1-h_1/h_2) \beta \langle p\rangle ^2 \Big ] \end{aligned}$$
(15)
$$\begin{aligned} \frac{\text {d}}{\text {d}t} S= & {} (1-S)\Big ( \gamma -2\langle p\rangle \beta S\Big ). \end{aligned}$$
(16)

We consider first the case \(h_1>h_2\) where fear dominates confidence. It is easily seen that there exists \(p_\infty ^-\in (0, (1+\beta )^{-1})\) such that

$$\begin{aligned} \frac{\text {d}}{\text {d}t}\langle p \rangle \left\{ \begin{array}{lcl} >0 &{} \quad &{} \text{ if } \langle p \rangle \in [0, p_\infty ^-) \\ <0 &{} \quad &{} \text{ if } \langle p \rangle \in [p_\infty ^- , (1+\beta )^{-1}) \end{array}\right. \end{aligned}$$

Thus \(\langle p \rangle \rightarrow p_\infty ^-\). Hence, there exists a unique positive equilibrium \(p_\infty ^-\) for the first equation, which is stable, and \(0< p_\infty ^- < (1+\beta )^{-1}\). The rest of the analysis follows as before, replacing \(R_m\) by \(R_m^- = p_\infty ^- R_0\).

In the same way, when \(h_1<h_2\), agents relax their protection measures, and there exists a unique positive equilibrium \(p_\infty ^+\) to Eq. (15), which is stable and \(p_\infty ^+ > (1+\beta )^{-1}\). Again, we can repeat the rest of the analysis as before, obtaining \(R_m^+= p_\infty ^+ R_0\).

Let us note that \(p_\infty ^-< (1+\beta )^{-1}<p_\infty ^+\) implies that, for \(h_1>h_2\), people attain a level of effort that helps to mitigate the propagation of the disease better than the corresponding one for \( h_1=h_2\) - the opposite occurs when \(h_1<h_2\).

4.3 Other contagion rules

We omit the analysis of the alternative rules presented before in Sect. 3.3 since it is similar. Let us mention only that, for \(h_1=h_2\), and assuming \(\langle p_I\rangle =\langle p_S\rangle =\langle p\rangle \), we get

$$\begin{aligned} \frac{\text {d}}{\text {d}t}\langle p\rangle =&4h_2 S (1-S)(1-(1+\beta )\langle p\rangle ), \\ \frac{\text {d}}{\text {d}t} S =&(1-S)(\gamma -2\langle p\rangle \beta S). \end{aligned}$$

when the contagion depends on the level of effort of infected individuals. The equilibria and their stability are the same as before.

If the contagion depends on the level of effort of both agents, we obtain

$$\begin{aligned} \frac{\text {d}}{\text {d}t}\langle p\rangle =&4h_2 S (1-S)( 1 - \langle p\rangle -\beta \langle p\rangle ^2), \\ \frac{\text {d}}{\text {d}t} S =&(1-S)(\gamma -2 \langle p\rangle ^2\beta S). \end{aligned}$$

The first equation has a single positive equilibria

$$\begin{aligned} \langle p\rangle _\infty = \frac{\sqrt{1+4\beta }-1}{2\beta }\in (0,1), \end{aligned}$$

and \(\langle p\rangle \rightarrow \langle p\rangle _\infty \) when \(t\rightarrow +\infty \) if initially \(S(0)\in (0,1)\). In order to compare \(\langle p\rangle _\infty \) and the limit number of Susceptible individuals in the endemic equilibria, namely \(\gamma /(2\langle p\rangle _\infty ^2 \beta )\), with what happens when contagion depends on the susceptible individual only, notice that

$$\begin{aligned} \frac{\sqrt{1+4\beta }-1}{2\beta } >\frac{1}{1+\beta }, \qquad \text {and} \qquad \Big (\frac{\sqrt{1+4\beta }-1}{2\beta }\Big )^2 <\frac{1}{1+\beta }. \end{aligned}$$

It follows that if contagion depends on the level of effort of both agents, they asymptotically implement more relaxed measures of protection, and the combined efforts contribute lead to a bigger number of limit susceptible individuals.

5 The behaviourally reduced reproduction number \(R_m\) and simulations

A critical parameter in compartmental epidemic models is \(R_0\), the basic reproduction number, which gives the expected number of contagions associated to a single infected individual who enters in a susceptible population. In the classical SIS model,

$$\begin{aligned} R_0= \frac{2\beta }{\gamma }, \end{aligned}$$

see for instance (Anderson and May 1992) (recall that the factor 2 appears since both the first or second agent can become infected). Then, as time evolves, the effective reproduction number \(R_t=R_0S(t)\) is a better descriptor of the dynamics since it takes into account that there are less susceptible agents. In the SIS model, \(R_t\) stabilizes at \(R_t=1\) in the endemic phase, and an equilibrium between recovered and new infected individuals appears, reaching a stable number of infected agents.

In the model studied in this paper, we observe from Eq. (14) that at time t we have an effective reproduction number

$$\begin{aligned} R_t= \langle p(t) \rangle \frac{2 \beta }{\gamma } S(t). \end{aligned}$$

Since \(\langle p(t) \rangle \rightarrow p_\infty \) for \(h_1=h_2\), and to \(p_\infty ^\pm \) if \(h_1\ne h_2\), we introduce the behaviourally reduced reproduction numbers

$$\begin{aligned} R_m=p_\infty \frac{2 \beta }{\gamma } \qquad \text{ and } \qquad R_m^\pm =p_\infty ^\pm \frac{2 \beta }{\gamma }. \end{aligned}$$

It follows from the previous results that given an epidemic outbreak, i.e. \(S(0)<1\), then the disease tends to disappear if \(R_m\le 1\) whereas it becomes endemic if \(R_m>1\) - the same is valid for \(R_m^\pm \). In Fig. 2, for \(\gamma =0.6\), we compare the bifurcation diagram of the classical SIS model with the one presented in this work. Varying \(\beta \), we observe the bifurcation at \(R_0=2\beta /\gamma \) of the classical SIS model (blue dotted curve). In contrast, the role played by the social interactions in our model delays the bifurcation until \(R_m=R_0/(1+\beta )\), and effectively lowers the final number of infected agents in the endemic state (black line). The red stars in the diagram correspond to agent-based simulations of the dynamics. We observe a very good agreement with the predicted value of infected agents at equilibria given by Theorem 4.1.

To further appreciate the agreement between the theoretical results of Theorem 4.1 and the agent-based simulations, we present in Fig. 3 a heat map for the proportion of susceptible agents at equilibria obtained in Theorem 4.1 (left panel), and performing agent-based simulations (right panel). We observe in the left panel that the region in the space of parameters where the disease is endemic is smaller than the corresponding one for a classical SIS model, delimited with the yellow line \(R_0=1\). Also, the agent-based simulations in the right panel confirm that the ODE system (13)–(14) accurately models the dynamics.

Fig. 2
figure 2

Plot of the proportion of Infected agents at the stable equilibria, for \(\gamma = 0.6\) and varying \(\beta \). The dotted blue curve represent the equilibria for the classical SIS dynamics, the black one are the theoretical equilibria computed in Theorem 4.1, and the red stars are agent-based simulations of the dynamics with 10000 agents and p uniformly distributed in [0.7, 0.9]

Fig. 3
figure 3

Heat map of the proportion of susceptible agents at equilibria. Upper panel: theoretical values from Theorem 4.1. Lower panel: agent based simulation of the dynamics with 10000 agents and p initially uniformly distributed in [0.7, 0.9]. The yellow line correspond to \(R_0=1\) in a classical SIS model

6 Conclusions and Final Remarks

We derived an epidemic model coupled with a continuous opinion dynamics model. We assumed that each individual can take measures to reduce the probability of contagion, and the level of effort that each agent applies change due to social interactions. We model few mechanisms, fear to contagion, confidence after a contact without contagion, and persuasion, as the main reasons for behavioral change, and we studied their impact on the dynamics of the disease.

We obtained a system of two ordinary differential equations, one for the proportion of infected people, and another one for the mean value of the effort parameter. The mean value of the effort enters as a coefficient in the original SIS system which modifies the rate of contagion. At the same time it changes as a consequence of epidemic events, since it decreases or increases when a contagion occurs or not. Hence, the behavioral dynamics modify the parameters of the SIS system. We can compare the system with other behavioral epidemic models, where an additional equation in a SIS or SIR model as in Bauch (2005) represent new compartment, and the behavioral dynamics drags the susceptible population into the vaccinated compartment. Different factors like imitation, costs of vaccination, or perceived risk due to the infected population, appears in the coefficients of this additional equation, which is a replicator equation with varying payoffs since depends on the proportion of infected agents.

We study the asymptotic behaviour of the solutions, and we obtained a generalization of the basic reproduction number \(R_0\), denoted \(R_m\), and given by

$$\begin{aligned} R_m = \frac{2\beta }{\gamma (1+\beta )} \end{aligned}$$

when \(h_1=h_2\), and where \(\beta \) and \(\gamma \) are the contact and recovery rate of the disease. We proved the existence of similar critical values \(R_m^\pm \) when \(h_1\ne h_2\). Let us recall that the factor 2 in \(R_m\) appears since both the first and second agents can become infected after an interaction. We prefer to keep this for simplicity and symmetry in the formulation of the problem, Notice however that comparison with the \(R_0\) of classical models must include the factor 2 (that is, if the rate of contagion of a disease studied with our model is \(\beta \), this is equivalent to a rate \(2\beta \) when only the first agent in some encounter can be infected).

There are several questions of practical interest, particularly in this moment with the Covid-19 pandemic active. To be clear, we are not claiming the direct applicability of our specific rules of social interaction, although trends in the population can be detected (like the degree of use of masks, sanitizer products, or social distance), thus giving a personal probability of contagion \(\beta _i\), which can be studied as the product \(p_i\beta \) in our model. Of course, different questions are relevant if we consider Covid-19, since a SEIR model (including exposed and removed agents) seems to be a better one to analyze its evolution.

We have chosen the same scale of time for both the epidemic and social dynamics, scaling only the number of agents, and keeping the parameter \(h_2\) in the equation for \(\langle p \rangle \). It is possible to change the frequency of interactions, by separating the ones related to the disease transmission, to the social ones ones which only affect the level of effort. This is specially important in SIR type dynamics, since the interactions at the start of the epidemic are critical for its evolution.

Also, fundamental agents, like e.g. governments, media, health organizations, were not considered here, though their role as social agents interacting with all the population cannot be neglected. On the negative side of social interactions, there are groups of people proposing innocuous and even harmful measures, like anti-vaccines movements, and we can see them today violating the social distance, or without masks, and trying to convince other people to imitate them. They act as zealots or stubborn agents and in a forthcoming paper we will study their role and their influence on the stability of equilibria.