{"id":445,"date":"2020-04-27T17:07:24","date_gmt":"2020-04-27T15:07:24","guid":{"rendered":"https:\/\/houzardc.wordpress.com\/?page_id=445"},"modified":"2020-06-01T17:52:35","modified_gmt":"2020-06-01T15:52:35","slug":"prediction-of-the-epidemic-final-size","status":"publish","type":"page","link":"https:\/\/houzardc.fr\/?page_id=445","title":{"rendered":"Prediction of the epidemic final size"},"content":{"rendered":"\n<p><em>This article was originally published on Apr, 28. The graphs and values are updated regularly at <\/em><a href=\"#updated_pred\"><em>the end of this article.<\/em> <\/a><\/p>\n\n\n\n<div class=\"wp-block-cover has-background-dim is-style-default alignfull\" style=\"background-color:#354a6b;min-height:132px;aspect-ratio:unset;\"><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-text-color has-text-align-center has-large-font-size has-background-color\"><strong>Abstract<\/strong>: The purpose of this article is to predict the final size of the COVID-19 epidemic based on a logistic regression model by fitting the data of France, the US, Italy and Spain. <\/p>\n<\/div><\/div>\n\n\n\n<p>In this article, it will be tried to predict the final size of the COVID-19 epidemic per country based on a logistic regression.<\/p>\n\n\n\n<p>It is divided in 3 parts:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Logistic regression<\/strong>: the properties of this function will be explored<\/li><li><strong>Fitting of the model<\/strong>: it will be described how the best fit was chosen<\/li><li><strong>Results<\/strong>: the model will be applied to 4 countries: France, the US, Italy and Spain<\/li><li><strong>Conclusion<\/strong><\/li><li><strong>Updated prediction<\/strong><\/li><\/ol>\n\n\n\n<p>The codes that were used for these graphs are available on this <a href=\"https:\/\/github.com\/CleHou\/COVID-19-Data-Analysis-Project\/tree\/master\/03-Prediction\">GitHub repository<\/a>. The code used for the visualisation of the RMSE (\u00a72.1) is <a href=\"https:\/\/github.com\/CleHou\/COVID-19-Data-Analysis-Project\/blob\/master\/03-Prediction\/32%20-%20Visualisation%20of%20RMSE.py\">32 &#8211; Visualisation of RMSE.py<\/a>. The one used for the prediction is <a href=\"https:\/\/github.com\/CleHou\/COVID-19-Data-Analysis-Project\/blob\/master\/03-Prediction\/31%20-%20Mod%C3%A9lisation%20v2.0.py\">31 &#8211; Mod\u00e9lisation v2.0.py<\/a> (\u00a72.2 and \u00a73).<\/p>\n\n\n\n<div class=\"wp-block-cover has-background-dim alignwide\" style=\"background-color:#354a6b;min-height:69px;aspect-ratio:unset;\"><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<h2 class=\"wp-block-heading\">1. Logistic regression<\/h2>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1.1. Models to predict an <strong>epidemic<\/strong><\/h3>\n\n\n\n<p>An epidemic can be described by many models, more or less complex. The most usual models are the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Compartmental_models_in_epidemiology\">compartmental one<\/a>. They are called this way because they divide a population into categories. For example, the most basic compartmental model is the SIR: Suspected (i.e. not yet infected), Infectious and Recovered. It can give interesting insight on an epidemic like the number of people one can infect on average. <\/p>\n\n\n\n<p>On this model, the infectious curve is essentially a logistic regression if the constants of the model don&#8217;t change. Hence, for simplicity, we will consider here that the number of cases follows a logistic regression. Such an application <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-276a76eafbebc4494deafceec7cc4ddd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> can be expressed as a function of time with 3 parameters: <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-a0506f43a54d604053478e30493930bc_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/><\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-34eb8e056c2b8d80d6bd9cb5a4296002_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#99;&#61;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#97;&#108;&#112;&#104;&#97;&#125;&#123;&#49;&#43;&#101;&#94;&#123;&#45;&#40;&#92;&#98;&#101;&#116;&#97;&#32;&#43;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#32;&#116;&#41;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"35\" width=\"126\" style=\"vertical-align: -15px;\"\/><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.2. Properties <strong>of<\/strong> a logistic regression <\/h3>\n\n\n\n<p>The function <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-276a76eafbebc4494deafceec7cc4ddd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> defined above is clearly <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-e209c901c7d1214719c7b871ada1686f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#67;&#94;&#92;&#105;&#110;&#102;&#116;&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"27\" style=\"vertical-align: 0px;\"\/>, hence, we can determine the first few derivates.<\/p>\n\n\n\n<p>From these, nice properties can be found. They are summed up in on this graph:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/schc3a9ma-reg-log-1.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"511\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/04\/schc3a9ma-reg-log-1024x511.png\" alt=\"\" class=\"wp-image-472\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/04\/schc3a9ma-reg-log-1024x511.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/04\/schc3a9ma-reg-log-300x150.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/04\/schc3a9ma-reg-log-768x383.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/04\/schc3a9ma-reg-log-1536x766.png 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Fig. 1.1 &#8211; Representation of a logistic regression, its first and second derivate<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">1.2.1. Maximum of the function<\/h4>\n\n\n\n<p>Finding the maximum of this function presents an obvious interest in our problem: it is the final estimated size of the epidemic. For a logistic regression, we have:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1e6e5d6dbd25f784e4c62b8455c95eb7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#92;&#108;&#105;&#109;&#95;&#123;&#116;&#92;&#116;&#111;&#92;&#105;&#110;&#102;&#116;&#121;&#125;&#32;&#99;&#40;&#116;&#41;&#32;&#61;&#32;&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"26\" width=\"98\" style=\"vertical-align: -12px;\"\/><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.2.2. Inflexion point<\/h4>\n\n\n\n<p>The function clearly presents an inflexion point. Let&#8217;s call it <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-04219d7fcd2f58a0a11e742177314368_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#80;&#95;&#73;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"18\" style=\"vertical-align: -3px;\"\/>. We have:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7d0e3cf56bdb62204350f56967b0c1bc_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#80;&#95;&#73;&#61;&#40;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#44;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#97;&#108;&#112;&#104;&#97;&#125;&#123;&#50;&#125;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"26\" width=\"102\" style=\"vertical-align: -9px;\"\/><\/p>\n\n\n\n<p>By definition, the inflexion on the function <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-276a76eafbebc4494deafceec7cc4ddd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> is also a maximum (or a minimum) of the derivate <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-71f226e71a6857676ee9f23d6c2a69c8_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#102;&#114;&#97;&#99;&#123;&#100;&#99;&#125;&#123;&#100;&#116;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"22\" width=\"14\" style=\"vertical-align: -6px;\"\/>. Let&#8217;s call this maximum <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-8bb5c92ebd6db5f4049f8c50b870a9c9_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#80;&#95;&#123;&#73;&#39;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"22\" style=\"vertical-align: -3px;\"\/>. We also have:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-3c23b4aa323ae6bea0047e5185fdd6ca_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#80;&#95;&#123;&#73;&#39;&#125;&#61;&#40;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#44;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#97;&#108;&#112;&#104;&#97;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#123;&#52;&#125;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"26\" width=\"115\" style=\"vertical-align: -9px;\"\/><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.2.3. Growth speed<\/h4>\n\n\n\n<p>Let&#8217;s focus on the interval <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-02eeea51c72a2c3158479d77dbb31063_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#101;&#102;&#116;&#093;&#45;&#92;&#105;&#110;&#102;&#116;&#121;&#44;&#32;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#093;\" title=\"Rendered by QuickLaTeX.com\" height=\"32\" width=\"79\" style=\"vertical-align: -11px;\"\/>. <\/p>\n\n\n\n<p>By looking at the 2nd derivate <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b16a02e51c62da48769c62be4db6b1bc_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#102;&#114;&#97;&#99;&#123;&#100;&#94;&#50;&#99;&#125;&#123;&#100;&#116;&#94;&#50;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"25\" width=\"20\" style=\"vertical-align: -7px;\"\/>, we can see that the function increases more and more rapidly up until a point we shall name <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1e4b83bfded63db15bb03ce955152ec3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"12\" style=\"vertical-align: -4px;\"\/>. The 2nd derivate then decreases.  Before that point, the growth is essentially exponential. <\/p>\n\n\n\n<p>By solving <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-4a3a54663c350ac2f5372108215af959_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#102;&#114;&#97;&#99;&#123;&#100;&#94;&#51;&#99;&#125;&#123;&#100;&#116;&#94;&#51;&#125;&#32;&#40;&#116;&#95;&#49;&#41;&#61;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"25\" width=\"82\" style=\"vertical-align: -7px;\"\/>, we get :<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-6c22e83945da268cb8b223c50eefae80_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32; &#116;&#95;&#49;&#61;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#43;&#92;&#108;&#110;&#40;&#50;&#43;&#92;&#115;&#113;&#114;&#116;&#123;&#51;&#125;&#41;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"44\" width=\"169\" style=\"vertical-align: -16px;\"\/><\/p>\n\n\n\n<p>Similarly, on the interval <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b906c11833f58a10fe0442b32cbea7fb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#101;&#102;&#116;&#091;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#44;&#32;&#92;&#105;&#110;&#102;&#116;&#121;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#091;\" title=\"Rendered by QuickLaTeX.com\" height=\"32\" width=\"65\" style=\"vertical-align: -11px;\"\/>, the growth decreases slower and slower, until <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1c02724c766a68744c9c856bb11dd90d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"13\" style=\"vertical-align: -3px;\"\/>, when it starts decreasing faster. The solution to equation <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b9b768921856acb5342d7bd2f8173dd2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#102;&#114;&#97;&#99;&#123;&#100;&#94;&#51;&#99;&#125;&#123;&#100;&#116;&#94;&#51;&#125;&#32;&#40;&#116;&#95;&#50;&#41;&#61;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"25\" width=\"82\" style=\"vertical-align: -7px;\"\/> on this interval gives us:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-ce93aba5d478cb9af0606b6497009bc5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#116;&#95;&#50;&#61;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#45;&#92;&#108;&#110;&#40;&#50;&#43;&#92;&#115;&#113;&#114;&#116;&#123;&#51;&#125;&#41;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"44\" width=\"169\" style=\"vertical-align: -16px;\"\/><\/p>\n\n\n\n<p>The difference between these 2 points <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1c02724c766a68744c9c856bb11dd90d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"13\" style=\"vertical-align: -3px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1e4b83bfded63db15bb03ce955152ec3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"12\" style=\"vertical-align: -4px;\"\/> gives us a first characteristic time <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-2d0f4e922bf6aa03f0b4a3128b5a72d5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#116;&#97;&#117;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/>. It expresses the time it takes to go from an exponential increase to an exponential decrease:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-baa2b2533e6ed00e60f77a1a68b4c240_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#92;&#98;&#111;&#120;&#101;&#100;&#123;&#92;&#116;&#97;&#117;&#61;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#45;&#50;&#92;&#108;&#110;&#40;&#50;&#43;&#92;&#115;&#113;&#114;&#116;&#123;&#51;&#125;&#41;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"55\" width=\"171\" style=\"vertical-align: -21px;\"\/><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1.2.4. Total duration of the epidemic<\/h4>\n\n\n\n<p>It can be interesting to quantify the time <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5ba5f90a52b90a8e855a46f6fc30f881_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"14\" style=\"vertical-align: -3px;\"\/> at which the function has reached the proportion <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7e5fbfa0bbbd9f3051cd156a0f1b5e31_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/> of its final value i.e. at which it reaches the value <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-a726051f39e18750c5c35d111a05f5af_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#32;&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"21\" style=\"vertical-align: 0px;\"\/>. <\/p>\n\n\n\n<p>By solving a simple equation, <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-d17c0db1ea85278f7bafc067257a7ec9_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#40;&#116;&#95;&#120;&#41;&#61;&#120;&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"81\" style=\"vertical-align: -4px;\"\/>, we find that:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b22367d93ca758fb9651bd296e079692_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#116;&#95;&#120;&#61;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#32;&#92;&#108;&#110;&#32;&#92;&#108;&#101;&#102;&#116;&#40;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#120;&#125;&#123;&#49;&#45;&#120;&#125;&#32;&#92;&#114;&#105;&#103;&#104;&#116;&#41;&#32;&#45;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#98;&#101;&#116;&#97;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"43\" width=\"192\" style=\"vertical-align: -17px;\"\/><\/p>\n\n\n\n<p>Now we can imagine a new characteristic time that would be defined as the required time to go from the proportion <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-cea46e35d556a45492ad4f91b9f7d255_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#49;&#45;&#120;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"52\" style=\"vertical-align: -4px;\"\/> to the proportion <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7e5fbfa0bbbd9f3051cd156a0f1b5e31_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/>.  Let\u2019s call it <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-0d1d85de94f838b9bd6d73f7177b5c06_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#68;&#101;&#108;&#116;&#97;&#32;&#116;&#95;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"29\" style=\"vertical-align: -3px;\"\/>. <\/p>\n\n\n\n<p>For example, <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-752f0ca95eb1c9b42b1cbaa5b2fd0d97_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#68;&#101;&#108;&#116;&#97;&#32;&#116;&#95;&#123;&#57;&#57;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"35\" style=\"vertical-align: -3px;\"\/> would be the time it took to go from 1% to 99% of the final value <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/>. <\/p>\n\n\n\n<p>It can be expressed as a function of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7b9abe136d2f0d53300727f373cfed43_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"10\" style=\"vertical-align: -4px;\"\/> or <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-2d0f4e922bf6aa03f0b4a3128b5a72d5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#116;&#97;&#117;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/>:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-230a4fe5d2e65814edf4627b0c757c4d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32; &#92;&#98;&#111;&#120;&#101;&#100;&#123;&#116;&#95;&#120;&#61;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#92;&#103;&#97;&#109;&#109;&#97;&#125;&#32;&#92;&#108;&#110;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#120;&#94;&#50;&#125;&#123;&#40;&#49;&#45;&#120;&#41;&#94;&#50;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"55\" width=\"151\" style=\"vertical-align: -22px;\"\/><\/p>\n\n\n\n<p>These values will be used to characterise the epidemic afterwards.<\/p>\n\n\n\n<div class=\"wp-block-cover has-background-dim alignwide\" style=\"background-color:#354a6b;min-height:69px;aspect-ratio:unset;\"><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<h2 class=\"wp-block-heading\">2. Fitting of the model<\/h2>\n<\/div><\/div>\n\n\n\n<p>Now, let&#8217;s see how we can fit that logistic function to our data.<\/p>\n\n\n\n<p><span style=\"text-decoration:underline;\">For the rest of this paragraph<\/span>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Let our data set, the number of cases, be <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-01ef49f19003a91f7ab5c8dafa063e9d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#99;&#95;&#105;&#41;&#95;&#123;&#49;&#92;&#108;&#101;&#113;&#32;&#105;&#92;&#108;&#101;&#113;&#32;&#110;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"68\" style=\"vertical-align: -5px;\"\/>. Each <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1f20a6892ce371ba90592748cd2c20ff_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#95;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"13\" style=\"vertical-align: -3px;\"\/> is a function of the time <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-bf289b768173104db12fe7044c723db4_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"11\" style=\"vertical-align: -3px;\"\/> where <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-f8e31acd9554e770f6b3f48490fdbe09_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#105;&#32;&#92;&#105;&#110;&#32;&#40;&#116;&#95;&#49;&#44;&#32;&#46;&#46;&#46;&#44;&#32;&#116;&#95;&#110;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"107\" style=\"vertical-align: -4px;\"\/>.<\/li><li><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-23f1a801961caea8c6710ef9f04d1734_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#104;&#97;&#116;&#123;&#99;&#95;&#105;&#125;&#41;&#95;&#123;&#49;&#92;&#108;&#101;&#113;&#32;&#105;&#92;&#108;&#101;&#113;&#32;&#110;&#125;&#61;&#40;&#92;&#104;&#97;&#116;&#123;&#99;&#125;&#40;&#116;&#95;&#105;&#41;&#41;&#95;&#123;&#49;&#92;&#108;&#101;&#113;&#32;&#105;&#92;&#108;&#101;&#113;&#32;&#110;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"181\" style=\"vertical-align: -5px;\"\/> is the predicted number of cases at time <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-bf289b768173104db12fe7044c723db4_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"11\" style=\"vertical-align: -3px;\"\/> (where <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-f8e31acd9554e770f6b3f48490fdbe09_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#105;&#32;&#92;&#105;&#110;&#32;&#40;&#116;&#95;&#49;&#44;&#32;&#46;&#46;&#46;&#44;&#32;&#116;&#95;&#110;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"107\" style=\"vertical-align: -4px;\"\/>).<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2.1. Cost <strong>function<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">2.1.1 What cost function to use?<\/h4>\n\n\n\n<p>To fit the model to the data, we need a cost function i.e. a function that expresses how far the model is from the data. This function inputs are the parameters <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-a0506f43a54d604053478e30493930bc_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/> and the output is a number representing the error.  By minimising this cost function, we get the parameters <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-a0506f43a54d604053478e30493930bc_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/> that fit best the data. <\/p>\n\n\n\n<p>To find the minimum of this function, a gradient decent algorithm is used. This type of algorithm works by following the steepest decent of gradient of the function i.e. by finding which direction will have the lowest derivate.<\/p>\n\n\n\n<p>A good cost function is convex i.e. if we find a minimum, we can be sure that this local minimum is also global one. For example, in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-cfb86603222f5e8ad29ee7b1c136e3f1_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#109;&#97;&#116;&#104;&#98;&#98;&#123;&#82;&#125;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"20\" style=\"vertical-align: 0px;\"\/>, the function <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-9076bad5146b8fba9b7f03d976fa6fcd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#92;&#109;&#97;&#112;&#115;&#116;&#111;&#32;&#120;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"55\" style=\"vertical-align: -1px;\"\/> is convex. There is only one local minimum (for <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b9c24063dbd9d6c3e4a008238fed967c_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#61;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"43\" style=\"vertical-align: 0px;\"\/>) and it also is a global minium. <\/p>\n\n\n\n<p><em>Let&#8217;s give a real-life example to explain this notion: Imagine being at the top of the mountain, you need to find the bottom of the valley because of the poor weather condition. Now because of the fog, you can&#8217;t see any further than your shoes. To find the valley, you&#8217;ll likely follow the path that seems to be the steepest. If the mountain is a simple slope, no problem, you will find your way. Now if there is a lake in the middle, you may end up at the bottom of the lake thinking you are at the bottom. This is exactly the same here, we don&#8217;t want our mountain to have a lake in the middle. <\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/grad-descent.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/grad-descent.png?w=1024\" alt=\"\" class=\"wp-image-600\"\/><\/a><figcaption>.Fig. 2.1 &#8211; Representation of the Gradient Descent Algorithm<\/figcaption><\/figure>\n\n\n\n<p>When fitting a linear model (i.e. if <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-616368e0a5d6e1479f8b29b550f6da40_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#104;&#97;&#116;&#123;&#99;&#125;&#40;&#116;&#41;&#61;&#97;&#116;&#43;&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"97\" style=\"vertical-align: -4px;\"\/>) the Root Mean Square Error cost function is used. It can be expressed as:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-082fb08cec67dd49d18e8a76bc7baf4e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#82;&#77;&#83;&#69;&#40;&#97;&#44;&#32;&#98;&#41;&#61;&#32;&#92;&#115;&#113;&#114;&#116;&#123;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#110;&#125;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#105;&#61;&#49;&#125;&#94;&#123;&#110;&#125;&#32;&#40;&#99;&#95;&#105;&#45;&#40;&#97;&#116;&#95;&#105;&#43;&#98;&#41;&#41;&#94;&#50; &#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"64\" width=\"304\" style=\"vertical-align: -27px;\"\/><\/p>\n\n\n\n<p>Here, no matter the initial value chosen, the gradient descent will find a local minimum that is also a global minium.<\/p>\n\n\n\n<p>However, since the logistic regression function is not convex, this cost function can&#8217;t be convex.<\/p>\n\n\n\n<p>But, we can work around that problem, and still use the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-eb4da7e5ff95fbb7f1e576b1e410b32e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#82;&#77;&#83;&#69;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"59\" style=\"vertical-align: 0px;\"\/> function by choosing the initial values <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-ca1b7672af5df20f03e8dab625425453_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#95;&#48;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#95;&#48;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"81\" style=\"vertical-align: -4px;\"\/> with much consideration.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong>: to find the best model that will fit the data, we will find the global minimum of the following function:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-e2ba039a2e959eaa3a871e0532209ae2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#82;&#77;&#83;&#69;&#32;&#58;&#32; &#92;&#98;&#101;&#103;&#105;&#110;&#123;&#99;&#97;&#115;&#101;&#115;&#125;&#32; &#92;&#109;&#97;&#116;&#104;&#98;&#98;&#123;&#82;&#125;&#94;&#51;&#32;&#92;&#116;&#111;&#32;&#92;&#109;&#97;&#116;&#104;&#98;&#98;&#123;&#82;&#125;&#32;&#92;&#92;&#32; &#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#41;&#32;&#92;&#109;&#97;&#112;&#115;&#116;&#111;&#32;&#92;&#115;&#113;&#114;&#116;&#123;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#110;&#125;&#32;&#92;&#115;&#117;&#109;&#92;&#108;&#105;&#109;&#105;&#116;&#115;&#95;&#123;&#105;&#61;&#49;&#125;&#94;&#123;&#110;&#125;&#32;&#40;&#99;&#95;&#105;&#45;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#97;&#108;&#112;&#104;&#97;&#125;&#123;&#49;&#43;&#101;&#94;&#123;&#92;&#98;&#101;&#116;&#97;&#32;&#43;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#32;&#116;&#95;&#105;&#125;&#125;&#32;&#41;&#94;&#50;&#125; &#32;&#92;&#101;&#110;&#100;&#123;&#99;&#97;&#115;&#101;&#115;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"78\" width=\"353\" style=\"vertical-align: -36px;\"\/><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.1.2. Finding the right initial values <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-c2faf34a137ff3644e931fca539e5041_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#32;&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#95;&#48;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#95;&#48;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"81\" style=\"vertical-align: -4px;\"\/><\/h4>\n\n\n\n<p>For the next two paragraphs, we will consider the French cases from Jan, 20 to Apr, 27. The data are smoothed by a 5 days rolling average (day-2 to day+2). The optimal function was found to be:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/predictions_france_25-04-2020.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/preview_france_25-04-2020.png?w=1024\" alt=\"\" class=\"wp-image-510\"\/><\/a><figcaption>Fig. 2.2 &#8211; Optimal prediction for French data set ranging from an, 20 to Apr, 27. <br><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-a6ba5ede33bd777542a1543e9bf39ee4_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#41;&#32;&#61;&#32;&#40;&#49;&#50;&#54;&#32;&#54;&#55;&#54;&#44;&#32;&#45;&#49;&#48;&#46;&#49;&#52;&#57;&#44;&#32;&#48;&#46;&#49;&#51;&#57;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"271\" style=\"vertical-align: -4px;\"\/> <\/figcaption><\/figure>\n\n\n\n<p>Let&#8217;s justify why this is the best fit.<\/p>\n\n\n\n<p>First, it is a matter of choosing the right initial values <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-ca1b7672af5df20f03e8dab625425453_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#95;&#48;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#95;&#48;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"81\" style=\"vertical-align: -4px;\"\/>.<\/p>\n\n\n\n<p>It was observed that if the initial value <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5dfc66bc451079c37ad6a9e6b1519300_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"18\" style=\"vertical-align: -3px;\"\/> is too low,  the cost function will be minimized for a set of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-f9d3a70ae0d84f35670e4b7d013844fd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"60\" style=\"vertical-align: -4px;\"\/> that clearly doesn&#8217;t fit the data as it can be seen bellow. Let&#8217;s investigate why.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/predictions_france_25-04-2020-1.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/preview_france_25-04-2020-1.png?w=1024\" alt=\"\" class=\"wp-image-513\"\/><\/a><figcaption>Fig. 2.3 &#8211; Example if <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5dfc66bc451079c37ad6a9e6b1519300_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"18\" style=\"vertical-align: -3px;\"\/> is too low <br><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-d862789b989b0e1cbdf888257e3513c6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#41;&#32;&#61;&#32;&#40;&#55;&#52;&#52;&#53;&#50;&#44;&#32;&#45;&#52;&#44;&#32;&#49;&#46;&#49;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"203\" style=\"vertical-align: -4px;\"\/><\/figcaption><\/figure>\n\n\n\n<p>It was also observed that when the predictions were off because of a too low <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5dfc66bc451079c37ad6a9e6b1519300_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"18\" style=\"vertical-align: -3px;\"\/>, the final value of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7b9abe136d2f0d53300727f373cfed43_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"10\" style=\"vertical-align: -4px;\"\/> was around <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-9884813db2ebb41261640253b64bee49_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;&#61;&#49;&#46;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"56\" style=\"vertical-align: -4px;\"\/>, instead of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-8026c4b176e9bd8ae28bf4035a1dce53_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;&#61;&#48;&#46;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"56\" style=\"vertical-align: -4px;\"\/> when the model fits well.<\/p>\n\n\n\n<p>Let&#8217;s try to understand why by representing the RMSE function. As this is a 3 variables function and we can&#8217;t see 4D graphs (yet&#8230;), let&#8217;s set the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7b9abe136d2f0d53300727f373cfed43_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"10\" style=\"vertical-align: -4px;\"\/> value at 0.15 and have <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-09bf41d4a2ab6e3ed9148106c7998662_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"42\" style=\"vertical-align: -4px;\"\/> vary on a large range. We get the following graph:<\/p>\n\n\n\n<div class=\"wp-block-columns alignfull is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_1.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_1-1024x519.png\" alt=\"\" class=\"wp-image-786\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_1-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_1-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_1-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_1.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Fig 2.4.a &#8211; RMSE function for the same data set at <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-8026c4b176e9bd8ae28bf4035a1dce53_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;&#61;&#48;&#46;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"56\" style=\"vertical-align: -4px;\"\/><br>View 1\/2<\/figcaption><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_2.png\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_2-1024x519.png\" alt=\"\" class=\"wp-image-787\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_2-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_2-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_2-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_c0.15_2.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>Fig 2.4.b &#8211; RMSE function for the same data set at <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-8026c4b176e9bd8ae28bf4035a1dce53_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;&#61;&#48;&#46;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"56\" style=\"vertical-align: -4px;\"\/><br>View 2\/2<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n<\/div>\n<\/div>\n\n\n\n<p>We clearly see that for <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-d31f2078e757b870230ff9c688161baa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;&#61;&#48;&#46;&#49;&#53;\" title=\"Rendered by QuickLaTeX.com\" height=\"17\" width=\"65\" style=\"vertical-align: -4px;\"\/> the RMSE function have a local minimum at the desired values of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f8751eb83b8725d6b91ee93934e16b0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#41;&#92;&#97;&#112;&#112;&#114;&#111;&#120;&#40;&#49;&#51;&#48;&#48;&#48;&#48;&#44;&#45;&#49;&#48;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"173\" style=\"vertical-align: -4px;\"\/> that produces a good fit.<\/p>\n\n\n\n<p>Now let&#8217;s see what our RMSE function looks like at <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-1fab2fa3824358367e027d7eb6c7bc4f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#116;&#97;&#32;&#61;&#45;&#52;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"58\" style=\"vertical-align: -4px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-2fe4d6c410b10dd8c40e5e17646e4f27_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#116;&#97;&#32;&#61;&#45;&#56;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"58\" style=\"vertical-align: -4px;\"\/>.<\/p>\n\n\n\n<div class=\"wp-block-columns alignfull is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-4_1-1024x519.png\" alt=\"\" class=\"wp-image-789\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-4_1-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-4_1-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-4_1-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-4_1.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Fig 2.5.a &#8211; Representation of the RMSE at <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-fefa1e6379588830cc3be79d5b22b915_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#116;&#97;&#32;&#61;&#32;&#45;&#52;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"58\" style=\"vertical-align: -4px;\"\/><\/figcaption><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-8_1-1024x519.png\" alt=\"\" class=\"wp-image-790\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-8_1-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-8_1-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-8_1-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/rmse_b-8_1.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Fig 2.5.b &#8211; Representation of the RMSE at <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-c7ff659138707c678267c9d646d7d869_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#116;&#97;&#32;&#61;&#32;&#45;&#56;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"58\" style=\"vertical-align: -4px;\"\/><\/figcaption><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>It is clear that around these values of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-0f39b655b53423e80558c68b8c2ae1c3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#116;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"11\" style=\"vertical-align: -4px;\"\/>, <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5dfc66bc451079c37ad6a9e6b1519300_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"18\" style=\"vertical-align: -3px;\"\/> is too low ; the gradient descent algorithm will get stuck in a set of local minima, we could call it a &#8220;valley&#8221;. <\/p>\n\n\n\n<p>Also, the higher the beta value, the worse it is. It can be seen that if the beta value is low enough, another local minimum is formed for <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-ce140d7941fc3553bd8471283ed19e8f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#103;&#97;&#109;&#109;&#97;&#92;&#97;&#112;&#112;&#114;&#111;&#120;&#48;&#46;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"56\" style=\"vertical-align: -4px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-43bf657ba7cd0c36e0ef850286299bca_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;&#92;&#97;&#112;&#112;&#114;&#111;&#120;&#49;&#53;&#48;&#48;&#48;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"14\" width=\"89\" style=\"vertical-align: -1px;\"\/>. This is the solution we are looking for.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong>: to avoid &#8216;falling&#8217; into local minimum, the initial values should be set as:<\/p>\n\n\n\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-ca926c2eeb1db378998d1638c4b33f91_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#40;&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#95;&#48;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#95;&#48;&#41;&#32;&#61;&#32;&#40;&#49;&#46;&#49;&#32;&#99;&#95;&#110;&#44;&#32;&#45;&#49;&#53;&#44;&#32;&#48;&#46;&#48;&#48;&#49;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"246\" style=\"vertical-align: -4px;\"\/><\/p>\n\n\n\n<p><em>The code is available <a href=\"https:\/\/github.com\/CleHou\/COVID-19-Data-Analysis-Project\/blob\/master\/03-Prediction\/32%20-%20Visualisation%20of%20RMSE.py\">here<\/a>.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.2. <strong>Choosing<\/strong> the best fitting<\/h3>\n\n\n\n<p>To find the best match, it is possible to only select a sub set of data <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-c60074b633f0c7ca4d60b0994caa2893_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#99;&#95;&#105;&#41;&#95;&#123;&#106;&#92;&#108;&#101;&#113;&#32;&#105;&#92;&#108;&#101;&#113;&#32;&#110;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"20\" width=\"67\" style=\"vertical-align: -6px;\"\/> (with <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7b221033dbe344a555de88592a51f1ba_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#48;&#92;&#108;&#101;&#113;&#32;&#106;&#32;&#92;&#108;&#101;&#113;&#32;&#110;&#45;&#51;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"115\" style=\"vertical-align: -4px;\"\/>) of the available data i.e. starting at day <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-792e25787bb4558ea690e12d7548ab96_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#106;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"12\" style=\"vertical-align: -6px;\"\/> instead of day <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-c1a3f4a217f20d31e6f72a2f42a2e7dd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"13\" style=\"vertical-align: -3px;\"\/>. Indeed, at the beginning, the growth was slow and the first <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b09880662630fc49b25d42badb906d51_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#106;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"9\" style=\"vertical-align: -4px;\"\/> data may not make sense. Also, the parameters of the epidemic growth changed with the confinement. Let&#8217;s plot, still for France, the value of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> and of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/> as a function of the day at which the date set started <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b09880662630fc49b25d42badb906d51_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#106;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"9\" style=\"vertical-align: -4px;\"\/>.<\/p>\n\n\n\n<p>It can be seen that the less values are taken (i.e. the higher the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-b09880662630fc49b25d42badb906d51_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#106;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"9\" style=\"vertical-align: -4px;\"\/>), the highest the prediction for <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> is and the lowest the correlation coefficient <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/> is.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/parameters_france_25-04-2020.pdf\"><img decoding=\"async\" src=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/prevparameters_france_25-04-2020.png?w=1024\" alt=\"\" class=\"wp-image-526\"\/><\/a><figcaption>Fig 2.6 &#8211; Evolution of the maximum number of cases predicted and correlation coefficient as a function of the first date of the data set<\/figcaption><\/figure>\n\n\n\n<p>Now which prediction should be chosen: the one that fits the data the best (i.e. we chose the model that has the maximum <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/>, here the sub data set starts on day 30) or the one that is the more pessimistic (i.e. we chose the model that has the maximum <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/>, here the sub data set starts on day 60)?<\/p>\n\n\n\n<p>The model that fits the data the best will be called the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-65ffb5ab1a9dc5403c346d84b753a546_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#109;&#97;&#120;&#32;&#40;&#114;&#94;&#50;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"62\" style=\"vertical-align: -4px;\"\/> model while the model that is the more pessimistic will be called the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-f0bf5982e44fc34789c9b2da2199f5f6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#109;&#97;&#120;&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"57\" style=\"vertical-align: -4px;\"\/>.<\/p>\n\n\n\n<p>To make the right choice, it was decided, to see how these predictions evolved as time passed. Let&#8217;s see them as if the were made on a certain date <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7b3442ac7df8cdfa18940a8efa4e0847_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#116;&#95;&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"14\" style=\"vertical-align: -3px;\"\/>. This will be the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-7e5fbfa0bbbd9f3051cd156a0f1b5e31_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/> axis. i.e. we will be plotting as if the algorithm was launched on Apr 06, Apr 07, &#8230;, Apr 25.<\/p>\n\n\n\n<p>On the first plot, there will be the prediction for the final number of cases if the chosen model were the most pessimistic (i.e. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-f0bf5982e44fc34789c9b2da2199f5f6_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#109;&#97;&#120;&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"57\" style=\"vertical-align: -4px;\"\/> and, on the same plot, what the prediction for the final number of cases would have been if the chosen model were the &#8220;rightest&#8221; one (i.e. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-d45eda63243632befb0ccd11aed2c4cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#109;&#97;&#120;&#40;&#114;&#95;&#50;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"62\" style=\"vertical-align: -4px;\"\/>. <\/p>\n\n\n\n<p>On the right the graphs represent the value of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/> for the two types of selection.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/pred_evol_france_25-04-2020.pdf\"><img decoding=\"async\" src=\"https:\/\/houzardc.files.wordpress.com\/2020\/04\/prew_pred_evol_france_25-04-2020.png?w=1024\" alt=\"\" class=\"wp-image-529\"\/><\/a><figcaption>Fig. 2.7. &#8211; (<em>left<\/em>) Evolution of the maximum number of cases predicted if the chosen model is the one with the highest <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> (red) or if the chosen model is the one with the highest <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/>, (blue)  as a function of when the prediction was made.<br>Fig 2.7 &#8211; (right) Evolution of the correlation factor if the chosen model is the one with the highest <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> (red) or if the chosen model is the one with the highest <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/> (blue), as a function of when the prediction was made.<br><\/figcaption><\/figure>\n\n\n\n<p>We can see that, as days go by, the predictions are getting more and more pessimistic. Hence, selecting the curve with the best correlation coefficient wouldn&#8217;t be wise. This phenomenon can be explained by looking at the derivate on the graph at the top of \u00a72.2 (the selected model was the one with the highest <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> value). We can see that the number of new cases daily decreases much slower than the model would predict. It even was stable for about 10 days. This phenomenon will tend to increase the length of the epidemic and so the final <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> value.<\/p>\n\n\n\n<p>The increase of the number of cases should be as fast as the decrease, but here we see that, on the Figure 2.2, the decrease is slower.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2.3. Summary<\/h4>\n\n\n\n<p>This second paragraph can be summed up in 3 points:<\/p>\n\n\n\n<ol><li>The logistic regression model will be fitted using the RMSE cost function<\/li>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-77e3032c074da506bb67b15e10a4ab2b_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#82;&#77;&#83;&#69;&#40;&#92;&#97;&#108;&#112;&#104;&#97;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#41;&#61;&#32;&#92;&#115;&#113;&#114;&#116;&#123;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#110;&#125;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#105;&#61;&#49;&#125;&#94;&#123;&#110;&#125;&#32;&#40;&#99;&#95;&#105;&#45;&#92;&#104;&#97;&#116;&#123;&#99;&#95;&#105;&#125;&#41;&#94;&#50; &#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"64\" width=\"276\" style=\"vertical-align: -27px;\"\/><\/p>\n<li>The initial values for the search of the optimal solutions will be <\/li>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-05134098ac5958225c57120440a2658e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101; &#40;&#92;&#97;&#108;&#112;&#104;&#97;&#95;&#48;&#44;&#32;&#92;&#98;&#101;&#116;&#97;&#95;&#48;&#44;&#32;&#92;&#103;&#97;&#109;&#109;&#97;&#95;&#48;&#41;&#32;&#61;&#32;&#40;&#49;&#46;&#49;&#32;&#99;&#95;&#123;&#116;&#95;&#110;&#125;&#44;&#32;&#45;&#49;&#53;&#44;&#32;&#48;&#46;&#48;&#48;&#49;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"251\" style=\"vertical-align: -4px;\"\/><\/p>\n<li>The algorithm searches the model made with the best sub-set of data <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-c60074b633f0c7ca4d60b0994caa2893_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#99;&#95;&#105;&#41;&#95;&#123;&#106;&#92;&#108;&#101;&#113;&#32;&#105;&#92;&#108;&#101;&#113;&#32;&#110;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"20\" width=\"67\" style=\"vertical-align: -6px;\"\/> (with <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-e1383852fdbfd98e7b5bf5bb8f4e6819_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#48;&#92;&#108;&#101;&#113;&#32;&#106;&#92;&#108;&#101;&#113;&#32;&#110;&#45;&#51;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"115\" style=\"vertical-align: -4px;\"\/>). It selects this best subset by finding the one for which the prediction for <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> is maximum.\n<\/li><\/ol>\n\n\n\n<div class=\"wp-block-cover has-background-dim alignwide\" style=\"background-color:#354a6b;min-height:69px;aspect-ratio:unset;\"><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<h2 class=\"wp-block-heading\">3. Results<\/h2>\n<\/div><\/div>\n\n\n\n<p><em>The code is available <a href=\"https:\/\/github.com\/CleHou\/COVID-19-Data-Analysis-Project\/blob\/master\/03-Prediction\/31%20-%20Mod\u00e9lisation%20v2.0.py\">here<\/a>.<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3.1. Predictions<\/h4>\n\n\n\n<p>Now that we&#8217;ve built a model, let&#8217;s apply it to 4 countries: France,  the US, Italy and Germany.<\/p>\n\n\n\n<div class=\"wp-block-columns alignfull is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/predictions_france_25-04-2020.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-1024x519.png\" alt=\"\" class=\"wp-image-800\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-1536x779.png 1536w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-2048x1038.png 2048w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_france_25-04-2020-1568x795.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/predictions_italy_25-04-2020.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-1024x519.png\" alt=\"\" class=\"wp-image-802\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-1536x779.png 1536w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-2048x1038.png 2048w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_italy_25-04-2020-1568x795.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/predictions_us_25-04-2020.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-1024x519.png\" alt=\"\" class=\"wp-image-803\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-1536x779.png 1536w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-2048x1038.png 2048w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_us_25-04-2020-1568x795.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/predictions_germany_25-04-2020.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-1024x519.png\" alt=\"\" class=\"wp-image-801\" srcset=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-1024x519.png 1024w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-300x152.png 300w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-768x389.png 768w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-1536x779.png 1536w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-2048x1038.png 2048w, https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/preview_germany_25-04-2020-1568x795.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>We can deduce a few things from these graphs:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>France<\/strong>: the model seems to be underestimating the final size of the epidemic. However, when we look at the derivate, the maximum value was obtained on day 66. On day 66 the total number of cases was around 91 000, which should put the final number of cases around 182 000. This shows partly why the model underestimates the final number of cases (126 000).<\/li><li><strong>US<\/strong>: Here the model also underestimates the number of cases, indeed, the derivate seems to show us that we are at half of the epidemic, not 94%, as predicted. The model predicts this because the US have been experiencing a constant number of new cases for the past 15 days. The model should readjust when this phase is over.<\/li><li><strong>Italy<\/strong>: the model seems to be quite fitting. This makes sense because the decrease of the number of cases in Italy has been quite continuous, more than in France for example.<\/li><li><strong>Germany<\/strong>: here the model is clearly underestimating the final size by a lot. That is harder to explain why.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3.2. Comparing the 4 countries<\/h3>\n\n\n\n<p>First let&#8217;s take a look at the values that are defining the models:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/><\/th><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-2d0f4e922bf6aa03f0b4a3128b5a72d5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#116;&#97;&#117;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/> (days)<\/th><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-752f0ca95eb1c9b42b1cbaa5b2fd0d97_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#68;&#101;&#108;&#116;&#97;&#32;&#116;&#95;&#123;&#57;&#57;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"35\" style=\"vertical-align: -3px;\"\/> (days)<\/th><\/tr><\/thead><tbody><tr><td>France<\/td><td>126 676<\/td><td>19.0<\/td><td>132.8<\/td><\/tr><tr><td>US<\/td><td>992 904<\/td><td>18.5<\/td><td>129.3<\/td><\/tr><tr><td>Italy<\/td><td>206 281<\/td><td>26.8<\/td><td>187.3<\/td><\/tr><tr><td>Germany<\/td><td>156 027<\/td><td>18.1<\/td><td>126.0<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>With these results it can be deduced:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The country with the most cases will be the US, even if the number here is largely underestimated.<\/li><li>Italy will be the country with the longest epidemic, it is supposed to last around 6 months, with them reaching 99% of their cases on May, 16.<\/li><li>The US had a very fast increase and so, we predict a very fast decrease. That remains to be seen.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-cover has-background-dim alignwide\" style=\"background-color:#354a6b;min-height:69px;aspect-ratio:unset;\"><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<h2 class=\"wp-block-heading\">4. Conclusion<\/h2>\n<\/div><\/div>\n\n\n\n<p>We have seen that the logistic regression function can be used to model the COVID-19 epidemic in various countries. However, this is a very simple model that is far from perfect but can give a good first approximation of what the future will hold.<\/p>\n\n\n\n<p>This model, but also any models, of course, cannot predict what will happen if the context changes e.g. if restrictions are lifted, the number of cases would probably rise sharply.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-cover has-background-dim alignwide\" style=\"background-color:#354a6b;min-height:69px;aspect-ratio:unset;\"><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<h2 id=\"updated_pred\">5. Updated predictions <\/h2>\n<\/div><\/div>\n\n\n\n<p><em><strong><\/strong><\/em><\/p>\n\n\n\n<p><em>Below the latest prediction. The algorithm was changed on May, 1. It now prefers to improve the fit on the latest data at the cost of losing in precision with the first values. <\/em><\/p>\n\n\n\n<p>First, you&#8217;ll find the latest prediction, then you&#8217;ll find how these predictions evolve as day pass by.<\/p>\n\n\n\n<p><strong>Reminder<\/strong>: these predictions are built from the situation in the past few weeks. It doesn&#8217;t account for the new rules that are applied little by little around the world which could lead to a 2nd wave.<\/p>\n\n\n\n<p><strong>NB<\/strong>: from May, 25 we are experiencing some issues for the German predictions.<\/p>\n\n\n\n<div class=\"wp-block-columns alignfull is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Predictions_France.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Preview_France.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Predictions_Italy.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Preview_Italy.png\" alt=\"\"\/><\/a><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Predictions_US.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Preview_US.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Predictions_Germany.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Preview_Germany.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p><\/p>\n<\/div>\n<\/div>\n\n\n\n<p><strong>Definition of the parameters<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> value<\/strong>: final number of cases<\/li><li><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-2d0f4e922bf6aa03f0b4a3128b5a72d5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#116;&#97;&#117;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/><\/strong>: duration to go from an exponential increase to exponential decrease<\/li><li><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-752f0ca95eb1c9b42b1cbaa5b2fd0d97_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#68;&#101;&#108;&#116;&#97;&#32;&#116;&#95;&#123;&#57;&#57;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"35\" style=\"vertical-align: -3px;\"\/><\/strong>: duration to go from 1% of the final number of cases to 99% of the number of cas<\/li><li><strong>Date_99<\/strong>: Date at which 99% of the cases will be achieved<\/li><li><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-19db2644cdc31d7e9f0115deb1e187cd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#94;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: 0px;\"\/> or correlation coefficient<\/strong>: number that evaluates how well the model fits the data, the closer to 1, the better<\/li><\/ul>\n\n\n\n<p>Values defining the predictions:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-5f44d9bbc8046069be4aa2989bff19aa_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#97;&#108;&#112;&#104;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> (number of cases)<\/strong><\/th><th><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-2d0f4e922bf6aa03f0b4a3128b5a72d5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#116;&#97;&#117;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/> (days)<\/strong><\/th><th><strong><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/ql-cache\/quicklatex.com-752f0ca95eb1c9b42b1cbaa5b2fd0d97_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#68;&#101;&#108;&#116;&#97;&#32;&#116;&#95;&#123;&#57;&#57;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"35\" style=\"vertical-align: -3px;\"\/> (days)<\/strong><\/th><\/tr><\/thead><tbody><tr><td>France<\/td><td>144985<\/td><td>30,53959<\/td><td>213,3501<\/td><\/tr><tr><td>US<\/td><td>2230283<\/td><td>53,53649<\/td><td>374,0068<\/td><\/tr><tr><td>Italy<\/td><td>235415<\/td><td>37,85915<\/td><td>264,4847<\/td><\/tr><tr><td>Germany<\/td><td>178158<\/td><td>30,96605<\/td><td>216,3294<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Evolution of the parameters as a function of when the predictions were made:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Evol_para.pdf\"><img decoding=\"async\" src=\"https:\/\/houzardc.fr\/wp-content\/uploads\/2020\/05\/Preview_Evol_para.png\" alt=\"\"\/><\/a><\/figure>\n\n\n\n<p>We can see that for France, Germany and Italy the number of cases predicted is getting constant, hence the predictions are more and more precise.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article was originally published on Apr, 28. The graphs and values are updated regularly at the end of this article. In this article, it will be tried to predict the final size of the COVID-19 epidemic per country based on a logistic regression. It is divided in 3 parts: Logistic regression: the properties of<a class=\"more-link\" href=\"https:\/\/houzardc.fr\/?page_id=445\">Continue reading <span class=\"screen-reader-text\">&#8220;Prediction of the epidemic final size&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":787,"parent":1207,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_lmt_disableupdate":"no","_lmt_disable":"","footnotes":""},"class_list":["post-445","page","type-page","status-publish","has-post-thumbnail","hentry","entry"],"jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/pages\/445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/houzardc.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=445"}],"version-history":[{"count":46,"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/pages\/445\/revisions"}],"predecessor-version":[{"id":1275,"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/pages\/445\/revisions\/1275"}],"up":[{"embeddable":true,"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/pages\/1207"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/houzardc.fr\/index.php?rest_route=\/wp\/v2\/media\/787"}],"wp:attachment":[{"href":"https:\/\/houzardc.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}