Equations (M1) and (M2) define a Markov chain M with variable states depending on the epidemic model (see Text S1). The fraction of time the population spends in each state is given by the stationary distribution of M, which is defined as the eigenvector associated with eigenvalue 1 of the transition matrix of M [50, 51] . In the SIS model, the state without infected (i = 0) is, however, an absorbing state of the Markov Chain. The quantity of interest is therefore the stationary distribution of the Markov chain obtained from M by excluding the absorbing state i = 0. This distribution is also known as the quasi-stationary distribution of M [52] and corresponds to the fraction of time the population spends in each state, assuming the disease does not go extinct (see Figure 1 ).