diff options
-rw-r--r-- | COVID-19-SEIR.png | bin | 39490 -> 40300 bytes | |||
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | SARS-SEIR.png | bin | 35105 -> 41265 bytes | |||
-rw-r--r-- | SARS-SIR.png | bin | 41624 -> 41666 bytes | |||
-rw-r--r-- | out/COVID-19-ESIR-data.csv | 3 | ||||
-rw-r--r-- | out/COVID-19-Linear-data.csv | 3 | ||||
-rw-r--r-- | out/COVID-19-SEIR-data.csv | 11 | ||||
-rw-r--r-- | out/COVID-19-SEIR-prediction.csv | 152 | ||||
-rw-r--r-- | out/COVID-19-SIR-data.csv | 3 | ||||
-rw-r--r-- | out/SARS-ESIR-data.csv | 3 | ||||
-rw-r--r-- | out/SARS-Linear-data.csv | 3 | ||||
-rw-r--r-- | out/SARS-SEIR-data.csv | 11 | ||||
-rw-r--r-- | out/SARS-SEIR-prediction.csv | 150 | ||||
-rw-r--r-- | out/SARS-SIR-data.csv | 7 | ||||
-rw-r--r-- | out/SARS-SIR-prediction.csv | 150 | ||||
-rw-r--r-- | solver2.py | 46 |
16 files changed, 284 insertions, 278 deletions
diff --git a/COVID-19-SEIR.png b/COVID-19-SEIR.png Binary files differindex d44ed9d..765ea68 100644 --- a/COVID-19-SEIR.png +++ b/COVID-19-SEIR.png @@ -1,15 +1,19 @@ # Infectious-Disease-Modeling -Original code by [JasonXu314](https://github.com/JasonXu314/covid-19-project/) and [Lewuathe](https://github.com/Lewuathe/COVID19-SIR) +A project to modeling infectious diseases with the SIR model and variations. + +![](https://raw.githubusercontent.com/Ta180m/Infectious-Disease-Modeling/master/SARS-ESIR.png) + +![](https://raw.githubusercontent.com/Ta180m/Infectious-Disease-Modeling/master/COVID-19-ESIR.png) + +## Usage For SARS in Hong Kong use -`./solver2.py --country=Hong_Kong --popcountry=20000 --initial=1000 --disease=SARS --start=4/10/03` +`./solver2.py --country=Hong_Kong --popcountry=20000 --initial=1000 --disease=SARS --start=4/10/03 --mode={SIR,Linear,ESIR,SEIR}` For COVID-19 in the US use -`./solver2.py --popcountry=3000000 --initial=100` - +`./solver2.py --popcountry=3000000 --initial=100 --mode={SIR,Linear,ESIR,SEIR}` -## Usage ``` usage: solver2.py [-h] [--mode {SIR,Linear,ESIR,SEIR}] [--data [{Actual,S,I,R,E} [{Actual,S,I,R,E} ...]]] @@ -56,4 +60,8 @@ optional arguments: the population of the model (defaults to 10000) --initial INITIAL, -I INITIAL initial infected people (defaults to 1) -```
\ No newline at end of file +``` + +## Credits + +Original code by [JasonXu314](https://github.com/JasonXu314/covid-19-project/) and [Lewuathe](https://github.com/Lewuathe/COVID19-SIR)
\ No newline at end of file diff --git a/SARS-SEIR.png b/SARS-SEIR.png Binary files differindex b0187aa..9e5b74b 100644 --- a/SARS-SEIR.png +++ b/SARS-SEIR.png diff --git a/SARS-SIR.png b/SARS-SIR.png Binary files differindex d9332e0..1321854 100644 --- a/SARS-SIR.png +++ b/SARS-SIR.png diff --git a/out/COVID-19-ESIR-data.csv b/out/COVID-19-ESIR-data.csv index e16f0d7..3c6bb37 100644 --- a/out/COVID-19-ESIR-data.csv +++ b/out/COVID-19-ESIR-data.csv @@ -1,4 +1,5 @@ Beta: 0.11506079905613333 Gamma: 0.004485002592721715 Mu: 1e-08 -R0: 25.654509698111923
\ No newline at end of file +R0: 25.654509698111923 +Predicted I: 1266.8145664521824, Actual I: 1320.7366666666667
\ No newline at end of file diff --git a/out/COVID-19-Linear-data.csv b/out/COVID-19-Linear-data.csv index b204797..d0469e1 100644 --- a/out/COVID-19-Linear-data.csv +++ b/out/COVID-19-Linear-data.csv @@ -1,3 +1,4 @@ Beta: 0.0005306298181865554 Gamma: 0.00121221978960238 -R0: 0.4377340006638624
\ No newline at end of file +R0: 0.4377340006638624 +Predicted I: 377.76904311879434, Actual I: 1320.7366666666667
\ No newline at end of file diff --git a/out/COVID-19-SEIR-data.csv b/out/COVID-19-SEIR-data.csv index 98e5f69..4b2d494 100644 --- a/out/COVID-19-SEIR-data.csv +++ b/out/COVID-19-SEIR-data.csv @@ -1,5 +1,6 @@ -Beta: 0.11054937398441604 -Gamma: 1e-08 -Mu: 1e-08 -Sigma: 0.0009697697322082875 -R0: 5527411.7020644825
\ No newline at end of file +Beta: 0.11054352661813334 +Gamma: 0.001 +Mu: 0.0009999999999999992 +Sigma: 0.005265008086429555 +R0: 46.4494661074415 +Predicted I: 1267.3615656181303, Actual I: 1320.7366666666667
\ No newline at end of file diff --git a/out/COVID-19-SEIR-prediction.csv b/out/COVID-19-SEIR-prediction.csv index 216cf0d..5a6f3a1 100644 --- a/out/COVID-19-SEIR-prediction.csv +++ b/out/COVID-19-SEIR-prediction.csv @@ -1,78 +1,78 @@ ,Actual,S,I,R 1/22/20,0.0033333333333333335,9999.666666666666,0.33333333333333337,0.0 -1/23/20,0.0033333333333333335,9999.627703932636,0.3722960708871821,-7.047500503241619e-09 -1/24/20,0.006666666666666667,9999.584187413606,0.41581259384888014,-1.49152950354593e-08 -1/25/20,0.006666666666666667,9999.535585180327,0.464414831515325,-2.3699210398033534e-08 -1/26/20,0.016666666666666666,9999.481297402239,0.5187026144994259,-3.350731144359509e-08 -1/27/20,0.016666666666666666,9999.420271502591,0.5797285196504275,-4.452958089143598e-08 -1/28/20,0.016666666666666666,9999.35189874109,0.648101287311564,-5.6875709818881055e-08 -1/29/20,0.016666666666666666,9999.275787997143,0.7242120381115329,-7.061590659430941e-08 -1/30/20,0.016666666666666666,9999.191314730966,0.808685311894688,-8.586249552376956e-08 -1/31/20,0.023333333333333334,9999.09762098357,0.9023790677210395,-1.0276991685097948e-07 -2/1/20,0.02666666666666667,9998.99361537678,1.0063846838662542,-1.2153472675732646e-07 -2/2/20,0.02666666666666667,9998.877973113224,1.1220269578216555,-1.4239559736186735e-07 -2/3/20,0.03666666666666667,9998.749135976333,1.2508641062942234,-1.6563331672132827e-07 -2/4/20,0.03666666666666667,9998.605312330348,1.3946877652065937,-1.9157078883010485e-07 -2/5/20,0.03666666666666667,9998.444477120309,1.5555229896970593,-2.205730336202621e-07 -2/6/20,0.03666666666666667,9998.264371872068,1.7356282541195687,-2.5304718696153445e-07 -2/7/20,0.03666666666666667,9998.062504692276,1.9374954520437282,-2.8944250066132573e-07 -2/8/20,0.03666666666666667,9997.836150268393,2.1638498962547996,-3.302503424647093e-07 -2/9/20,0.03666666666666667,9997.582349868684,2.4176503187537017,-3.760041960544277e-07 -2/10/20,0.03666666666666667,9997.29791134222,2.702088870757009,-4.272796610508932e-07 -2/11/20,0.04,9996.979409118876,3.020591122696953,-4.846944530121872e-07 -2/12/20,0.04,9996.623184209333,3.3768160642214227,-5.489084034340606e-07 -2/13/20,0.043333333333333335,9996.225344205073,3.7746561041939612,-6.206234597499338e-07 -2/14/20,0.043333333333333335,9995.781763278394,4.21823707069377,-7.005836853308967e-07 -2/15/20,0.043333333333333335,9995.2878763168,4.71212407662139,-7.89614001491647e-07 -2/16/20,0.043333333333333335,9994.729673252885,5.270327190678028,-8.903154346461404e-07 -2/17/20,0.043333333333333335,9994.101593223397,5.898407276621259,-1.003694924017184e-06 -2/18/20,0.043333333333333335,9993.402844646575,6.597155916258238,-1.1298515769493453e-06 -2/19/20,0.043333333333333335,9992.630113810632,7.369886821656041,-1.2693480407207008e-06 -2/20/20,0.043333333333333335,9991.777564873753,8.222435835141674,-1.4232105025428344e-06 -2/21/20,0.05,9990.836839864092,9.163160929302064,-1.592928689560839e-06 -2/22/20,0.05,9989.797058679776,10.202942206984064,-1.780455868853314e-06 -2/23/20,0.05,9988.644819088899,11.355181901294454,-1.9882088474323683e-06 -2/24/20,0.05,9987.364196729528,12.635804375599937,-2.2190679722436185e-06 -2/25/20,0.05,9985.936745109704,14.063256123527145,-2.476377130166188e-06 -2/26/20,0.05,9984.341495607432,15.658505768962627,-2.7639437480127095e-06 -2/27/20,0.05333333333333334,9982.554957470695,17.445044066052862,-3.0860387925293243e-06 -2/28/20,0.05333333333333334,9980.55111781744,19.448883899204265,-3.4473967703956814e-06 -2/29/20,0.08,9978.30144163559,21.698560283083154,-3.8532157282249365e-06 -3/1/20,0.1,9975.774871783038,24.22513036261579,-4.309157252563754e-06 -3/2/20,0.17666666666666667,9972.937828987646,27.06217341298835,-4.821346469892306e-06 -3/3/20,0.24333333333333335,9969.754211847247,30.24579083964694,-5.396372046624275e-06 -3/4/20,0.3466666666666667,9966.185396829644,33.81460617829759,-6.0412861891068505e-06 -3/5/20,0.5733333333333334,9962.190238272617,37.80976509490626,-6.763604643620727e-06 -3/6/20,0.7233333333333334,9957.725068383907,42.27493538569881,-7.571306696380109e-06 -3/7/20,1.12,9952.743697241232,47.25630697716109,-8.472835173532714e-06 -3/8/20,1.5,9947.197412792282,52.80259192603878,-9.477096441159757e-06 -3/9/20,1.7133333333333334,9941.034980854713,58.96502441933756,-1.0593460405275972e-05 -3/10/20,2.3600000000000003,9934.18467876412,65.81532712971975,-1.183852492577203e-05 -3/11/20,3.6833333333333336,9926.555298283798,73.44470830443369,-1.3233477649315049e-05 -3/12/20,5.19,9918.079803623716,81.92020373762848,-1.4786587842158435e-05 -3/13/20,7.156666666666667,9908.673492617427,91.32651560183623,-1.6510067880203516e-05 -3/14/20,9.523333333333333,9898.232818699395,101.7671904708687,-1.842053697925139e-05 -3/15/20,9.726666666666667,9886.635390904994,113.3646193198174,-2.0539021195002944e-05 -3/16/20,14.356666666666667,9873.739973870519,126.26003752505356,-2.2890953423058815e-05 -3/17/20,20.32,9859.38648783317,140.61352486422825,-2.5506173398919426e-05 -3/18/20,29.576666666666668,9843.396008631062,156.6040055162721,-2.8418927697984978e-05 -3/19/20,46.980000000000004,9825.570767703222,174.42924806139555,-3.1667869735555426e-05 -3/20/20,64.67666666666668,9805.694152089593,194.30586548108883,-3.52960597668305e-05 -3/21/20,85.75,9783.530704431025,216.4693151581218,-3.935096488690971e-05 -3/22/20,112.11333333333334,9758.826122969287,241.17389887654403,-4.3884459030792356e-05 -3/23/20,145.54333333333335,9731.307261547056,268.69276282168505,-4.895282297337746e-05 -3/24/20,179.12,9700.682129607925,299.3178975801538,-5.461674432946389e-05 -3/25/20,219.26000000000002,9666.639892196396,333.3601381398392,-6.094131755375021e-05 -3/26/20,279.4533333333334,9628.850869957887,371.14916388990974,-6.79960439408348e-05 -3/27/20,338.8566666666667,9586.966539138728,413.0334986208137,-7.585483162521576e-05 -3/28/20,404.9266666666667,9540.61953158616,459.38051052427915,-8.459599558129106e-05 -3/29/20,469.6966666666667,9489.423634748338,510.57641219331373,-9.430225762335835e-05 -3/30/20,539.4566666666667,9432.973791674332,567.0262606222051,-0.00010506074640561513 -3/31/20,627.24,9370.837885356395,629.1621728661532,-0.00011696683699850675 -4/1/20,711.2066666666667,9302.453787425597,697.5462773648485,-0.00013016277267359017 -4/2/20,812.0533333333334,9227.237783759485,772.7622883097854,-0.0001447873339664349 -4/3/20,918.6066666666667,9144.626035134926,855.3740449945691,-0.0001609821841327032 -4/4/20,1029.4833333333333,9054.062771173381,945.9373178735826,-0.00017889981322058814 -4/5/20,1123.5500000000002,8955.000290340902,1044.9998085619877,-0.0001987035380708135 -4/6/20,1222.2,8846.898959948136,1153.1011498357243,-0.00022056750231663365 -4/7/20,1320.7366666666667,8729.227216150326,1270.772905631511,-0.0002446766763838338 +1/23/20,0.0033333333333333335,9999.628058431466,0.3722927688032967,-0.0007040034805373606 +1/24/20,0.006666666666666667,9999.584938001008,0.41580288093746404,-0.0014884223964612472 +1/25/20,0.006666666666666667,9999.536778622145,0.4643949136002849,-0.002362641454030979 +1/26/20,0.016666666666666666,9999.482986330127,0.5186678955261851,-0.003337243370338349 +1/27/20,0.016666666666666666,9999.422518891975,0.5796729614406955,-0.0044308317983486455 +1/28/20,0.016666666666666666,9999.354773561969,0.6480179968329275,-0.005654147928952285 +1/29/20,0.016666666666666666,9999.279363006675,0.7240936258593194,-0.007014068137553173 +1/30/20,0.016666666666666666,9999.19566896133,0.8085233757734609,-0.008521589491029108 +1/31/20,0.023333333333333334,9999.102842229846,0.9021636769260926,-0.01019182974773179 +2/1/20,0.02666666666666667,9998.9998026848,1.0061038627651069,-0.012044027357486806 +2/2/20,0.02666666666666667,9998.885239267456,1.121666169835547,-0.014101541461593663 +2/3/20,0.03666666666666667,9998.757609987737,1.2504057377796078,-0.016391851892825736 +2/4/20,0.03666666666666667,9998.615141924243,1.394110609336636,-0.018946559175430318 +2/5/20,0.03666666666666667,9998.455831224253,1.5548017303431279,-0.021801384525128593 +2/6/20,0.03666666666666667,9998.277443103714,1.7347329497327317,-0.024996169849115624 +2/7/20,0.03666666666666667,9998.077511847243,1.936391019536249,-0.02857487774606041 +2/8/20,0.03666666666666667,9997.853340808133,2.16249559488163,-0.03258559150610582 +2/9/20,0.03666666666666667,9997.602002408354,2.4159992339939764,-0.03708051511086861 +2/10/20,0.03666666666666667,9997.320338138541,2.700087398195544,-0.04211597323343945 +2/11/20,0.04,9997.004958558007,3.0181784519057357,-0.04775241123838292 +2/12/20,0.04,9996.652243294737,3.3739236626411095,-0.05405439518173746 +2/13/20,0.043333333333333335,9996.258341045388,3.771207201015371,-0.06109061181101542 +2/14/20,0.043333333333333335,9995.81916957529,4.214146140739382,-0.06893386856520312 +2/15/20,0.043333333333333335,9995.330232492453,4.707275313764636,-0.07766450196990733 +2/16/20,0.043333333333333335,9994.777727674851,5.26451796199655,-0.08753582393778898 +2/17/20,0.043333333333333335,9994.156022615618,5.8915548902340475,-0.0986487878573327 +2/18/20,0.043333333333333335,9993.464353111347,6.589154851454861,-0.11101279335023419 +2/19/20,0.043333333333333335,9992.69946042638,7.3606028127407495,-0.12468257161880995 +2/20/20,0.043333333333333335,9991.855591292804,8.211699955277496,-0.1397581854459973 +2/21/20,0.05,9990.924497910455,9.150763674354904,-0.15638502919535432 +2/22/20,0.05,9989.895437946914,10.188627579366814,-0.1747538288110599 +2/23/20,0.05,9988.755174537511,11.33864149381108,-0.19510064181791373 +2/24/20,0.05,9987.48797628532,12.616671455289586,-0.21770685732133638 +2/25/20,0.05,9986.075617261164,14.041099715508242,-0.24289919600736895 +2/26/20,0.05,9984.497377003609,15.63282474027698,-0.27104971014267376 +2/27/20,0.05333333333333334,9982.730040518976,17.415261209509755,-0.3025757835745336 +2/28/20,0.05333333333333334,9980.747898281325,19.414340017224553,-0.3379401317308519 +2/29/20,0.08,9978.522746232464,21.658508271543386,-0.3776508016201536 +3/1/20,0.1,9976.023885781953,24.17872929469229,-0.4222611718315836 +3/2/20,0.17666666666666667,9973.218123807092,27.008482623001317,-0.4723699525349084 +3/3/20,0.24333333333333335,9970.06977265293,30.183764006904557,-0.5286211854805146 +3/4/20,0.3466666666666667,9966.540650132269,33.743085410940104,-0.5917042439994096 +3/5/20,0.5733333333333334,9962.590079525648,37.72747501375012,-0.6623538330032225 +3/6/20,0.7233333333333334,9958.17488958136,42.180477208080745,-0.741349988984202 +3/7/20,1.12,9953.24941451544,47.14815260078217,-0.8295180800152187 +3/8/20,1.5,9947.765494011675,52.67907801280858,-0.9277288057497628 +3/9/20,1.7133333333333334,9941.672473221593,58.82434647921826,-1.0368981974219467 +3/10/20,2.3600000000000003,9934.90003803527,65.65502898565009,-1.1586181964701436 +3/11/20,3.6833333333333336,9927.357199268354,73.26310949247375,-1.2949824971167454 +3/12/20,5.19,9918.977798145212,81.71514231103055,-1.4468072437029411 +3/13/20,7.156666666666667,9909.678411561374,91.09512544786146,-1.6152851003958362 +3/14/20,9.523333333333333,9899.356963790717,101.50591398054698,-1.802038529797377 +3/15/20,9.726666666666667,9887.892726485457,113.06922005770684,-2.0091197929443516 +3/16/20,14.356666666666667,9875.146318676158,125.92561289900037,-2.239010949308391 +3/17/20,20.32,9860.959706771722,140.23451879512618,-2.494623856795967 +3/18/20,29.576666666666668,9845.156204559402,156.1742211078224,-2.7793001717483943 +3/19/20,46.980000000000004,9827.540473204794,173.94186026986645,-3.0968113489418276 +3/20/20,64.67666666666668,9807.898521251835,193.75343378507532,-3.451358641587265 +3/21/20,85.75,9785.99770462281,215.8437962283053,-3.847573101330547 +3/22/20,112.11333333333334,9761.586726618345,240.46665924545206,-4.290515578252354 +3/23/20,145.54333333333335,9734.395637917414,267.89459155345094,-4.78567672086821 +3/24/20,179.12,9704.13583657733,298.4190189402763,-5.33897697612848 +3/25/20,219.26000000000002,9670.500068033754,332.3502242649422,-5.956766589418368 +3/26/20,279.4533333333334,9633.162425100692,370.0173474575022,-6.645825604557929 +3/27/20,338.8566666666667,9591.778347970492,411.7683855190489,-7.413363863802048 +3/28/20,404.9266666666667,9545.984624213848,457.97019252171475,-8.267021007840462 +3/29/20,469.6966666666667,9495.399388779793,509.0084796086712,-9.214866475797745 +3/30/20,539.4566666666667,9439.622123995714,565.2878149941292,-10.265399505233308 +3/31/20,627.24,9378.225068719315,627.2403987348546,-11.427939928362765 +4/1/20,711.2066666666667,9310.650698204987,695.4303515061353,-12.71637374733341 +4/2/20,812.0533333333334,9236.321441869342,770.4416733410799,-14.144215936599569 +4/3/20,918.6066666666667,9154.67862991096,852.8395994098861,-15.725284954048453 +4/4/20,1029.4833333333333,9065.170950913795,943.1824939167649,-17.47445257061634 +4/5/20,1123.5500000000002,8967.254451847157,1042.021850099939,-19.407643870288563 +4/6/20,1222.2,8860.39253806574,1149.9022902316447,-21.54183725009952 +4/7/20,1320.7366666666667,8744.0559733096,1267.3615656181303,-23.895064420132684 diff --git a/out/COVID-19-SIR-data.csv b/out/COVID-19-SIR-data.csv index 68fc931..a0805e1 100644 --- a/out/COVID-19-SIR-data.csv +++ b/out/COVID-19-SIR-data.csv @@ -1,3 +1,4 @@ Beta: 0.11506051868918243 Gamma: 0.004484787817138545 -R0: 25.65573297570077
\ No newline at end of file +R0: 25.65573297570077 +Predicted I: 1266.8105911330124, Actual I: 1320.7366666666667
\ No newline at end of file diff --git a/out/SARS-ESIR-data.csv b/out/SARS-ESIR-data.csv index 3ec411f..21d4469 100644 --- a/out/SARS-ESIR-data.csv +++ b/out/SARS-ESIR-data.csv @@ -1,4 +1,5 @@ Beta: 0.2367418297398915 Gamma: 0.08679182290949222 Mu: 0.10967338538708958 -R0: 1.205006381498899
\ No newline at end of file +R0: 1.205006381498899 +Predicted I: 934.6265172952101, Actual I: 877.5
\ No newline at end of file diff --git a/out/SARS-Linear-data.csv b/out/SARS-Linear-data.csv index 47d9faa..a322350 100644 --- a/out/SARS-Linear-data.csv +++ b/out/SARS-Linear-data.csv @@ -1,3 +1,4 @@ Beta: 0.00225573366659839 Gamma: 0.01741524200420521 -R0: 0.12952640371312119
\ No newline at end of file +R0: 0.12952640371312119 +Predicted I: 946.0965063014658, Actual I: 877.5
\ No newline at end of file diff --git a/out/SARS-SEIR-data.csv b/out/SARS-SEIR-data.csv index face094..36fe951 100644 --- a/out/SARS-SEIR-data.csv +++ b/out/SARS-SEIR-data.csv @@ -1,5 +1,6 @@ -Beta: 0.01082548864886504 -Gamma: 1e-08 -Mu: 1e-08 -Sigma: 0.0010246938312194157 -R0: 541269.1501908005
\ No newline at end of file +Beta: 0.025728454417841363 +Gamma: 0.001 +Mu: 0.001 +Sigma: 0.5156784257190153 +R0: 12.83932927130887 +Predicted I: 1009.5304659757634, Actual I: 877.5
\ No newline at end of file diff --git a/out/SARS-SEIR-prediction.csv b/out/SARS-SEIR-prediction.csv index fb009fd..b5ab71d 100644 --- a/out/SARS-SEIR-prediction.csv +++ b/out/SARS-SEIR-prediction.csv @@ -1,77 +1,77 @@ ,Actual,S,I,R 4/10/03,499.0,9500.0,500.0,0.0 -4/11/03,529.5,9494.832776379075,505.16722864414726,-1.0049017893654477e-05 -4/12/03,554.0,9489.615021231453,510.38498886174114,-2.0196708490327354e-05 -4/14/03,595.0,9484.346299922172,515.6537152881966,-3.044403329478051e-05 -4/15/03,616.0,9479.026175635721,520.9738447394818,-4.07919681313532e-05 -4/16/03,634.0,9473.654208751632,526.3458168365376,-5.124149936138442e-05 -4/17/03,648.5,9468.229956265563,531.7700745841634,-6.179360882997584e-05 -4/18/03,679.0,9462.752972916978,537.247063243363,-7.244928711449601e-05 -4/19/03,679.0,9457.222811208285,542.7772303122033,-8.320953379882134e-05 -4/21/03,701.0,9451.639021404832,548.3610255258131,-9.407535747333604e-05 -4/22/03,717.0,9446.001151534903,553.9989008563845,-0.00010504777573493214 -4/23/03,729.0,9440.30874738973,559.6913105131715,-0.00011612781518700943 -4/24/03,744.0,9434.561352523486,565.4387109424914,-0.00012731651143947555 -4/25/03,755.0,9428.758508253284,571.2415608277236,-0.0001386149091087459 -4/26/03,763.5,9422.899753659178,577.1003210893101,-0.00015002406181774378 -4/28/03,778.5,9416.984625584166,583.0154548847557,-0.0001615450321959002 -4/29/03,786.0,9411.012658634185,588.9874276086279,-0.00017317889187915396 -4/30/03,794.5,9404.983385178115,595.0167068925563,-0.00018492672150995177 -5/1/03,800.0,9398.896335347777,601.1037626052337,-0.0001967896107372481 -5/2/03,805.5,9392.751037037935,607.249066852415,-0.00020876865821650522 -5/3/03,810.5,9386.547015906293,613.4530939769181,-0.00022086497160969318 -5/5/03,818.5,9380.283795373496,619.7163205586231,-0.0002330796675852899 -5/6/03,823.0,9373.960896623134,626.039225414473,-0.000245413871818281 -5/7/03,827.0,9367.577838601735,632.4222895984733,-0.00025786871899016007 -5/8/03,830.5,9361.134138018771,638.865996401692,-0.00027044535278892835 -5/9/03,833.5,9354.629309346652,645.3708313522598,-0.000283144925909095 -5/10/03,837.0,9348.062864820737,651.93728221537,-0.00029596860005167694 -5/12/03,841.5,9341.434314439317,658.5658389932785,-0.0003089175459241988 -5/13/03,844.5,9334.743165963633,665.2569939253037,-0.00032199294324069313 -5/14/03,849.0,9327.988924917861,672.0112414878266,-0.0003351959807217004 -5/15/03,851.5,9321.171094589126,678.8290783942911,-0.00034852785609426867 -5/16/03,853.0,9314.289176027485,685.711003595203,-0.00036198977609195373 -5/17/03,855.0,9307.342668079065,692.6575182450104,-0.00037558295647366943 -5/19/03,857.0,9300.331096358257,699.669096729908,-0.0003893086386532089 -5/20/03,859.0,9293.253974616735,706.746225298807,-0.00040316806803868246 -5/21/03,859.5,9286.110787611027,713.8894191957595,-0.00041716248377624443 -5/22/03,861.0,9278.90101970139,721.0991940611004,-0.0004312931348895171 -5/23/03,862.0,9271.6241548518,728.3760659314465,-0.0004455612802795907 -5/24/03,862.0,9264.279676629953,735.7205512396977,-0.00045996818872502313 -5/26/03,863.0,9256.86706820727,743.1331668150356,-0.0004745151388818404 -5/27/03,864.0,9249.385812358894,750.6144298829247,-0.0004892034192835363 -5/28/03,865.0,9241.83539146369,758.1648580651118,-0.0005040343283410723 -5/29/03,866.0,9234.215287504241,765.7849693796263,-0.0005190091743428781 -5/30/03,868.0,9226.52498206686,773.47528224078,-0.0005341292754548511 -5/31/03,869.5,9218.763956341574,781.2363154591667,-0.0005493959597203565 -6/2/03,873.0,9210.931691122136,789.0685882416632,-0.0005648105650602276 -6/3/03,873.5,9203.027666806023,796.9726201914284,-0.0005803744392727652 -6/4/03,874.0,9195.05136339443,804.9489313079039,-0.0005960889400337384 -6/5/03,874.0,9187.002260492278,812.9980419868135,-0.0006119554348963837 -6/6/03,875.0,9178.879837308206,821.1204730201633,-0.0006279753012914061 -6/9/03,876.5,9170.68357265458,829.3167455962424,-0.0006441499265269778 -6/10/03,877.0,9162.41294494748,837.5873812996218,-0.0006604807077887393 -6/11/03,877.0,9154.067432206719,845.932902111155,-0.000676969052139799 -6/12/03,877.5,9145.646512055824,854.3538304079781,-0.000693616376520733 -6/13/03,877.5,9137.14966172205,862.8506889635098,-0.000710424107749585 -6/16/03,877.5,9128.576358036364,871.4240009474506,-0.0007273936825218674 -6/17/03,877.5,9119.926077433467,880.0742899257843,-0.0007445265474105596 -6/18/03,877.5,9111.198295951777,888.8020798607764,-0.0007618241588661093 -6/19/03,877.5,9102.392489233433,897.6078951109752,-0.0007792879832164324 -6/20/03,877.5,9093.508132524295,906.4922604312112,-0.0007969194966669115 -6/23/03,877.5,9084.544700673952,915.4557009725976,-0.0008147201853003983 -6/24/03,877.5,9075.501668135706,924.4987422825302,-0.0008326915450772123 -6/25/03,877.5,9066.378508966589,933.6219103046864,-0.0008508350818351401 -6/26/03,877.5,9057.174696827351,942.8257313790269,-0.0008691523112894365 -6/27/03,877.5,9047.88970498246,952.1107322417946,-0.0008876447590328244 -6/30/03,877.5,9038.523006300118,961.4774400255145,-0.0009063139605354945 -7/1/03,877.5,9029.074073252237,970.9263822589945,-0.0009251614611451053 -7/2/03,877.5,9019.542377914458,980.4580868673245,-0.0009441888160867831 -7/3/03,877.5,9009.927391966141,990.0730821718771,-0.000963397590463122 -7/4/03,877.5,9000.228586690371,999.7718968903075,-0.0009827893592541843 -7/7/03,877.5,8990.445432973953,1009.5550601365533,-0.0010023657073175002 -7/8/03,877.5,8980.577401307413,1019.4231014208335,-0.0010221282293880673 -7/9/03,877.5,8970.623961785,1029.3765506496513,-0.0010420785300783515 -7/10/03,877.5,8960.58458410469,1039.4159381257912,-0.001062218223878286 -7/11/03,877.5,8950.458737568173,1049.5417945483198,-0.0010825489351552733 -8/7/03,877.5,8940.245891080865,1059.7546510125874,-0.0011030722981541815 +4/11/03,529.5,9488.143162506229,512.2324397544037,-0.882177497810673 +4/12/03,554.0,9476.015278199106,524.4828138338451,-1.5242471976604952 +4/14/03,595.0,9463.61746158547,536.7439192089786,-1.9198867883573725 +4/15/03,616.0,9450.951000086068,549.0082565721088,-2.0626387148311833 +4/16/03,634.0,9438.017324845176,561.2680305425346,-1.945883524120254 +4/17/03,648.5,9424.818074365996,573.5154325046063,-1.5631820185401133 +4/18/03,679.0,9411.355094510642,585.742640607726,-0.9082752556834991 +4/19/03,679.0,9397.630438500142,597.9418197663479,0.024915451579647783 +4/21/03,701.0,9383.64636691444,610.1051216599773,1.2422885351021797 +4/22/03,717.0,9369.405347692396,622.2246847331717,2.749562171459745 +4/23/03,729.0,9354.910056131788,634.2926341955401,4.552274281950783 +4/24/03,744.0,9340.163374889304,646.3010820217438,6.655782532596537 +4/25/03,755.0,9325.168393980548,658.2421269514947,9.065264334141032 +4/26/03,763.5,9309.928410780045,670.1078544895577,11.785716842051098 +4/28/03,778.5,9294.446930021231,681.8903369057483,14.821956956516354 +4/29/03,786.0,9278.727663796457,693.5816332349345,18.17862132244922 +4/30/03,794.5,9262.77453155699,705.1737892770357,21.860166329484905 +5/1/03,800.0,9246.591660113014,716.6588375970233,25.87086811198139 +5/2/03,805.5,9230.183383633626,728.02879752492,30.21482254901951 +5/3/03,810.5,9213.554213017553,739.2758026679536,34.895845894572574 +5/5/03,818.5,9196.708494944753,750.3934275690843,39.91646096476348 +5/6/03,823.0,9179.651049507724,761.3738491927566,45.28014979518666 +5/7/03,827.0,9162.38694744813,772.2088625477973,50.99054403665055 +5/8/03,830.5,9144.921373268242,782.8904680085917,57.050963556445716 +5/9/03,833.5,9127.25962523094,793.4108713150828,63.46441643834487 +5/10/03,837.0,9109.407115359705,803.7624835727712,70.23359898260281 +5/12/03,841.5,9091.369369438624,813.9379212527157,77.36089570595655 +5/13/03,844.5,9073.152027012395,823.9300061915324,84.84837934162513 +5/14/03,849.0,9054.760841386316,833.7317655913955,92.69781083930978 +5/15/03,851.5,9036.201679626292,843.336432020037,100.91063936519383 +5/16/03,853.0,9017.480522558837,852.7374434107469,109.48800230194281 +5/17/03,855.0,8998.603464771062,861.9284430623726,118.43072524870426 +5/19/03,857.0,8979.576714610694,870.9032796393195,127.73932202110795 +5/20/03,859.0,8960.406594186059,879.6560071715509,137.4139946512657 +5/21/03,859.5,8941.09953936609,888.1808850545877,147.45463338777157 +5/22/03,861.0,8921.66209978033,896.4723780495091,157.8608166957016 +5/23/03,862.0,8902.100938818916,904.5251562829511,168.6318112566142 +5/24/03,862.0,8882.422833632607,912.3340952471086,179.7665719685495 +5/26/03,863.0,8862.634675132751,919.8942757997339,191.26374194603017 +5/27/03,864.0,8842.743467991315,927.2009841641368,203.12165252006082 +5/28/03,865.0,8822.756330640865,934.2497119291854,215.33832323812825 +5/29/03,866.0,8802.68049527457,941.0361560493054,227.91146186420127 +5/30/03,868.0,8782.523307846213,947.5562188444801,240.83846437873098 +5/31/03,869.5,8762.292228070175,953.8060080002509,254.11641497865054 +6/2/03,873.0,8741.994225190268,959.7828121453628,267.74165257842384 +6/3/03,873.5,8721.634677655516,965.486554667193,281.7093184069934 +6/4/03,874.0,8701.22087437266,970.9139958690845,296.01601839864543 +6/5/03,874.0,8680.760203316595,976.0619740683078,310.6581926345152 +6/6/03,875.0,8660.25994557464,980.9277531571834,325.6319518728658 +6/9/03,876.5,8639.727275346546,985.5090226030803,340.9330775490888 +6/10/03,877.0,8619.16925994449,989.8038974484182,356.557021775704 +6/11/03,877.0,8598.59285979308,993.810918310665,372.49890734235925 +6/12/03,877.5,8578.004928429345,997.529051382339,388.7535277158306 +6/13/03,877.5,8557.412212502752,1000.9576884310075,405.31534704002274 +6/16/03,877.5,8536.821351775183,1004.0966467992869,422.17850013596797 +6/17/03,877.5,8516.238879120961,1006.9461694048438,439.3367925018271 +6/18/03,877.5,8495.671220526829,1009.5069247403937,456.7837003128893 +6/19/03,877.5,8475.124695091961,1011.7800068737015,474.51237042157175 +6/20/03,877.5,8454.605515027957,1013.766935447582,492.5156203574199 +6/23/03,877.5,8434.119785658848,1015.4696556798989,510.78593832710726 +6/24/03,877.5,8413.67350542109,1016.8905383635657,529.3154832144359 +6/25/03,877.5,8393.272565863565,1018.0323798665452,548.096084580336 +6/26/03,877.5,8372.92275164759,1018.8984021318494,567.1192426628656 +6/27/03,877.5,8352.629740546905,1019.49225267754,586.3761283772112 +6/30/03,877.5,8332.399103447675,1019.8180045967284,605.8575833156879 +7/1/03,877.5,8312.236304348502,1019.8801565575749,625.5541197477385 +7/2/03,877.5,8292.146700360407,1019.6836328032894,645.455920619934 +7/3/03,877.5,8272.135541706844,1019.2337831521314,665.5528395559738 +7/4/03,877.5,8252.207971723692,1018.5363829974096,685.8344008566856 +7/7/03,877.5,8232.369026859264,1017.5976333074824,706.2897995000255 +7/8/03,877.5,8212.623636674289,1016.4241606257575,726.9079011410773 +7/9/03,877.5,8192.976623841936,1015.0230170706917,747.6772421120531 +7/10/03,877.5,8173.432704147797,1013.401680335792,768.5860294222934 +7/11/03,877.5,8153.996486489892,1011.5680536896141,789.6221407582674 +8/7/03,877.5,8134.672472878669,1009.5304659757634,810.7731244835715 diff --git a/out/SARS-SIR-data.csv b/out/SARS-SIR-data.csv index b8e7f28..d6e9dfa 100644 --- a/out/SARS-SIR-data.csv +++ b/out/SARS-SIR-data.csv @@ -1,3 +1,4 @@ -Beta: 0.031662971068960946 -Gamma: 0.018519768809938723 -R0: 1.7096850070811285
\ No newline at end of file +Beta: 0.031663066064741584 +Gamma: 0.018520041050816886 +R0: 1.7096650044058612 +Predicted I: 1006.3748700651734, Actual I: 877.5
\ No newline at end of file diff --git a/out/SARS-SIR-prediction.csv b/out/SARS-SIR-prediction.csv index 9a3a4c5..ba1c85f 100644 --- a/out/SARS-SIR-prediction.csv +++ b/out/SARS-SIR-prediction.csv @@ -1,77 +1,77 @@ ,Actual,S,I,R 4/10/03,499.0,9500.0,500.0,0.0 -4/11/03,529.5,9484.884979595565,505.80148109959003,9.313539304844733 -4/12/03,554.0,9469.619417390539,511.64566678773895,18.73491582172085 -4/14/03,595.0,9454.202845099702,517.5322376669819,28.26491723331429 -4/15/03,616.0,9438.634815392412,523.4608571171718,37.90432749041551 -4/16/03,634.0,9422.91490886804,529.4311682856298,47.65392284632816 -4/17/03,648.5,9407.04273428322,535.4427939878531,57.51447172892478 -4/18/03,679.0,9391.017928551839,541.4953367075137,67.48673474064691 -4/19/03,679.0,9374.840156745033,547.5883785964601,77.57146465850494 -4/21/03,701.0,9358.509112091206,553.7214814747153,87.76940643407822 -4/22/03,717.0,9342.024515976005,559.894186830479,98.08129719351507 -4/23/03,729.0,9325.38611794234,566.1060158201255,108.5078662375327 -4/24/03,744.0,9308.593695690377,572.3564692682052,119.04983504141725 -4/25/03,755.0,9291.647076432952,578.6450722781254,129.70785128892103 -4/26/03,763.5,9274.546254563056,584.9716358776624,140.48210955928025 -4/28/03,778.5,9257.291082520527,591.3356116538148,151.37330582565713 -4/29/03,786.0,9239.88140918478,597.736342445242,162.38224836997682 -4/30/03,794.5,9222.31712462584,604.173152454918,173.50972291924018 -5/1/03,800.0,9204.598160104344,610.6453472501305,184.75649264552393 -5/2/03,805.5,9186.724488071535,617.1522137624829,196.1232981659804 -5/3/03,810.5,9168.696122169269,623.6930202878924,207.61085754283772 -5/5/03,818.5,9150.513117230008,630.2670164865909,219.21986628339982 -5/6/03,823.0,9132.175569276827,636.8734333831252,230.95099734004629 -5/7/03,827.0,9113.68361552341,643.5114833663562,242.80490111023255 -5/8/03,830.5,9095.03743437405,650.1803601894597,254.78220543648973 -5/9/03,833.5,9076.237245423648,656.8792389699258,266.8835156064247 -5/10/03,837.0,9057.283309457718,663.6072761895597,279.10941435272 -5/12/03,841.5,9038.175928452385,670.3636096944803,291.4604618531342 -5/13/03,844.5,9018.915445574376,677.1473586951217,303.9371957305013 -5/14/03,849.0,8999.502245181035,683.9576237662324,316.5401310527311 -5/15/03,851.5,8979.936752820313,690.7934868468756,329.26976033280937 -5/16/03,853.0,8960.219435230772,697.6540112404288,342.1265535287975 -5/17/03,855.0,8940.350800341583,704.5382416145842,355.11095804383234 -5/19/03,857.0,8920.331397272523,711.4452040013485,368.223398726127 -5/20/03,859.0,8900.161816333986,718.3739057970432,381.46427786896993 -5/21/03,859.5,8879.84268902697,725.3233357623042,394.8339752107257 -5/22/03,861.0,8859.374688043083,732.2924640220818,408.3328479348343 -5/23/03,862.0,8838.758527264547,739.2802420656409,421.96123066981147 -5/24/03,862.0,8817.994961764189,746.2856027465614,435.719435489249 -5/26/03,863.0,8797.084787805446,753.3074602827372,449.60775191181426 -5/27/03,864.0,8776.028842842372,760.3447102563772,463.62644690125006 -5/28/03,865.0,8754.828005519617,767.3962296140044,477.77576486637554 -5/29/03,866.0,8733.483195672457,774.4608766664569,492.05592766108515 -5/30/03,868.0,8711.995374326762,781.5374910888871,506.46713458434937 -5/31/03,869.5,8690.365543699023,788.6248939207617,521.0095623802142 -6/2/03,873.0,8668.594747196334,795.7218875658625,535.6833652378015 -6/3/03,873.5,8646.684069416404,802.8272557922855,550.4886747913089 -6/4/03,874.0,8624.634636147548,809.9397637324413,565.4256001200094 -6/5/03,874.0,8602.447614368692,817.0581578830551,580.4942277482527 -6/6/03,875.0,8580.12421224937,824.1811661051668,595.6946216454631 -6/9/03,876.5,8557.665679149726,831.3074976241306,611.0268232261413 -6/10/03,877.0,8535.073305620519,838.4358430296157,626.490851349864 -6/11/03,877.0,8512.34842340311,845.5648742756055,642.0867023212829 -6/12/03,877.5,8489.492405429475,852.6932446803977,657.8143498901256 -6/13/03,877.5,8466.506665822197,859.8195889266052,673.6737452511964 -6/16/03,877.5,8443.392659894469,866.9425230611552,689.664817044374 -6/17/03,877.5,8420.151884150095,874.0606444952892,705.7874713546134 -6/18/03,877.5,8396.78587628349,881.1725320045638,722.0415917119461 -6/19/03,877.5,8373.296215179671,888.2767457288496,738.4270390914784 -6/20/03,877.5,8349.684520914274,895.3718271723321,754.943651913392 -6/23/03,877.5,8325.952454753542,902.4562992035115,771.5912460429457 -6/24/03,877.5,8302.101719154323,909.528666055202,788.3696147904728 -6/25/03,877.5,8278.134057764082,916.587413324533,805.2785289113833 -6/26/03,877.5,8254.051255420887,923.6310079729482,822.3177366061623 -6/27/03,877.5,8229.855138153422,930.6578983262057,839.4869635203708 -6/30/03,877.5,8205.547573180975,937.6665140743783,856.7859127446457 -7/1/03,877.5,8181.130468913446,944.6552662718534,874.214264814699 -7/2/03,877.5,8156.605774951346,951.622547337333,891.7716777113201 -7/3/03,877.5,8131.9754820857925,958.5667310538335,909.4577868603722 -7/4/03,877.5,8107.241622298517,965.4861725686861,927.2722051327953 -7/7/03,877.5,8082.406268761857,972.3792083935365,945.2145228446052 -7/8/03,877.5,8057.47153583876,979.2441564043446,963.2843077568929 -7/9/03,877.5,8032.439579082788,986.0793158413854,981.4811050758253 -7/10/03,877.5,8007.312595238105,992.8829673092482,999.8044374526455 -7/11/03,877.5,7982.09282223949,999.6533727768367,1018.2538049836719 -8/7/03,877.5,7956.78253921233,1006.3887755773695,1036.8286852102988 +4/11/03,529.5,9484.884935661017,505.8013889745629,9.313675364418977 +4/12/03,554.0,9469.619331935233,511.64548026583697,18.73518779892931 +4/14/03,595.0,9454.202720592919,517.5319544515797,28.2653249555004 +4/15/03,616.0,9438.63465435934,523.4604748870292,37.904870753629005 +4/16/03,634.0,9422.914713889772,529.4306846954333,47.65460141479498 +4/17/03,648.5,9407.042507996706,535.4422066687719,57.51528533452196 +4/18/03,679.0,9391.017673649865,541.4946432677566,67.4876830823774 +4/19/03,679.0,9374.839875976195,547.5875766218314,77.57254740197249 +4/21/03,701.0,9358.508808259865,553.7205685291723,87.7706232109622 +4/22/03,717.0,9342.024191942268,559.8931604566872,98.08264760104534 +4/23/03,729.0,9325.385776622019,566.1048735400161,108.50934983796446 +4/24/03,744.0,9308.593340054962,572.355208583531,119.05145136150593 +4/25/03,755.0,9291.646709504466,578.6436906838157,129.7095998117178 +4/26/03,763.5,9274.545879350027,584.9701308897737,140.4839897601985 +4/28/03,778.5,9257.290702079748,591.3339807595457,151.37531716070546 +4/29/03,786.0,9239.88102664348,597.7345831059315,162.38439025058838 +4/30/03,794.5,9222.316743180114,604.1712621075803,173.51199471230524 +5/1/03,800.0,9204.597783017587,610.6433233089908,184.75889367342236 +5/2/03,805.5,9186.724118672875,617.1500536205109,196.1258277066142 +5/3/03,810.5,9168.695763851998,623.6907213183381,207.61351482966353 +5/5/03,818.5,9150.512773450018,630.2645760445189,219.2226505054614 +5/6/03,823.0,9132.175243551043,636.8708488069497,230.95390764200704 +5/7/03,827.0,9113.683311428216,643.5087519793758,242.80793659240803 +5/8/03,830.5,9095.037155543727,650.1774793013924,254.78536515488017 +5/9/03,833.5,9076.236995548808,656.8762058784436,266.8867985727474 +5/10/03,837.0,9057.283092283735,663.604088181823,279.11281953444217 +5/12/03,841.5,9038.175747777821,670.360264048674,291.4639881735049 +5/13/03,844.5,9018.915305249426,677.1438526819887,303.9408420685844 +5/14/03,849.0,8999.502149105952,683.9539546506091,316.543896243438 +5/15/03,851.5,8979.936704943842,690.7896518892264,329.27364316693064 +5/16/03,853.0,8960.219439548582,697.6500076983813,342.13055275303606 +5/17/03,855.0,8940.3508608947,704.5340667444635,355.1150723608361 +5/19/03,857.0,8920.331518145767,711.4408550597127,368.22762679452086 +5/20/03,859.0,8900.162001654393,718.3693800422175,381.46861830338855 +5/21/03,859.5,8879.842942962237,725.3186304559161,394.838426581846 +5/22/03,861.0,8859.375014799996,732.287576430596,408.33740876940783 +5/23/03,862.0,8838.758931087408,739.275169461894,421.96589945069735 +5/24/03,862.0,8817.995446933257,746.2803424112967,435.72421065544575 +5/26/03,863.0,8797.085358635368,753.3020095061394,449.6126318584927 +5/27/03,864.0,8776.029503680607,760.3390663396073,463.63142997978605 +5/28/03,865.0,8754.828760744882,767.390389870735,477.780849384382 +5/29/03,866.0,8733.484049693148,774.4548384244063,492.0611118824449 +5/30/03,868.0,8711.996331579398,781.5312516913542,506.4724167292473 +5/31/03,869.5,8690.366608646667,788.6184507281615,521.0149406251701 +6/2/03,873.0,8668.595924327037,795.7152379572603,535.6888377157028 +6/3/03,873.5,8646.685363241626,802.8203971669316,550.4942395914422 +6/4/03,874.0,8624.6360512006,809.9326935113064,565.4312552880943 +6/5/03,874.0,8602.449155203163,817.050873510365,580.499971286473 +6/6/03,875.0,8580.125883437562,824.1736650499366,595.7004515125006 +6/9/03,876.5,8557.667485281094,831.2997773817003,611.0327373372073 +6/10/03,877.0,8535.075251300084,838.4279011231844,626.4968475767317 +6/11/03,877.0,8512.350513249914,845.5567082577664,642.0927784923211 +6/12/03,877.5,8489.494644074995,852.6848521346736,657.8205037903302 +6/13/03,877.5,8466.509057908796,859.8109674689823,673.679974622223 +6/16/03,877.5,8443.395210073812,866.9336703416184,689.6711195845708 +6/17/03,877.5,8420.154597081591,874.051558199357,705.7938447190535 +6/18/03,877.5,8396.788756632719,881.1632098548229,722.0480335124596 +6/19/03,877.5,8373.299267616825,888.2671854864899,738.4335468966855 +6/20/03,877.5,8349.687750112584,895.3620266386816,754.9502232487357 +6/23/03,877.5,8325.955865387707,902.4462562215705,771.5978783907235 +6/24/03,877.5,8302.105315898953,909.5183785111789,788.3763055898696 +6/25/03,877.5,8278.137845292118,916.5768791493783,805.2852755585043 +6/26/03,877.5,8254.055238402047,923.6202251438895,822.3245364540645 +6/27/03,877.5,8229.859321252621,930.646864868283,839.4938138790968 +6/30/03,877.5,8205.551961056768,937.6552280619782,856.792810881255 +7/1/03,877.5,8181.135066216455,944.6437258302445,874.2212079533022 +7/2/03,877.5,8156.610586322692,951.6107506442,891.7786630331084 +7/3/03,877.5,8131.980512155535,958.5546763408129,909.4648115036531 +7/4/03,877.5,8107.246875684078,965.4738581229003,927.2792661930238 +7/7/03,877.5,8082.411750066457,972.3666325591284,945.2216173744155 +7/8/03,877.5,8057.477249649856,979.2313175840138,963.2914327661321 +7/9/03,877.5,8032.445529970494,986.0662124979214,981.4882575315858 +7/10/03,877.5,8007.318787753639,992.8695979670663,999.8116142792966 +7/11/03,877.5,7982.099260913596,999.6397360235123,1018.2610030628935 +8/7/03,877.5,7956.7892285537155,1006.3748700651734,1036.8359013811128 @@ -18,7 +18,7 @@ parser.add_argument('--disease', '-D', dest = 'disease', default = 'COVID-19', h parser.add_argument('--out', '-o', dest = 'out', default = None, help = 'the name of the graph and csv files; defaults to the name of the disease') parser.add_argument('--start', '-s', dest = 'start', default = '1/22/20', help = 'the date where the data starts (defaults to the start date of COVID-19 (1/22/20))') parser.add_argument('--end', '-e', dest = 'end', default = None, help = 'the date where the data stops (defaults to whereever the input data ends)') -parser.add_argument('--incubation', '-i', dest = 'incubation_period', default = None, help = 'the incubation period of the disease (only applicable if using SIRE model; ignored otherwise); none by default') +parser.add_argument('--incubation', '-i', dest = 'incubation_period', default = None, help = 'the incubation period of the disease (only applicable if using SEIR model; ignored otherwise); none by default') parser.add_argument('--predict', '-p', dest = 'prediction_range', default = None, help = 'the number of days to predict the course of the disease (defaults to None, meaning the model will not predict beyond the given data)') parser.add_argument('--country', '-c', dest = 'country', default = 'US', help = 'the country that is being modeled (defaults to US)') parser.add_argument('--popcountry', '-pc', dest = 'popcountry', default = '3328200000', help = 'the population of the country (defaults to US population)') @@ -72,20 +72,6 @@ class Learner(object): return out - def load_exposed(self, country): - """ - Load data for exposed persons - """ - df = pd.read_csv(f'{args.folder}/{args.disease}-Exposed.csv') - country_df = df[df['Country/Region'] == country] - - if args.end != None: - out = country_df.iloc[0].loc[args.start:args.end] - else: - out = country_df.iloc[0].loc[args.start:] - - return out - def extend_index(self, index, new_size): values = index.values @@ -131,7 +117,7 @@ class Learner(object): extended_actual = np.concatenate((data.values.flatten(), [0] * (size - len(data.values)))) if args.mode == 'SEIR': - result = solve_ivp(model, [0, size], [S_0,I_0,R_0,E_0], t_eval=np.arange(0, size, 1)) + result = solve_ivp(model, [0, size], [S_0,I_0,R_0,E_0], t_eval=np.arange(0, size, 1), vectorized=True) else: result = solve_ivp(model, [0, size], [S_0,I_0,R_0], t_eval=np.arange(0, size, 1), vectorized=True) @@ -150,10 +136,10 @@ class Learner(object): if args.mode == 'Linear': optimal = minimize( loss_linear, - [0.001, 0.001], + [0.01, 0.01], args=(confirmed_data, recovered_data), method='L-BFGS-B', - bounds=[(0.00000001, 0.4), (0.00000001, 0.4)] + bounds=[(0.001, 1.0), (0.001, 1.0)] ) beta, gamma = optimal.x print(f'Beta: {beta}, Gamma: {gamma}, R0: {beta/gamma}') @@ -161,14 +147,15 @@ class Learner(object): print(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: - file.write(f'Beta: {beta}\nGamma: {gamma}\nR0: {beta/gamma}') + file.write(f'Beta: {beta}\nGamma: {gamma}\nR0: {beta/gamma}\n') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') elif args.mode == 'SIR': optimal = minimize( loss_sir, - [0.001, 0.001], + [0.01, 0.01], args=(confirmed_data, recovered_data), method='L-BFGS-B', - bounds=[(0.00000001, 0.4), (0.00000001, 0.4)] + bounds=[(0.001, 1.0), (0.001, 1.0)] ) beta, gamma = optimal.x print(f'Beta: {beta}, Gamma: {gamma}, R0: {beta/gamma}') @@ -176,14 +163,15 @@ class Learner(object): print(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: - file.write(f'Beta: {beta}\nGamma: {gamma}\nR0: {beta/gamma}') + file.write(f'Beta: {beta}\nGamma: {gamma}\nR0: {beta/gamma}\n') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') elif args.mode == 'ESIR': optimal = minimize( loss_esir, - [0.001, 0.001, 0.001], + [0.01, 0.01, 0.01], args=(confirmed_data, recovered_data), method='L-BFGS-B', - bounds=[(0.00000001, 0.4), (0.00000001, 0.4), (0.00000001, 0.4)] + bounds=[(0.001, 1.0), (0.001, 1.0), (0.001, 1.0)] ) beta, gamma, mu = optimal.x print(f'Beta: {beta}, Gamma: {gamma}, Mu: {mu} R0: {beta/(gamma + mu)}') @@ -191,16 +179,17 @@ class Learner(object): print(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: - file.write(f'Beta: {beta}\nGamma: {gamma}\nMu: {mu}\nR0: {beta/(gamma + mu)}') + file.write(f'Beta: {beta}\nGamma: {gamma}\nMu: {mu}\nR0: {beta/(gamma + mu)}\n') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') elif args.mode == 'SEIR': # exposed_data = self.load_exposed(self.country) optimal = minimize( loss_seir, - [0.001, 0.001, 0.001, 0.001], + [0.01, 0.01, 0.01, 0.01], args=(confirmed_data, recovered_data), method='L-BFGS-B', - bounds=[(0.00000001, 0.4), (0.00000001, 0.4), (0.00000001, 0.4), (0.00000001, 0.4)] + bounds=[(0.001, 1.0), (0.001, 1.0), (0.001, 1.0), (0.001, 1.0)] ) beta, gamma, mu, sigma = optimal.x print(f'Beta: {beta}, Gamma: {gamma}, Mu: {mu}, Sigma: {sigma} R0: {(beta * sigma)/((mu + gamma) * (mu + sigma))}') @@ -208,7 +197,8 @@ class Learner(object): print(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') df = compose_df(prediction, extended_actual, correction_factor, new_index) with open(f'out/{args.disease}-{args.mode}-data.csv', 'w+') as file: - file.write(f'Beta: {beta}\nGamma: {gamma}\nMu: {mu}\nSigma: {sigma}\nR0: {(beta * sigma)/((mu + gamma) * (mu + sigma))}') + file.write(f'Beta: {beta}\nGamma: {gamma}\nMu: {mu}\nSigma: {sigma}\nR0: {(beta * sigma)/((mu + gamma) * (mu + sigma))}\n') + file.write(f'Predicted I: {prediction.y[1][-1] * int(args.popmodel)}, Actual I: {extended_actual[-1] * correction_factor}') fig, ax = plt.subplots(figsize=(15, 10)) ax.set_title(f'{args.disease} cases over time ({args.mode} Model)') df.plot(ax=ax) |