Comparison beween e Discree and Coninuous Time Models D. Sulsky June 21, 2012 1 Discree o Coninuous Recall e discree ime model Î = AIS Ŝ = S Î. Tese equaions ell us ow e populaion canges from one day o e nex. We generaed a sequence of populaions by repeaed applicaion of ese formulae. We can add an equaion o describe e removed populaion ˆR = R + I. (1) Le s number e populaion on e n day wi a subscrip so a I n and S n are e number of infecive people and e number of suscepible people on e n day. Te sequence in e able follows e relaions I n+1 = AI n S n S n+1 = S n AI n S n R n+1 = R n + I n, wi I 0, S 0 and R 0 given. Noe a e oal populaion size is fixed since I n+1 + S n+1 + R n+1 = I n + S n + R n. In deriving is model, we made e assumpion a e sampling period was e same as e period of infeciousness (1 day). We will now relax is assumpion. 1
Suppose, as before, ose leaving e suscepible class ener direcly ino e infecive class, bu a a proporion, say B, of infecives remain infecive a e end of e sampling period. Ten e equaions become I n+1 = AI n S n + BI n S n+1 = S n AI n S n R n+1 = R n + (1 B)I n. (2) Te consan A measures e probabiliy of cacing e disease during e sampling period. In order o connec wi e coninuous ime equaions, we wan o consider e limi of infiniesimal sampling inervals. Le be a small sampling inerval. (We will look a e limi as 0.) Le S(), I() and R() be smoo funcions of and suppose S n = S(n), I n = I(n) and R n = R(n). Te values of e consans A and B depend on e sampling inerval and sould be rescaled, A = a and B = 1 b, for some consans a and b. Le = n, we ave I( + ) = ai()s() + (1 b)i() 1 ( ) I( + ) I() = ai()s() bi() S( + ) = S() ai()s() 1 ( ) S( + ) S() = ai()s() R( + ) = R() + bi() 1 ( ) R( + ) R() = bi(). In e limi as e sampling inerval goes o zero ( 0), we obain e SIR model di = ai()s() bi() d ds d = ai()s() dr d = bi(). 2 Coninuous o Discree We will look a wo differen ways in wic e coninuous-ime equaions are relaed o e discree-ime equaions. In bo approaces, we will sar wi e coninuousime SIR model and deermine relaed discree-ime equaions. In e firs approac, le s sar wi e equaions for S and I, divide e S equaion by S and e I 2
equaion by I o ge 1 ds S() d = ai() 1 di I() d = as() b dr d = bi(). Inegrae ese equaions over an inerval from o + + + 1 ds S() d d = 1 I() + di d d = dr d d = + + + ai() d (as() b) d bi() d. Te lef-and side of ese equaions can be inegraed exacly o give ln ( S( + ) S() ln ( I( + ) I() R( + ) R() = ) + = ai() d ) + = (as() b) d + bi() d. Now, ake e exponenial of bo sides of e firs wo equaions [ S( + ) = S() exp + ai() d [ + I( + ) = I() exp (as() b) d R( + ) R() = + bi() d. So far, we ave no made any approximaions. Bu, we canno inegrae e rigand sides exacly; so approximae e inegrals using a lef-and sum. Ta is, we 3
approximae e inegrand by a consan value - e value a e lower limi - o obain [ S( + ) S() exp ai() [ I( + ) I() exp (as() b) R( + ) R() = bi(). If we ake = 1, we can wrie e above equaions as [ S +1 = S exp ai [ I +1 = I exp as b R +1 = R + bi. A biological inerpreaion of ese equaions can be given. If we assume a e probabiliy of a suscepible becoming infeced is Poisson disribued wi mean ai, en exp( ai ) is jus e zero erm of e Poisson disribuion (e probabiliy of no geing infeced). Of course, = 1 is aken o be e leng of e infecious period. If we expand e exponenial erms and neglec iger order erms (assuming infecion prevalence is small), we obain [ S +1 = S 1 ai = S ai S I +1 = I [1 + as b = ai S + (1 b)i R +1 = R + bi. Tese are e same discree equaions as in equaions (2) wi A = a and B = 1 b (since = 1). In our second approac, le s now sar from e coninuous SIR model and examine discreizaions a we use wen we approximae soluions numerically. Le s firs remind ourselves wa Euler s meod is for solving ordinary differenial equaions. In e simples case of a scalar equaion Euler s meod is dy d = f(, y), y( 0) = y 0, (3) Y n+1 = Y n + f( n, Y n ) n+1 = n + (4) 4
Recall a e soluion o a single differenial equaion wi an iniial condiion is a funcion, y() wi y( 0 ) = y 0. We ave used e noaion Y n as e approximaion o y( n ). We sar is ieraion wi e given iniial condiions ( 0, Y 0 = y 0 ). Euler s meod is based on using a angen line over a finie inerval of size o approximae e exac funcion. Le s call ŷ(, 0 ) e angen line o e exac soluion a e base poin = 0, given as a funcion of. Te equaion of e angen line is ŷ(, 0 ) = y( 0 ) + f( 0, y( 0 ))( 0 ). (5) Since we sar our approximaion wi e exac iniial condiion, Y 0 = y 0 and we can rewrie e above as ŷ(, 0 ) = Y 0 + f( 0, Y 0 )( 0 ). (6) If we follow e angen line from ( 0, Y 0 ) for a ime inerval of size, we obain ŷ( 0 +, 0 ) = Y 0 + f( 0, Y 0 ). (7) Euler s meod ses 1 = 0 + and Y 1 = ŷ( 1, 0 ) = Y 0 + f( 0, Y 0 ). For e nex sep, we consruc e angen line o e soluion of e differenial equaion a goes roug e poin ( 1, Y 1 ). Te angen line is ŷ(, 1 ) = Y 1 + f( 1, Y 1 )( 1 ). (8) If we follow e angen line from ( 1, Y 1 ) for a ime inerval of size, we obain ŷ( 1 +, 1 ) = Y 1 + f( 1, Y 1 ). (9) Euler s meod ses 2 = 1 + and Y 2 = ŷ( 2, 1 ) = Y 1 + f( 1, Y 1 ). Te process is repeaed o give e general formula (4). Te process is illusraed in Fig. 1. Te same process can be applied o obain approximae soluions o sysems of equaions. Again, e differenial equaions for e SIR model are ds d = ai()s() di = ai()s() bi() d dr d = bi(), wi iniial condiions S(0) = S 0, I(0) = I 0 and R(0) = N 0 S 0 I 0. Apply Euler s meod o e firs equaion. In is case, 0 = 0. Te angen line roug (0, S 0 ) is Ŝ(, 0) = S 0 ai 0 S 0 ( 0). (10) 5
y() ( 2, Y 2 ) y 0 ( 1, Y 1 ) 0 1 2 Figure 1: Illusraion of Euler s meod for a scalar equaion. Follow e angen line from (0, S 0 ) for a ime inerval of size Ŝ(0 +, 0) = S 0 ai 0 S 0. (11) Se 1 = 0 + = and S 1 = Ŝ(0 +, 0) = S 0 ai 0 S 0. Similarly, for e second equaion, e angen line roug (0, I 0 ) is Î(, 0) = I 0 + [ ai 0 S 0 bi 0 ( 0). (12) Follow e angen line from (0, I 0 ) for a ime inerval of size Î(0 +, 0) = I 0 + ai 0 S 0 bi 0. (13) Se I 1 = Î(0 +, 0) = I 0 + ai 0 S 0 bi 0. For e ird equaion, e angen line roug (0, R 0 ) is ˆR(, 0) = R 0 + bi 0 ( 0). (14) Follow e angen line from (0, R 0 ) for a ime inerval of size ˆR(0 +, 0) = R 0 + bi 0. (15) 6
Se R 1 = R 0 + bi 0. We now ave an approximae soluion a ime 1 = a is S 1, I 1 and R 1. We can now consruc a angen line for eac equaion roug e corresponding poins ( 1, S 1 ), ( 1, I 1 ) and ( 1, R 1 ). Te angen lines are Ŝ(, 1 ) = S 1 ai 1 S 1 ( 1 ) Î(, 1 ) = I 1 + [ ai 1 S 1 bi 1 ( 1 ) ˆR(, 1 ) = bi 1 ( 1 ). (16) Follow e angen line from e poins ( 1, S 1 ), ( 1, I 1 ) and ( 1, R 1 ) for a ime inerval of size o obain Ŝ( 1 +, 1 ) = S 1 ai 1 S 1 Î( 1 +, 1 ) = I 1 + [ ai 1 S 1 bi 1 ˆR( 1 +, 1 ) = bi 1. (17) Se 2 = 1 + and S 2 = S 1 ai 1 S 1 I 2 = I 1 + [ ai 1 S 1 bi 1 R 2 = bi 1. We now recognize e paern (18) S n+1 = S n ai n S n I n+1 = I n + ai n S n bi n R n+1 = bi n n+1 = n +. (19) Since 0 = 0, we ave n = n, and S n, I n and R n are approximaions o S(n), I(n), R(n). Obviously, if we se A = a and B = 1 b we reurn o e discree-ime equaions (2). We ave seen a e discree-ime equaions and e coninuous-ime, ordinary differenial equaions for e SIR model are relaed. Taking e limi of a small sampling period in e discree equaions gives e ordinary differenial equaions. Te applicaion of Euler s meod is an example of wa is called discreizing e ordinary differenial equaions. Euler s meod gives discree equaions o solve numerically a approximae e soluions o e ordinary differenial equaions. Te approximaion ges beer as, e ime sep size, is reduced. Euler s meod is called firs order accurae because differences beween e approximaion and 7
exac soluion o e ordinary differenial equaions decrease o zero as o e firs power. Tis relaion is called e convergence rae. More sopisicaed numerical meods can be consruced a give rise o differen discree equaions wi beer convergence raes. Tings o ry. 1. Solve e coninuous-ime ordinary differenial equaions for e SIR model using Euler s meod wi differen sep sizes. Approximae e error in your soluions. Do you observe firs order convergence? 2. Try some oer numerical meods for solving e equaions. Wa does e error look like for ese meods? Wa is e convergence rae? 8