<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Iterative and recursive version of simulating epidemic phenomena</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Karolina Ke ̨sik Institute of Mathematics Silesian University of Technology Kaszubska 23</institution>
          ,
          <addr-line>44-100 Gliwice</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <fpage>32</fpage>
      <lpage>36</lpage>
      <abstract>
        <p>-Forecasting various phenomena can help us analyze the behavior of certain phenomena. Special objects for this type of activity are the weather forecast or the spread of the disease. In the case of an epidemic, there is a risk that the lack of the invention of a vaccine can be very problematic if a given bacterium or virus have a high probability of being infected. In this paper, we focus on presenting two approaches to the problem of modeling the outbreak epidemic - iterative and recursive. As part of the comparison of these solutions, appropriate simulations were performed in order to indicate the advantages and disadvantages of these solutions. The results were presented and discussed.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>Forecasting future events is based on several input data
that return the most likely changes. In fact, it is not so easy
because there may always be some unexpected element that
will change predictions. This is particularly evident in the
analysis of epidemic phenomena. By analyzing any strain, it
is hard to take into account all existing conditions that can
lead to mutations. However, simplified models allow us to
obtain numerical values over time. An example of this is the
anticipated time when a given vaccine should be ready.</p>
      <p>Forecasting can take place using different techniques. One
of the most important branches of scientific research is
artificial intelligence. The development of this technique gives
many possibilities. An example of these techniques are
artificial neural networks, whose greatest drawback is very long
training time. In [1], [2], the authors presented the idea of
parallelization. Neural networks can be used not only for
classification but also for predictions as shown in [3], [4], [5], [6],
[7]. Similarly in [8], where prediction techniques for dynamic
seismic slope have been described using these networks and
heuristics. An important study is also the prediction of wind
speed [9], [10] which can be useful on roads or ski jumps.</p>
      <p>Another important area of application of different forecasting
techniques is medicine, where using selected data, possible
occurrences of diseases or their progression can be predicted
[11].</p>
      <p>In this paper, we compare two approaches to programming
the simulation of the epidemic spreading phenomenon and
analyze their advantages and disadvantages in relation to
differences.</p>
      <p>c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).</p>
      <p>Markov chain is one of the stochastic models, which is used
to describe probability of evolution in time random process of
changing states. Every new state is dependent on events in
past. We consider a set S as a space of states, where the
number of states is finite (or at most countable) and Xn = i
means that the state i is reached at time n.</p>
      <p>In our model we assume that S = f0; 1; 2g map each state
to the appropriate stage of the epidemic – susceptible, infected
or recovered. In order for some sequence of variables to be
called a Markov chain, the Markov property must be fulfilled.</p>
      <p>That requires for each n 2 f0; 1; : : : g and for every state
i0; : : : ; in+1 2 S to be occured following equation</p>
      <p>P fXn+1 = in+1jXn = in; : : : ; X0 = i0g</p>
      <p>= P fXn+1 = in+1jXn = ing:</p>
      <p>In other words Markov property is related to the memoryless
property, which is characteristic for some stochastic processes.</p>
      <p>If the process has this feature, it means that we only need to
know the current state. Knowledge of any of the states in the
past does not give the opportunity to predict states that could
appear in the future.</p>
      <p>Definition of the Markov chain is connected with the matrix
of probabilities of transition between states and the probability
distribution vector for the variable X0. First of them, the
matrix P = (pij ) is composed of probabilieties of changing
the state from i to another state j during one step – which is
always . Its dimension is equal k k, where k is the power
of the set S. According to this, we obtain square matrix</p>
      <p>pk1
p12 : : : p1k 1
p22 : : : p2k C</p>
      <p>... . . . ... CCA ;
pk2 : : : pkk
where pij = P fXn+1 = jjXn = ig. It is important to
remember about two essensial properties of probability – for each</p>
      <p>jSj
i 2 S, X pij = 1 and also for every i and j pij 0.</p>
      <p>j=1</p>
      <p>
        The other element is an initial vector of distribution for
variable X0. It can be defined for every i 2 S as following
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        )
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
where each pi = P fX0 = ig is the probabilities, therefore, introduce the initial vector of the population, which can be
the properties mentioned above are also fulfilled. represented as
      </p>
      <p>
        For probabilities, that are independent of n, we can
introduce each element in specified position (i; j) of matrix Pm P0 = nsus ninf nrec : (
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
as
pij (m) = P (Xn+m = jjXn = i) = P (Xm = jjX0 = i)
      </p>
      <p>
        (
        <xref ref-type="bibr" rid="ref4">4</xref>
        )
and that determines the probability that the Markov chain,
which state at period n is i, after m periods will reach the
state j.
      </p>
      <p>III. MODEL OF INFECTION SPREAD</p>
      <p>Let there be a phenomenon that can be divided into stages.</p>
      <p>In each period, some changes are made and probability of
those changes can be determined. In the proposed model of
spreading infection, we assume that we have three stages. Each
of them represents the health condition of the population. We
can assign every individual to one of the following group
susceptible sus( ),
infected inf ( ),
recovered rec( ).</p>
      <p>Obviously, there are many elements that affect changes
between stages in the model. To simplify it, we have made
some assumptions. In our proposition, we assume that
we do not consider that elements such as climate,
demographic changes, social status, age or sex can have any
effect on the probability in model,
only susceptible individual may be infencted,
leaving the infected group is possible only throughout
becoming recovered,
individual, who is recovered, has acquired immunity.</p>
      <p>We have considered two ideas of presenting this model - by
using recursion and with Markov chains.</p>
      <p>A. Markov chains as a tool for prediction the evolution of
infection process</p>
      <p>As it was said earlier, we assume that the space of states
S is composed of 3 elements. Each of states f1; 2; 3g
corresponds to one of groups – for example 1 is corresponding to
susceptibles.</p>
      <p>According to those assumptions, the transition matrix,
which consists of probabilities p of every particular transitions
during one period, can be defined as
0 psus;sus
@ pinf;sus
prec;sus
psus;inf
pinf;inf
prec;inf
psus;rec 1
pinf;rec A
prec;rec</p>
      <p>
        It is easy to notice that the probability of changing state from
infected to susceptibles is equal to zero, because the only way
to go through infection is to become recovered. In the same
way we can see that it is impossible to became susceptibles
after being recovered. To predict how the process of spreading
the infection in a given population will take place, we need
to know the initial state of the population. To present this, we
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
      </p>
      <p>Each n corresponds to the number of people, who were
assigned to the specific group – susceptibles, infected or
recovered.</p>
      <p>B. Another tool for prediction the evolution of infection
process - recursion</p>
      <p>The other idea for prediction how the infection would evolve
is recursion. We propose that the calculation of the next steps
in each stage of infection was based on the state of the
population in the previous step. This idea can be defined by
following equations
sus(t) = sus(t
1)
pinf inf (t</p>
      <p>
        1);
inf (t) = inf (t 1) + pinf inf (t 1) prec inf (t 1); (
        <xref ref-type="bibr" rid="ref8">8</xref>
        )
rec(t) = rec(t
1) + prec inf (t
      </p>
      <p>1);
where t and t 1 are current and previous step.</p>
      <p>
        In the beginning, we need to specify the number of
individuals belonging to each of the states. Initial conditions can be
presented as in Eq.(
        <xref ref-type="bibr" rid="ref6">6</xref>
        ), where
nsus = sus(0);
ninf = inf (0);
nrec = rec(0):
      </p>
      <p>IV. ITERATIVE AND RECURSIVE APPROACH
Data: number of healthy nsus, number of infected
ninf , number of recovered nrec, the probability
of being infected pinf and recovery prec, stop
condition
Result: The number of individuals in each group after</p>
      <p>a certain time.</p>
    </sec>
    <sec id="sec-2">
      <title>Start;</title>
      <p>
        Create of a stochastic matrix in according to Eq. (
        <xref ref-type="bibr" rid="ref5">5</xref>
        );
Create of the initial vector using Eq. (
        <xref ref-type="bibr" rid="ref6">6</xref>
        );
Create a temporary value K and t := 0;
while stop condition is not met do
if t == 0 then
      </p>
      <p>Calculate K = P0 P;
else
end
t + +;</p>
      <p>
        K = K P;
end
Return K;
Stop;
Algorithm 1: Iterative approach to modeling of the
epidemic phenomenon.
(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
(
        <xref ref-type="bibr" rid="ref9">9</xref>
        )
(
        <xref ref-type="bibr" rid="ref10">10</xref>
        )
(
        <xref ref-type="bibr" rid="ref11">11</xref>
        )
(12)
Data: number of healthy nsus, number of infected
ninf , number of recovered nrec, the probability
of being infected pinf and recovery prec, stop
condition
Result: The number of individuals in each group after
a certain time.
      </p>
    </sec>
    <sec id="sec-3">
      <title>Start;</title>
      <p>
        Create of the initial conditions using Eq. (
        <xref ref-type="bibr" rid="ref10">10</xref>
        ), (
        <xref ref-type="bibr" rid="ref11">11</xref>
        ) and
(12);
Create a temporary value K and t := 1;
while stop condition is not met do
      </p>
      <p>
        Calculate number of sus according to Eq. (
        <xref ref-type="bibr" rid="ref7">7</xref>
        );
Calculate number of inf using Eq. (
        <xref ref-type="bibr" rid="ref8">8</xref>
        );
Calculate number of rec according to Eq. (
        <xref ref-type="bibr" rid="ref9">9</xref>
        );
Save calculated values as vector K;
t + +;
end
Return K;
Stop;
Algorithm 2: Recursive approach to modeling of the
epidemic phenomenon.
      </p>
    </sec>
    <sec id="sec-4">
      <title>V. EXPERIMENTS</title>
      <p>Two methods of infection spread prediction were
implemented and tested. Simulations were conducted to compare
both methods. In each simulation, we use the same probabilies
of becoming infected and recovered for iterative and recursive
approach. We also tested it for two populations to see how
results will differ.</p>
      <p>We present a first initial steps of each method to show how
calculation are made. In every step we round up the values
to one, because we consider individuals. Let us assume that
the population is made up of a one hundred people, where
95 people are healthy and only 5 are infected. Hence, at the
beginning, the initial vector is
For iterative approach, we define stochastic matrix as
P0 =
95
0:6
0:55
0
0
1</p>
      <p>1
0:45 A :
We do the first iteration and we obtain</p>
      <p>P0P =
=
95
38
0:6
0:55
0
0
1</p>
      <p>1
0:45 A =
Anderson-darling
Kolmogorov-Smirnov
Kuiper
Pearson 2
Shapiro-Wilk
Watson U 2
Anderson-darling
Kolmogorov-Smirnov
Kuiper
Pearson 2
Shapiro-Wilk
Watson U 2
Anderson-darling
Kolmogorov-Smirnov
Kuiper
Pearson 2
Shapiro-Wilk
Watson U 2
Anderson-Darling
Kolmogorov-Smirnov
Kuiper
Pearson 2
Shapiro-Wilk
Watson U 2
Anderson-darling
Kolmogorov-Smirnov
Kuiper
Pearson 2
Shapiro-Wilk
Watson U 2
Anderson-darling
Kolmogorov-Smirnov
Kuiper
Pearson 2
Shapiro-Wilk
Watson U 2
Statistic
0.391341
0.171128
0.199223
1.555556
0.901546
0.047075
Statistic
0.392656
0.229084
0.241794
0.666667
0.893534
0.057898
Statistic
0.321762
0.170226
0.270848
1.555556
0.928101
0.043625
Statistic
0.461812
0.233851
0.292183
2.333333
0.864369
0.065498
Statistic
0.391341
0.171128
0.199223
1.555556
0.901546
0.047075</p>
      <p>
        For recursive approach, we calculate number of individuals
after first step in following way
sus(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) = 95
      </p>
      <p>
        0:6 5 = 92;
inf (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) = 5 + 0:6 5
      </p>
      <p>
        0:45 5 = 6;
rec(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) = 0 + 0:45 5 = 2:
      </p>
      <p>We have made statistical tests to check out whether the
received data is distributed according to the normal distribution.
For iterative table of infected and recovered individuals, we
obtained a positive result – distribution of data and the normal
distribution are compatible. Only for susceptibles, we reject
the hypothesis that the data is distributed in accordance with
normal distribution. In the case of recursive approach, the null
hypothesis is not rejected (at the 5 percent level – the same as
for the iteration version). It means that we can assume that the
data is distributed in accordance with the normal distribution.</p>
    </sec>
    <sec id="sec-5">
      <title>VI. CONCLUSION</title>
      <p>To create a model of prediction of the infection spread we
proposed two algoritms. First of them uses Markov chain and
the second one – recursion. Both are useful and each of them
has some advantages. Iterative model is is fast and effective
even for large populations. Recursive model is more accurate
and a bit more reliable, but has one big disadvantage – has a
high computational complexity. That makes calculations last
for a very long time.</p>
      <p>The analysis of the test results allowed us to conclude that
the use of Markov chains is better and more optimal solution
for prediction. Using this method we obtained rewarding
forecast of the spread of infection with specific probabilities
of being infected and recovered in the given population.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          , M. Woz´niak, W. Wei, and R. Damaševicˇius, “
          <article-title>Multi-threaded learning control mechanism for neural networks</article-title>
          ,
          <source>” Future Generation Computer Systems</source>
          , vol.
          <volume>87</volume>
          , pp.
          <fpage>16</fpage>
          -
          <lpage>34</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          , “
          <article-title>Human-machine interaction in intelligent technologies using the augmented reality</article-title>
          ,
          <source>” Information Technology And Control</source>
          , vol.
          <volume>47</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>691</fpage>
          -
          <lpage>703</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Lopez</surname>
          </string-name>
          , G. Manogaran et al.,
          <article-title>“Modelling the h1n1 influenza using mathematical and neural network approaches</article-title>
          ,”
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M. H.</given-names>
            <surname>Esfe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. R. H.</given-names>
            <surname>Ahangar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rejvani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Toghraie</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. H.</given-names>
            <surname>Hajmohammad</surname>
          </string-name>
          , “
          <article-title>Designing an artificial neural network to predict dynamic viscosity of aqueous nanofluid of tio2 using experimental data</article-title>
          ,”
          <source>International Communications in Heat and Mass Transfer</source>
          , vol.
          <volume>75</volume>
          , pp.
          <fpage>192</fpage>
          -
          <lpage>196</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>G.</given-names>
            <surname>Capizzi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Sciuto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          , and E. Tramontana, “
          <article-title>Advanced and adaptive dispatch for smart grids by means of predictive models</article-title>
          ,
          <source>” IEEE Transactions on Smart Grid</source>
          , vol.
          <volume>9</volume>
          , no.
          <issue>6</issue>
          , pp.
          <fpage>6684</fpage>
          -
          <lpage>6691</lpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S.</given-names>
            <surname>Brusca</surname>
          </string-name>
          , G. Capizzi,
          <string-name>
            <given-names>G. Lo</given-names>
            <surname>Sciuto</surname>
          </string-name>
          , and G. Susi, “
          <article-title>A new design methodology to predict wind farm energy production by means of a spiking neural network-based system</article-title>
          ,”
          <source>International Journal of Numerical Modelling: Electronic Networks, Devices and Fields</source>
          , vol.
          <volume>32</volume>
          , no.
          <issue>4</issue>
          , p.
          <fpage>e2267</fpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>S.</given-names>
            <surname>Coco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Laudani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. R.</given-names>
            <surname>Fulginei</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Salvini</surname>
          </string-name>
          , “
          <article-title>A new neural predictor for elf magnetic field strength</article-title>
          ,
          <source>” IEEE Transactions on Magnetics</source>
          , vol.
          <volume>50</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>69</fpage>
          -
          <lpage>72</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>B.</given-names>
            <surname>Gordan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Armaghani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Hajihassani</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Monjezi</surname>
          </string-name>
          , “
          <article-title>Prediction of seismic slope stability through combination of particle swarm optimization and neural network,” Engineering with Computers</article-title>
          , vol.
          <volume>32</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>85</fpage>
          -
          <lpage>97</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>B.</given-names>
            <surname>Doucoure</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Agbossou</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Cardenas</surname>
          </string-name>
          , “
          <article-title>Time series prediction using artificial wavelet neural network and multi-resolution analysis: Application to wind speed data,” Renewable Energy</article-title>
          , vol.
          <volume>92</volume>
          , pp.
          <fpage>202</fpage>
          -
          <lpage>211</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>A.</given-names>
            <surname>Kavousi-Fard</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Khosravi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Nahavandi</surname>
          </string-name>
          , “
          <article-title>A new fuzzybased combined prediction interval for wind power forecasting</article-title>
          ,
          <source>” IEEE Transactions on Power Systems</source>
          , vol.
          <volume>31</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>18</fpage>
          -
          <lpage>26</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>S.</given-names>
            <surname>Vijayarani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Dhayanand</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Phil</surname>
          </string-name>
          , “
          <article-title>Kidney disease prediction using svm and ann algorithms</article-title>
          ,”
          <source>International Journal of Computing and Business Research (IJCBR)</source>
          , vol.
          <volume>6</volume>
          , no.
          <issue>2</issue>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>