<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>epidemiology on R Views</title>
    <link>https://rviews.rstudio.com/tags/epidemiology/</link>
    <description>Recent content in epidemiology on R Views</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 20 May 2020 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://rviews.rstudio.com/tags/epidemiology/" rel="self" type="application/rss+xml" />
    
    
    
    
    <item>
      <title>An R View into Epidemiology</title>
      <link>https://rviews.rstudio.com/2020/05/20/some-r-resources-for-epidemiology/</link>
      <pubDate>Wed, 20 May 2020 00:00:00 +0000</pubDate>
      
      <guid>https://rviews.rstudio.com/2020/05/20/some-r-resources-for-epidemiology/</guid>
      <description>
        
&lt;script src=&#34;/rmarkdown-libs/htmlwidgets/htmlwidgets.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;/rmarkdown-libs/plotly-binding/plotly.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;/rmarkdown-libs/typedarray/typedarray.min.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;/rmarkdown-libs/jquery/jquery.min.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;/rmarkdown-libs/crosstalk/css/crosstalk.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;/rmarkdown-libs/crosstalk/js/crosstalk.min.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;/rmarkdown-libs/plotly-htmlwidgets-css/plotly-htmlwidgets.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;/rmarkdown-libs/plotly-main/plotly-latest.min.js&#34;&gt;&lt;/script&gt;


&lt;p&gt;If you have been tracking the numbers for the COVID-19 pandemic, you must have looked at dozens of models and tried to make some comparisons. Even under the best of situations it is difficult to compare models, and this is especially true if you don’t have sufficient domain knowledge. Experts tend to leave out assumptions and background material that they know other experts will take for granted. This leaves newcomers pretty much on their own.&lt;/p&gt;
&lt;p&gt;It has been my experience that a good way for an R literate person to begin to acquire knowledge in a new field is to find some appropriate packages, study the vignettes, work through the examples, and read whatever source material they may reference. So, this post shows how one might go about finding those appropriate packages. Also, I thought it would be interesting to see what kind of special resources are available to epidemiologists working in R beyond the basic statistical infrastructure and packages for data manipulation and visualization.&lt;/p&gt;
&lt;p&gt;Because there is no epidemiology task view, a good place to start is to search CRAN directly. (Note that there are task views on &lt;a href=&#34;https://cran.r-project.org/web/views/DifferentialEquations.html&#34;&gt;differential equations&lt;/a&gt;, &lt;a href=&#34;https://cran.r-project.org/web/views/Spatial.html&#34;&gt;spatial statistics&lt;/a&gt;, &lt;a href=&#34;https://cran.r-project.org/web/views/TimeSeries.html&#34;&gt;time series&lt;/a&gt; and other tools used by epidemiologists, so I confined my search to the basics.)&lt;/p&gt;
&lt;p&gt;The two main packages I used to search were: &lt;a href=&#34;https://CRAN.R-project.org/package=pkgsearch&#34;&gt;&lt;code&gt;pkgsearch&lt;/code&gt;&lt;/a&gt; which searches CRAN package data and &lt;a href=&#34;https://CRAN.R-project.org/package=dlstats&#34;&gt;&lt;code&gt;dlstats&lt;/code&gt;&lt;/a&gt; which retrieves package download information from the RStudio mirror. The &lt;code&gt;pkg_search()&lt;/code&gt; function takes a query string as input and returns information about packages that match the query along with some basic information, a score, and the number of downloads in the previous month. Finding a useful string that returns a reasonable list of packages requires developing some hunting skills gained through iterating over plausible strings.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;Epi &amp;lt;- pkg_search(query=&amp;quot;epidemiology epidemic&amp;quot;,size=200)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On the day I did the search the the above query returned a list of 98 packages.&lt;/p&gt;
&lt;p&gt;Then, the parameters&lt;code&gt;score&lt;/code&gt;, a measure of accuracy, and &lt;code&gt;downloads_last_month&lt;/code&gt;, a proxy for quality, can help filter down to a short list of packages to examine.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;as_tibble(Epi) %&amp;gt;% 
  filter(score &amp;gt;= 10, downloads_last_month &amp;gt; 830) %&amp;gt;% 
  select(package,title,downloads_last_month) %&amp;gt;% 
  arrange(-downloads_last_month) -&amp;gt; df

print(df, n = nrow(df))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;# A tibble: 23 x 3
   package      title                                         downloads_last_mo…
   &amp;lt;chr&amp;gt;        &amp;lt;chr&amp;gt;                                                      &amp;lt;int&amp;gt;
 1 epitools     &amp;quot;Epidemiology Tools&amp;quot;                                        8480
 2 Epi          &amp;quot;A Package for Statistical Analysis in Epide…               8212
 3 epiR         &amp;quot;Tools for the Analysis of Epidemiological D…               5888
 4 EpiEstim     &amp;quot;Estimate Time Varying Reproduction Numbers …               5477
 5 epiDisplay   &amp;quot;Epidemiological Data Display Package&amp;quot;                      4707
 6 table1       &amp;quot;Tables of Descriptive Statistics in HTML&amp;quot;                  3640
 7 EpiModel     &amp;quot;Mathematical Modeling of Infectious Disease…               3502
 8 haplo.stats  &amp;quot;Statistical Analysis of Haplotypes with Tra…               2723
 9 SpatialEpi   &amp;quot;Methods and Data for Spatial Epidemiology&amp;quot;                 2502
10 R0           &amp;quot;Estimation of R0 and Real-Time Reproduction…               2468
11 popEpi       &amp;quot;Functions for Epidemiological Analysis usin…               2081
12 epitrix      &amp;quot;Small Helpers and Tricks for Epidemics Anal…               1993
13 surveillance &amp;quot;Temporal and Spatio-Temporal Modeling and M…               1986
14 EpiContactT… &amp;quot;Epidemiological Tool for Contact Tracing&amp;quot;                  1181
15 EpiCurve     &amp;quot;Plot an Epidemic Curve&amp;quot;                                    1173
16 epibasix     &amp;quot;Elementary Epidemiological Functions for Ep…               1126
17 epicontacts  &amp;quot;Handling, Visualisation and Analysis of Epi…               1030
18 pubh         &amp;quot;A Toolbox for Public Health and Epidemiolog…                997
19 powerSurvEpi &amp;quot;Power and Sample Size Calculation for Survi…                963
20 mem          &amp;quot;The Moving Epidemic Method&amp;quot;                                 867
21 epimdr       &amp;quot;Functions and Data for \&amp;quot;Epidemics: Models …                867
22 DSAIDE       &amp;quot;Dynamical Systems Approach to Infectious Di…                861
23 episensr     &amp;quot;Basic Sensitivity Analysis of Epidemiologic…                855&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Most of the packages in the short list turned out to be “professional” packages in the sense that they provide essential functions but are rather light on documentation. These are targeted towards working professionals. So, while most of the packages found are for the experts, my search did turn up a few for self study. The package &lt;code&gt;epimdr&lt;/code&gt;, for example, is associated with Bjornstad’s book &lt;a href=&#34;https://www.springer.com/gp/book/9783319974866&#34;&gt;Epidemics: Models and Data in R&lt;/a&gt; as well as the Coursera course &lt;a href=&#34;https://www.coursera.org/learn/epidemics&#34;&gt;Epidemics - the Dymanics of Infectious Diseases&lt;/a&gt;. And, the &lt;a href=&#34;https://cran.r-project.org/web/packages/epiR/vignettes/epiR_descriptive.html&#34;&gt;vignette&lt;/a&gt; for the &lt;code&gt;epiR&lt;/code&gt; package references the free CDC online course &lt;a href=&#34;https://www.cdc.gov/csels/dsepd/ss1978/lesson1/index.html&#34;&gt;Principles of Epidemiology in Public Health Practice&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Six of the packages on the short list: &lt;code&gt;DSAIDE&lt;/code&gt;, &lt;code&gt;epicontacts&lt;/code&gt;,&lt;code&gt;EpiEstim&lt;/code&gt;, &lt;code&gt;EpiModel&lt;/code&gt;, &lt;code&gt;epitrix&lt;/code&gt;, and&lt;code&gt;surveillance&lt;/code&gt; have all either been developed or authorized by the R Epidemics Consortium (&lt;a href=&#34;https://www.repidemicsconsortium.org/&#34;&gt;RECON&lt;/a&gt;), an international not-profit organization with a mission to “create the next generation of analytics tools for informing the response to disease outbreaks, health emergencies and humanitarian crises, using the R software and other free, open-source resources”. This group not only develops software and builds models, but members go onsite to help fight disease outbreaks. These packages are mostly very well documented and useful to experts and students alike.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://cran.r-project.org/package=DSAIDE&#34;&gt;&lt;code&gt;DSAIDE&lt;/code&gt;&lt;/a&gt; package provides a tutorial on infectious diseases.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;DSAIDE.png&#34; height = &#34;600&#34; width=&#34;400&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://cran.r-project.org/package=epicontacts&#34;&gt;&lt;code&gt;epicontacts&lt;/code&gt;&lt;/a&gt; provides a collection of tools for representing epidemiological contact data.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://cran.r-project.org/package=EpiEstim&#34;&gt;&lt;code&gt;EpiEstim&lt;/code&gt;&lt;/a&gt; is targeted towards estimating time varying reproduction numbers from epidemic curves.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://cran.r-project.org/package=EpiModel&#34;&gt;&lt;code&gt;EpiModel&lt;/code&gt;&lt;/a&gt; package, which is documented with a &lt;a href=&#34;https://www.jstatsoft.org/article/view/v084i08&#34;&gt;JSS paper&lt;/a&gt; and it’s own &lt;a href=&#34;http://www.epimodel.org/tut.html&#34;&gt;tutorial website&lt;/a&gt;, provides a number of advanced epidemiological models including deterministic compartmental models, stochastic individual contact models and network models which go beyond the simple assumption of random contact among all members in a compartment. &lt;code&gt;EpiModel&lt;/code&gt; was featured in Tim Churches &lt;a href=&#34;https://rviews.rstudio.com/2020/03/19/simulating-covid-19-interventions-with-r/&#34;&gt;March Post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://cran.r-project.org/package=epitrix&#34;&gt;&lt;code&gt;epitrix&lt;/code&gt;&lt;/a&gt; package contains a number of utility functions for infectious disease modeling including a function to anonymize data.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;%5B%60epicontacts%60%5D(https://cran.r-project.org/web/packages/surveillance/index.html)%20provides%20a%20collection%20of%20tools%20for%20representing%20epidemiological%20contact%20data.&#34;&gt;&lt;code&gt;surveillance&lt;/code&gt;&lt;/a&gt; package which supports spatio-temporal analysis is well documented with seven vignettes.&lt;/p&gt;
&lt;p&gt;Finally, taking a look at package download history indicates which packages continue to be useful over time, and in this case, provides some idea of the demand for infectious disease modeling. Here is the download history of the top five packages on the short list.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Get download history for top 5
top_5 &amp;lt;- df %&amp;gt;% slice(1:5)
dl_stats &amp;lt;- cran_stats(top_5$package)

p &amp;lt;- ggplot(dl_stats, aes(end,downloads, colour=package)) + 
       geom_line() + xlab(&amp;quot;Month&amp;quot;) +
       ggtitle(&amp;quot;Download History of Top 5 Epidemiology Packages&amp;quot;) 
    
fig &amp;lt;- ggplotly(p)
fig&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-1&#34; style=&#34;width:672px;height:480px;&#34; class=&#34;plotly html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-1&#34;&gt;{&#34;x&#34;:{&#34;data&#34;:[{&#34;x&#34;:[16466,16494,16525,16555,16586,16616,16647,16678,16708,16739,16769,16800,16831,16860,16891,16921,16952,16982,17013,17044,17074,17105,17135,17166,17197,17225,17256,17286,17317,17347,17378,17409,17439,17470,17500,17531,17562,17590,17621,17651,17682,17712,17743,17774,17804,17835,17865,17896,17927,17955,17986,18016,18047,18077,18108,18139,18169,18200,18230,18261,18292,18321,18352,18382,18402],&#34;y&#34;:[1202,1371,1923,1538,1402,1281,1114,1322,1713,4073,2735,2047,2088,2445,2508,2398,1993,1762,1679,1548,2451,4572,4134,3201,3790,4189,7844,8622,6877,4887,4595,4212,5252,9493,7992,4764,5353,5236,7209,6315,6001,4622,4487,4661,6291,8707,8764,6121,7515,7358,10730,9410,10434,7400,8727,7843,9329,12819,11507,8642,10280,10245,10788,8966,4916],&#34;text&#34;:[&#34;end: 2015-01-31&lt;br /&gt;downloads:  1202&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-02-28&lt;br /&gt;downloads:  1371&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-03-31&lt;br /&gt;downloads:  1923&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-04-30&lt;br /&gt;downloads:  1538&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-05-31&lt;br /&gt;downloads:  1402&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-06-30&lt;br /&gt;downloads:  1281&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-07-31&lt;br /&gt;downloads:  1114&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-08-31&lt;br /&gt;downloads:  1322&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-09-30&lt;br /&gt;downloads:  1713&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-10-31&lt;br /&gt;downloads:  4073&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-11-30&lt;br /&gt;downloads:  2735&lt;br /&gt;package: epitools&#34;,&#34;end: 2015-12-31&lt;br /&gt;downloads:  2047&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-01-31&lt;br /&gt;downloads:  2088&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-02-29&lt;br /&gt;downloads:  2445&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-03-31&lt;br /&gt;downloads:  2508&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-04-30&lt;br /&gt;downloads:  2398&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-05-31&lt;br /&gt;downloads:  1993&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-06-30&lt;br /&gt;downloads:  1762&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-07-31&lt;br /&gt;downloads:  1679&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-08-31&lt;br /&gt;downloads:  1548&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-09-30&lt;br /&gt;downloads:  2451&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-10-31&lt;br /&gt;downloads:  4572&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-11-30&lt;br /&gt;downloads:  4134&lt;br /&gt;package: epitools&#34;,&#34;end: 2016-12-31&lt;br /&gt;downloads:  3201&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-01-31&lt;br /&gt;downloads:  3790&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-02-28&lt;br /&gt;downloads:  4189&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-03-31&lt;br /&gt;downloads:  7844&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-04-30&lt;br /&gt;downloads:  8622&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-05-31&lt;br /&gt;downloads:  6877&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-06-30&lt;br /&gt;downloads:  4887&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-07-31&lt;br /&gt;downloads:  4595&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-08-31&lt;br /&gt;downloads:  4212&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-09-30&lt;br /&gt;downloads:  5252&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-10-31&lt;br /&gt;downloads:  9493&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-11-30&lt;br /&gt;downloads:  7992&lt;br /&gt;package: epitools&#34;,&#34;end: 2017-12-31&lt;br /&gt;downloads:  4764&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-01-31&lt;br /&gt;downloads:  5353&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-02-28&lt;br /&gt;downloads:  5236&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-03-31&lt;br /&gt;downloads:  7209&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-04-30&lt;br /&gt;downloads:  6315&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-05-31&lt;br /&gt;downloads:  6001&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-06-30&lt;br /&gt;downloads:  4622&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-07-31&lt;br /&gt;downloads:  4487&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-08-31&lt;br /&gt;downloads:  4661&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-09-30&lt;br /&gt;downloads:  6291&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-10-31&lt;br /&gt;downloads:  8707&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-11-30&lt;br /&gt;downloads:  8764&lt;br /&gt;package: epitools&#34;,&#34;end: 2018-12-31&lt;br /&gt;downloads:  6121&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-01-31&lt;br /&gt;downloads:  7515&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-02-28&lt;br /&gt;downloads:  7358&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-03-31&lt;br /&gt;downloads: 10730&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-04-30&lt;br /&gt;downloads:  9410&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-05-31&lt;br /&gt;downloads: 10434&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-06-30&lt;br /&gt;downloads:  7400&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-07-31&lt;br /&gt;downloads:  8727&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-08-31&lt;br /&gt;downloads:  7843&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-09-30&lt;br /&gt;downloads:  9329&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-10-31&lt;br /&gt;downloads: 12819&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-11-30&lt;br /&gt;downloads: 11507&lt;br /&gt;package: epitools&#34;,&#34;end: 2019-12-31&lt;br /&gt;downloads:  8642&lt;br /&gt;package: epitools&#34;,&#34;end: 2020-01-31&lt;br /&gt;downloads: 10280&lt;br /&gt;package: epitools&#34;,&#34;end: 2020-02-29&lt;br /&gt;downloads: 10245&lt;br /&gt;package: epitools&#34;,&#34;end: 2020-03-31&lt;br /&gt;downloads: 10788&lt;br /&gt;package: epitools&#34;,&#34;end: 2020-04-30&lt;br /&gt;downloads:  8966&lt;br /&gt;package: epitools&#34;,&#34;end: 2020-05-20&lt;br /&gt;downloads:  4916&lt;br /&gt;package: epitools&#34;],&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;lines&#34;,&#34;line&#34;:{&#34;width&#34;:1.88976377952756,&#34;color&#34;:&#34;rgba(248,118,109,1)&#34;,&#34;dash&#34;:&#34;solid&#34;},&#34;hoveron&#34;:&#34;points&#34;,&#34;name&#34;:&#34;epitools&#34;,&#34;legendgroup&#34;:&#34;epitools&#34;,&#34;showlegend&#34;:true,&#34;xaxis&#34;:&#34;x&#34;,&#34;yaxis&#34;:&#34;y&#34;,&#34;hoverinfo&#34;:&#34;text&#34;,&#34;frame&#34;:null},{&#34;x&#34;:[16466,16494,16525,16555,16586,16616,16647,16678,16708,16739,16769,16800,16831,16860,16891,16921,16952,16982,17013,17044,17074,17105,17135,17166,17197,17225,17256,17286,17317,17347,17378,17409,17439,17470,17500,17531,17562,17590,17621,17651,17682,17712,17743,17774,17804,17835,17865,17896,17927,17955,17986,18016,18047,18077,18108,18139,18169,18200,18230,18261,18292,18321,18352,18382,18402],&#34;y&#34;:[1231,1273,1472,2130,1431,1442,1296,1310,1954,2680,1995,1717,2330,2245,2792,2015,2166,1892,1834,1570,2349,4072,4436,3148,3382,4121,6015,13780,9586,5022,6801,10142,4711,5520,5604,4001,5378,5459,9237,8433,12109,5179,4766,11648,6281,7161,7746,5047,5586,8351,7549,5978,8004,6344,6635,7814,7277,8112,8945,6959,7062,6553,7596,7940,5050],&#34;text&#34;:[&#34;end: 2015-01-31&lt;br /&gt;downloads:  1231&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-02-28&lt;br /&gt;downloads:  1273&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-03-31&lt;br /&gt;downloads:  1472&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-04-30&lt;br /&gt;downloads:  2130&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-05-31&lt;br /&gt;downloads:  1431&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-06-30&lt;br /&gt;downloads:  1442&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-07-31&lt;br /&gt;downloads:  1296&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-08-31&lt;br /&gt;downloads:  1310&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-09-30&lt;br /&gt;downloads:  1954&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-10-31&lt;br /&gt;downloads:  2680&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-11-30&lt;br /&gt;downloads:  1995&lt;br /&gt;package: Epi&#34;,&#34;end: 2015-12-31&lt;br /&gt;downloads:  1717&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-01-31&lt;br /&gt;downloads:  2330&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-02-29&lt;br /&gt;downloads:  2245&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-03-31&lt;br /&gt;downloads:  2792&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-04-30&lt;br /&gt;downloads:  2015&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-05-31&lt;br /&gt;downloads:  2166&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-06-30&lt;br /&gt;downloads:  1892&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-07-31&lt;br /&gt;downloads:  1834&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-08-31&lt;br /&gt;downloads:  1570&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-09-30&lt;br /&gt;downloads:  2349&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-10-31&lt;br /&gt;downloads:  4072&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-11-30&lt;br /&gt;downloads:  4436&lt;br /&gt;package: Epi&#34;,&#34;end: 2016-12-31&lt;br /&gt;downloads:  3148&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-01-31&lt;br /&gt;downloads:  3382&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-02-28&lt;br /&gt;downloads:  4121&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-03-31&lt;br /&gt;downloads:  6015&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-04-30&lt;br /&gt;downloads: 13780&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-05-31&lt;br /&gt;downloads:  9586&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-06-30&lt;br /&gt;downloads:  5022&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-07-31&lt;br /&gt;downloads:  6801&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-08-31&lt;br /&gt;downloads: 10142&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-09-30&lt;br /&gt;downloads:  4711&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-10-31&lt;br /&gt;downloads:  5520&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-11-30&lt;br /&gt;downloads:  5604&lt;br /&gt;package: Epi&#34;,&#34;end: 2017-12-31&lt;br /&gt;downloads:  4001&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-01-31&lt;br /&gt;downloads:  5378&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-02-28&lt;br /&gt;downloads:  5459&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-03-31&lt;br /&gt;downloads:  9237&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-04-30&lt;br /&gt;downloads:  8433&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-05-31&lt;br /&gt;downloads: 12109&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-06-30&lt;br /&gt;downloads:  5179&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-07-31&lt;br /&gt;downloads:  4766&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-08-31&lt;br /&gt;downloads: 11648&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-09-30&lt;br /&gt;downloads:  6281&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-10-31&lt;br /&gt;downloads:  7161&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-11-30&lt;br /&gt;downloads:  7746&lt;br /&gt;package: Epi&#34;,&#34;end: 2018-12-31&lt;br /&gt;downloads:  5047&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-01-31&lt;br /&gt;downloads:  5586&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-02-28&lt;br /&gt;downloads:  8351&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-03-31&lt;br /&gt;downloads:  7549&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-04-30&lt;br /&gt;downloads:  5978&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-05-31&lt;br /&gt;downloads:  8004&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-06-30&lt;br /&gt;downloads:  6344&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-07-31&lt;br /&gt;downloads:  6635&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-08-31&lt;br /&gt;downloads:  7814&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-09-30&lt;br /&gt;downloads:  7277&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-10-31&lt;br /&gt;downloads:  8112&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-11-30&lt;br /&gt;downloads:  8945&lt;br /&gt;package: Epi&#34;,&#34;end: 2019-12-31&lt;br /&gt;downloads:  6959&lt;br /&gt;package: Epi&#34;,&#34;end: 2020-01-31&lt;br /&gt;downloads:  7062&lt;br /&gt;package: Epi&#34;,&#34;end: 2020-02-29&lt;br /&gt;downloads:  6553&lt;br /&gt;package: Epi&#34;,&#34;end: 2020-03-31&lt;br /&gt;downloads:  7596&lt;br /&gt;package: Epi&#34;,&#34;end: 2020-04-30&lt;br /&gt;downloads:  7940&lt;br /&gt;package: Epi&#34;,&#34;end: 2020-05-20&lt;br /&gt;downloads:  5050&lt;br /&gt;package: Epi&#34;],&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;lines&#34;,&#34;line&#34;:{&#34;width&#34;:1.88976377952756,&#34;color&#34;:&#34;rgba(163,165,0,1)&#34;,&#34;dash&#34;:&#34;solid&#34;},&#34;hoveron&#34;:&#34;points&#34;,&#34;name&#34;:&#34;Epi&#34;,&#34;legendgroup&#34;:&#34;Epi&#34;,&#34;showlegend&#34;:true,&#34;xaxis&#34;:&#34;x&#34;,&#34;yaxis&#34;:&#34;y&#34;,&#34;hoverinfo&#34;:&#34;text&#34;,&#34;frame&#34;:null},{&#34;x&#34;:[16466,16494,16525,16555,16586,16616,16647,16678,16708,16739,16769,16800,16831,16860,16891,16921,16952,16982,17013,17044,17074,17105,17135,17166,17197,17225,17256,17286,17317,17347,17378,17409,17439,17470,17500,17531,17562,17590,17621,17651,17682,17712,17743,17774,17804,17835,17865,17896,17927,17955,17986,18016,18047,18077,18108,18139,18169,18200,18230,18261,18292,18321,18352,18382,18402],&#34;y&#34;:[2048,1583,2009,1836,1686,1792,1378,1760,2099,2846,2543,2274,2227,2776,3495,2515,3375,2475,2555,2507,2455,2551,2985,1767,2398,2367,3578,12075,3253,3156,5384,2272,2719,10119,4242,7939,2968,2987,3313,2980,7315,2737,2607,8064,3900,4545,5094,3423,3754,4162,4634,3612,8434,4011,3754,3829,5009,5476,6207,4976,5751,6123,7171,6051,3651],&#34;text&#34;:[&#34;end: 2015-01-31&lt;br /&gt;downloads:  2048&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-02-28&lt;br /&gt;downloads:  1583&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-03-31&lt;br /&gt;downloads:  2009&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-04-30&lt;br /&gt;downloads:  1836&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-05-31&lt;br /&gt;downloads:  1686&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-06-30&lt;br /&gt;downloads:  1792&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-07-31&lt;br /&gt;downloads:  1378&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-08-31&lt;br /&gt;downloads:  1760&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-09-30&lt;br /&gt;downloads:  2099&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-10-31&lt;br /&gt;downloads:  2846&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-11-30&lt;br /&gt;downloads:  2543&lt;br /&gt;package: epiR&#34;,&#34;end: 2015-12-31&lt;br /&gt;downloads:  2274&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-01-31&lt;br /&gt;downloads:  2227&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-02-29&lt;br /&gt;downloads:  2776&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-03-31&lt;br /&gt;downloads:  3495&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-04-30&lt;br /&gt;downloads:  2515&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-05-31&lt;br /&gt;downloads:  3375&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-06-30&lt;br /&gt;downloads:  2475&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-07-31&lt;br /&gt;downloads:  2555&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-08-31&lt;br /&gt;downloads:  2507&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-09-30&lt;br /&gt;downloads:  2455&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-10-31&lt;br /&gt;downloads:  2551&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-11-30&lt;br /&gt;downloads:  2985&lt;br /&gt;package: epiR&#34;,&#34;end: 2016-12-31&lt;br /&gt;downloads:  1767&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-01-31&lt;br /&gt;downloads:  2398&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-02-28&lt;br /&gt;downloads:  2367&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-03-31&lt;br /&gt;downloads:  3578&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-04-30&lt;br /&gt;downloads: 12075&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-05-31&lt;br /&gt;downloads:  3253&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-06-30&lt;br /&gt;downloads:  3156&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-07-31&lt;br /&gt;downloads:  5384&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-08-31&lt;br /&gt;downloads:  2272&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-09-30&lt;br /&gt;downloads:  2719&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-10-31&lt;br /&gt;downloads: 10119&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-11-30&lt;br /&gt;downloads:  4242&lt;br /&gt;package: epiR&#34;,&#34;end: 2017-12-31&lt;br /&gt;downloads:  7939&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-01-31&lt;br /&gt;downloads:  2968&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-02-28&lt;br /&gt;downloads:  2987&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-03-31&lt;br /&gt;downloads:  3313&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-04-30&lt;br /&gt;downloads:  2980&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-05-31&lt;br /&gt;downloads:  7315&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-06-30&lt;br /&gt;downloads:  2737&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-07-31&lt;br /&gt;downloads:  2607&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-08-31&lt;br /&gt;downloads:  8064&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-09-30&lt;br /&gt;downloads:  3900&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-10-31&lt;br /&gt;downloads:  4545&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-11-30&lt;br /&gt;downloads:  5094&lt;br /&gt;package: epiR&#34;,&#34;end: 2018-12-31&lt;br /&gt;downloads:  3423&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-01-31&lt;br /&gt;downloads:  3754&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-02-28&lt;br /&gt;downloads:  4162&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-03-31&lt;br /&gt;downloads:  4634&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-04-30&lt;br /&gt;downloads:  3612&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-05-31&lt;br /&gt;downloads:  8434&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-06-30&lt;br /&gt;downloads:  4011&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-07-31&lt;br /&gt;downloads:  3754&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-08-31&lt;br /&gt;downloads:  3829&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-09-30&lt;br /&gt;downloads:  5009&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-10-31&lt;br /&gt;downloads:  5476&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-11-30&lt;br /&gt;downloads:  6207&lt;br /&gt;package: epiR&#34;,&#34;end: 2019-12-31&lt;br /&gt;downloads:  4976&lt;br /&gt;package: epiR&#34;,&#34;end: 2020-01-31&lt;br /&gt;downloads:  5751&lt;br /&gt;package: epiR&#34;,&#34;end: 2020-02-29&lt;br /&gt;downloads:  6123&lt;br /&gt;package: epiR&#34;,&#34;end: 2020-03-31&lt;br /&gt;downloads:  7171&lt;br /&gt;package: epiR&#34;,&#34;end: 2020-04-30&lt;br /&gt;downloads:  6051&lt;br /&gt;package: epiR&#34;,&#34;end: 2020-05-20&lt;br /&gt;downloads:  3651&lt;br /&gt;package: epiR&#34;],&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;lines&#34;,&#34;line&#34;:{&#34;width&#34;:1.88976377952756,&#34;color&#34;:&#34;rgba(0,191,125,1)&#34;,&#34;dash&#34;:&#34;solid&#34;},&#34;hoveron&#34;:&#34;points&#34;,&#34;name&#34;:&#34;epiR&#34;,&#34;legendgroup&#34;:&#34;epiR&#34;,&#34;showlegend&#34;:true,&#34;xaxis&#34;:&#34;x&#34;,&#34;yaxis&#34;:&#34;y&#34;,&#34;hoverinfo&#34;:&#34;text&#34;,&#34;frame&#34;:null},{&#34;x&#34;:[16466,16494,16525,16555,16586,16616,16647,16678,16708,16739,16769,16800,16831,16860,16891,16921,16952,16982,17013,17044,17074,17105,17135,17166,17197,17225,17256,17286,17317,17347,17378,17409,17439,17470,17500,17531,17562,17590,17621,17651,17682,17712,17743,17774,17804,17835,17865,17896,17927,17955,17986,18016,18047,18077,18108,18139,18169,18200,18230,18261,18292,18321,18352,18382,18402],&#34;y&#34;:[374,296,377,463,307,283,253,346,351,366,323,291,333,297,242,260,235,203,232,214,158,200,236,197,197,154,174,359,241,198,206,189,245,214,243,293,211,220,199,303,245,316,248,154,391,373,405,360,401,389,550,475,788,386,895,551,640,812,682,757,1140,884,3548,5562,3493],&#34;text&#34;:[&#34;end: 2015-01-31&lt;br /&gt;downloads:   374&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-02-28&lt;br /&gt;downloads:   296&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-03-31&lt;br /&gt;downloads:   377&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-04-30&lt;br /&gt;downloads:   463&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-05-31&lt;br /&gt;downloads:   307&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-06-30&lt;br /&gt;downloads:   283&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-07-31&lt;br /&gt;downloads:   253&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-08-31&lt;br /&gt;downloads:   346&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-09-30&lt;br /&gt;downloads:   351&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-10-31&lt;br /&gt;downloads:   366&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-11-30&lt;br /&gt;downloads:   323&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2015-12-31&lt;br /&gt;downloads:   291&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-01-31&lt;br /&gt;downloads:   333&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-02-29&lt;br /&gt;downloads:   297&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-03-31&lt;br /&gt;downloads:   242&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-04-30&lt;br /&gt;downloads:   260&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-05-31&lt;br /&gt;downloads:   235&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-06-30&lt;br /&gt;downloads:   203&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-07-31&lt;br /&gt;downloads:   232&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-08-31&lt;br /&gt;downloads:   214&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-09-30&lt;br /&gt;downloads:   158&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-10-31&lt;br /&gt;downloads:   200&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-11-30&lt;br /&gt;downloads:   236&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2016-12-31&lt;br /&gt;downloads:   197&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-01-31&lt;br /&gt;downloads:   197&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-02-28&lt;br /&gt;downloads:   154&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-03-31&lt;br /&gt;downloads:   174&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-04-30&lt;br /&gt;downloads:   359&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-05-31&lt;br /&gt;downloads:   241&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-06-30&lt;br /&gt;downloads:   198&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-07-31&lt;br /&gt;downloads:   206&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-08-31&lt;br /&gt;downloads:   189&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-09-30&lt;br /&gt;downloads:   245&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-10-31&lt;br /&gt;downloads:   214&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-11-30&lt;br /&gt;downloads:   243&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2017-12-31&lt;br /&gt;downloads:   293&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-01-31&lt;br /&gt;downloads:   211&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-02-28&lt;br /&gt;downloads:   220&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-03-31&lt;br /&gt;downloads:   199&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-04-30&lt;br /&gt;downloads:   303&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-05-31&lt;br /&gt;downloads:   245&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-06-30&lt;br /&gt;downloads:   316&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-07-31&lt;br /&gt;downloads:   248&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-08-31&lt;br /&gt;downloads:   154&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-09-30&lt;br /&gt;downloads:   391&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-10-31&lt;br /&gt;downloads:   373&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-11-30&lt;br /&gt;downloads:   405&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2018-12-31&lt;br /&gt;downloads:   360&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-01-31&lt;br /&gt;downloads:   401&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-02-28&lt;br /&gt;downloads:   389&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-03-31&lt;br /&gt;downloads:   550&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-04-30&lt;br /&gt;downloads:   475&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-05-31&lt;br /&gt;downloads:   788&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-06-30&lt;br /&gt;downloads:   386&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-07-31&lt;br /&gt;downloads:   895&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-08-31&lt;br /&gt;downloads:   551&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-09-30&lt;br /&gt;downloads:   640&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-10-31&lt;br /&gt;downloads:   812&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-11-30&lt;br /&gt;downloads:   682&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2019-12-31&lt;br /&gt;downloads:   757&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2020-01-31&lt;br /&gt;downloads:  1140&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2020-02-29&lt;br /&gt;downloads:   884&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2020-03-31&lt;br /&gt;downloads:  3548&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2020-04-30&lt;br /&gt;downloads:  5562&lt;br /&gt;package: EpiEstim&#34;,&#34;end: 2020-05-20&lt;br /&gt;downloads:  3493&lt;br /&gt;package: EpiEstim&#34;],&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;lines&#34;,&#34;line&#34;:{&#34;width&#34;:1.88976377952756,&#34;color&#34;:&#34;rgba(0,176,246,1)&#34;,&#34;dash&#34;:&#34;solid&#34;},&#34;hoveron&#34;:&#34;points&#34;,&#34;name&#34;:&#34;EpiEstim&#34;,&#34;legendgroup&#34;:&#34;EpiEstim&#34;,&#34;showlegend&#34;:true,&#34;xaxis&#34;:&#34;x&#34;,&#34;yaxis&#34;:&#34;y&#34;,&#34;hoverinfo&#34;:&#34;text&#34;,&#34;frame&#34;:null},{&#34;x&#34;:[16647,16678,16708,16739,16769,16800,16831,16860,16891,16921,16952,16982,17013,17044,17074,17105,17135,17166,17197,17225,17256,17286,17317,17347,17378,17409,17439,17470,17500,17531,17562,17590,17621,17651,17682,17712,17743,17774,17804,17835,17865,17896,17927,17955,17986,18016,18047,18077,18108,18139,18169,18200,18230,18261,18292,18321,18352,18382,18402],&#34;y&#34;:[204,230,350,369,619,566,485,515,597,551,545,470,489,433,745,1009,988,1041,720,813,1109,1136,1023,1169,602,698,686,1179,1104,755,815,825,1401,1522,1986,1345,1423,1397,1836,2075,2710,1825,2736,2449,3365,2884,3958,3080,2924,3247,3554,5321,6498,3791,4105,4413,4606,4145,3284],&#34;text&#34;:[&#34;end: 2015-07-31&lt;br /&gt;downloads:   204&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2015-08-31&lt;br /&gt;downloads:   230&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2015-09-30&lt;br /&gt;downloads:   350&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2015-10-31&lt;br /&gt;downloads:   369&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2015-11-30&lt;br /&gt;downloads:   619&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2015-12-31&lt;br /&gt;downloads:   566&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-01-31&lt;br /&gt;downloads:   485&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-02-29&lt;br /&gt;downloads:   515&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-03-31&lt;br /&gt;downloads:   597&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-04-30&lt;br /&gt;downloads:   551&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-05-31&lt;br /&gt;downloads:   545&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-06-30&lt;br /&gt;downloads:   470&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-07-31&lt;br /&gt;downloads:   489&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-08-31&lt;br /&gt;downloads:   433&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-09-30&lt;br /&gt;downloads:   745&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-10-31&lt;br /&gt;downloads:  1009&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-11-30&lt;br /&gt;downloads:   988&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2016-12-31&lt;br /&gt;downloads:  1041&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-01-31&lt;br /&gt;downloads:   720&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-02-28&lt;br /&gt;downloads:   813&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-03-31&lt;br /&gt;downloads:  1109&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-04-30&lt;br /&gt;downloads:  1136&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-05-31&lt;br /&gt;downloads:  1023&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-06-30&lt;br /&gt;downloads:  1169&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-07-31&lt;br /&gt;downloads:   602&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-08-31&lt;br /&gt;downloads:   698&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-09-30&lt;br /&gt;downloads:   686&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-10-31&lt;br /&gt;downloads:  1179&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-11-30&lt;br /&gt;downloads:  1104&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2017-12-31&lt;br /&gt;downloads:   755&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-01-31&lt;br /&gt;downloads:   815&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-02-28&lt;br /&gt;downloads:   825&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-03-31&lt;br /&gt;downloads:  1401&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-04-30&lt;br /&gt;downloads:  1522&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-05-31&lt;br /&gt;downloads:  1986&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-06-30&lt;br /&gt;downloads:  1345&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-07-31&lt;br /&gt;downloads:  1423&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-08-31&lt;br /&gt;downloads:  1397&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-09-30&lt;br /&gt;downloads:  1836&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-10-31&lt;br /&gt;downloads:  2075&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-11-30&lt;br /&gt;downloads:  2710&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2018-12-31&lt;br /&gt;downloads:  1825&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-01-31&lt;br /&gt;downloads:  2736&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-02-28&lt;br /&gt;downloads:  2449&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-03-31&lt;br /&gt;downloads:  3365&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-04-30&lt;br /&gt;downloads:  2884&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-05-31&lt;br /&gt;downloads:  3958&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-06-30&lt;br /&gt;downloads:  3080&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-07-31&lt;br /&gt;downloads:  2924&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-08-31&lt;br /&gt;downloads:  3247&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-09-30&lt;br /&gt;downloads:  3554&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-10-31&lt;br /&gt;downloads:  5321&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-11-30&lt;br /&gt;downloads:  6498&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2019-12-31&lt;br /&gt;downloads:  3791&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2020-01-31&lt;br /&gt;downloads:  4105&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2020-02-29&lt;br /&gt;downloads:  4413&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2020-03-31&lt;br /&gt;downloads:  4606&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2020-04-30&lt;br /&gt;downloads:  4145&lt;br /&gt;package: epiDisplay&#34;,&#34;end: 2020-05-20&lt;br /&gt;downloads:  3284&lt;br /&gt;package: epiDisplay&#34;],&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;lines&#34;,&#34;line&#34;:{&#34;width&#34;:1.88976377952756,&#34;color&#34;:&#34;rgba(231,107,243,1)&#34;,&#34;dash&#34;:&#34;solid&#34;},&#34;hoveron&#34;:&#34;points&#34;,&#34;name&#34;:&#34;epiDisplay&#34;,&#34;legendgroup&#34;:&#34;epiDisplay&#34;,&#34;showlegend&#34;:true,&#34;xaxis&#34;:&#34;x&#34;,&#34;yaxis&#34;:&#34;y&#34;,&#34;hoverinfo&#34;:&#34;text&#34;,&#34;frame&#34;:null}],&#34;layout&#34;:{&#34;margin&#34;:{&#34;t&#34;:43.7625570776256,&#34;r&#34;:7.30593607305936,&#34;b&#34;:40.1826484018265,&#34;l&#34;:54.7945205479452},&#34;plot_bgcolor&#34;:&#34;rgba(235,235,235,1)&#34;,&#34;paper_bgcolor&#34;:&#34;rgba(255,255,255,1)&#34;,&#34;font&#34;:{&#34;color&#34;:&#34;rgba(0,0,0,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:14.6118721461187},&#34;title&#34;:{&#34;text&#34;:&#34;Download History of Top 5 Epidemiology Packages&#34;,&#34;font&#34;:{&#34;color&#34;:&#34;rgba(0,0,0,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:17.5342465753425},&#34;x&#34;:0,&#34;xref&#34;:&#34;paper&#34;},&#34;xaxis&#34;:{&#34;domain&#34;:[0,1],&#34;automargin&#34;:true,&#34;type&#34;:&#34;linear&#34;,&#34;autorange&#34;:false,&#34;range&#34;:[16369.2,18498.8],&#34;tickmode&#34;:&#34;array&#34;,&#34;ticktext&#34;:[&#34;2016&#34;,&#34;2018&#34;,&#34;2020&#34;],&#34;tickvals&#34;:[16801,17532,18262],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;2016&#34;,&#34;2018&#34;,&#34;2020&#34;],&#34;nticks&#34;:null,&#34;ticks&#34;:&#34;outside&#34;,&#34;tickcolor&#34;:&#34;rgba(51,51,51,1)&#34;,&#34;ticklen&#34;:3.65296803652968,&#34;tickwidth&#34;:0.66417600664176,&#34;showticklabels&#34;:true,&#34;tickfont&#34;:{&#34;color&#34;:&#34;rgba(77,77,77,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:11.689497716895},&#34;tickangle&#34;:-0,&#34;showline&#34;:false,&#34;linecolor&#34;:null,&#34;linewidth&#34;:0,&#34;showgrid&#34;:true,&#34;gridcolor&#34;:&#34;rgba(255,255,255,1)&#34;,&#34;gridwidth&#34;:0.66417600664176,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;y&#34;,&#34;title&#34;:{&#34;text&#34;:&#34;Month&#34;,&#34;font&#34;:{&#34;color&#34;:&#34;rgba(0,0,0,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:14.6118721461187}},&#34;hoverformat&#34;:&#34;.2f&#34;},&#34;yaxis&#34;:{&#34;domain&#34;:[0,1],&#34;automargin&#34;:true,&#34;type&#34;:&#34;linear&#34;,&#34;autorange&#34;:false,&#34;range&#34;:[-527.3,14461.3],&#34;tickmode&#34;:&#34;array&#34;,&#34;ticktext&#34;:[&#34;0&#34;,&#34;5000&#34;,&#34;10000&#34;],&#34;tickvals&#34;:[0,5000,10000],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;0&#34;,&#34;5000&#34;,&#34;10000&#34;],&#34;nticks&#34;:null,&#34;ticks&#34;:&#34;outside&#34;,&#34;tickcolor&#34;:&#34;rgba(51,51,51,1)&#34;,&#34;ticklen&#34;:3.65296803652968,&#34;tickwidth&#34;:0.66417600664176,&#34;showticklabels&#34;:true,&#34;tickfont&#34;:{&#34;color&#34;:&#34;rgba(77,77,77,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:11.689497716895},&#34;tickangle&#34;:-0,&#34;showline&#34;:false,&#34;linecolor&#34;:null,&#34;linewidth&#34;:0,&#34;showgrid&#34;:true,&#34;gridcolor&#34;:&#34;rgba(255,255,255,1)&#34;,&#34;gridwidth&#34;:0.66417600664176,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x&#34;,&#34;title&#34;:{&#34;text&#34;:&#34;downloads&#34;,&#34;font&#34;:{&#34;color&#34;:&#34;rgba(0,0,0,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:14.6118721461187}},&#34;hoverformat&#34;:&#34;.2f&#34;},&#34;shapes&#34;:[{&#34;type&#34;:&#34;rect&#34;,&#34;fillcolor&#34;:null,&#34;line&#34;:{&#34;color&#34;:null,&#34;width&#34;:0,&#34;linetype&#34;:[]},&#34;yref&#34;:&#34;paper&#34;,&#34;xref&#34;:&#34;paper&#34;,&#34;x0&#34;:0,&#34;x1&#34;:1,&#34;y0&#34;:0,&#34;y1&#34;:1}],&#34;showlegend&#34;:true,&#34;legend&#34;:{&#34;bgcolor&#34;:&#34;rgba(255,255,255,1)&#34;,&#34;bordercolor&#34;:&#34;transparent&#34;,&#34;borderwidth&#34;:1.88976377952756,&#34;font&#34;:{&#34;color&#34;:&#34;rgba(0,0,0,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:11.689497716895},&#34;y&#34;:0.913385826771654},&#34;annotations&#34;:[{&#34;text&#34;:&#34;package&#34;,&#34;x&#34;:1.02,&#34;y&#34;:1,&#34;showarrow&#34;:false,&#34;ax&#34;:0,&#34;ay&#34;:0,&#34;font&#34;:{&#34;color&#34;:&#34;rgba(0,0,0,1)&#34;,&#34;family&#34;:&#34;&#34;,&#34;size&#34;:14.6118721461187},&#34;xref&#34;:&#34;paper&#34;,&#34;yref&#34;:&#34;paper&#34;,&#34;textangle&#34;:-0,&#34;xanchor&#34;:&#34;left&#34;,&#34;yanchor&#34;:&#34;bottom&#34;,&#34;legendTitle&#34;:true}],&#34;hovermode&#34;:&#34;closest&#34;,&#34;barmode&#34;:&#34;relative&#34;},&#34;config&#34;:{&#34;doubleClick&#34;:&#34;reset&#34;,&#34;showSendToCloud&#34;:false},&#34;source&#34;:&#34;A&#34;,&#34;attrs&#34;:{&#34;ed1416b88cd0&#34;:{&#34;x&#34;:{},&#34;y&#34;:{},&#34;colour&#34;:{},&#34;type&#34;:&#34;scatter&#34;}},&#34;cur_data&#34;:&#34;ed1416b88cd0&#34;,&#34;visdat&#34;:{&#34;ed1416b88cd0&#34;:[&#34;function (y) &#34;,&#34;x&#34;]},&#34;highlight&#34;:{&#34;on&#34;:&#34;plotly_click&#34;,&#34;persistent&#34;:false,&#34;dynamic&#34;:false,&#34;selectize&#34;:false,&#34;opacityDim&#34;:0.2,&#34;selected&#34;:{&#34;opacity&#34;:1},&#34;debounce&#34;:0},&#34;shinyEvents&#34;:[&#34;plotly_hover&#34;,&#34;plotly_click&#34;,&#34;plotly_selected&#34;,&#34;plotly_relayout&#34;,&#34;plotly_brushed&#34;,&#34;plotly_brushing&#34;,&#34;plotly_clickannotation&#34;,&#34;plotly_doubleclick&#34;,&#34;plotly_deselect&#34;,&#34;plotly_afterplot&#34;,&#34;plotly_sunburstclick&#34;],&#34;base_url&#34;:&#34;https://plot.ly&#34;},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;p&gt;I’ll close with this: if you are R literate, you can be pretty confident that you will be able to find tutorials, models and reference implementations to help you learn something about any field that benefits from statistical analysis. If you are an expert in the field, there will be something for you too.&lt;/p&gt;
&lt;p&gt;When looking for R packages for a particular application, first look to see if there is a &lt;a href=&#34;https://cran.r-project.org/web/views/&#34;&gt;task view&lt;/a&gt;. If not, R provides some pretty good tools to help you search.&lt;/p&gt;

        &lt;script&gt;window.location.href=&#39;https://rviews.rstudio.com/2020/05/20/some-r-resources-for-epidemiology/&#39;;&lt;/script&gt;
      </description>
    </item>
    
    <item>
      <title>Simulating COVID-19 interventions with R</title>
      <link>https://rviews.rstudio.com/2020/03/19/simulating-covid-19-interventions-with-r/</link>
      <pubDate>Thu, 19 Mar 2020 00:00:00 +0000</pubDate>
      
      <guid>https://rviews.rstudio.com/2020/03/19/simulating-covid-19-interventions-with-r/</guid>
      <description>
        
&lt;script src=&#34;/rmarkdown-libs/htmlwidgets/htmlwidgets.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;/rmarkdown-libs/viz/viz.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;/rmarkdown-libs/DiagrammeR-styles/styles.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;/rmarkdown-libs/grViz-binding/grViz.js&#34;&gt;&lt;/script&gt;


&lt;p&gt;&lt;em&gt;Tim Churches is a Senior Research Fellow at the UNSW Medicine South Western Sydney Clinical School at Liverpool Hospital, and a health data scientist at the Ingham Institute for Applied Medical Research. This post examines simulation of COVID-19 spread using &lt;code&gt;R&lt;/code&gt;, and how such simulations can be used to understand the effects of various public health interventions design to limit or slow its spread.&lt;/em&gt;&lt;/p&gt;
&lt;div id=&#34;disclaimer&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;DISCLAIMER&lt;/h1&gt;
&lt;p&gt;The simulation results in this blog post, or any other results produced by the &lt;code&gt;R&lt;/code&gt; code described in it, should &lt;strong&gt;not&lt;/strong&gt; be used as actual estimates of mortality or any other aspect of the COVID-19 pandemic. The simulations are intended to explain principles, and permit exploration of the potential effects of various combinations and timings of interventions on spread. Furthermore, the code for these simulations has been written hurriedly over just a few days, it has not yet been peer-reviewed, and is considered &lt;em&gt;alpha&lt;/em&gt; quality, and the simulation parameterisation presented here has not yet been validated against real-world COVID-19 data.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;introduction&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;In a &lt;a href=&#34;https://rviews.rstudio.com/2020/03/05/covid-19-epidemiology-with-r/&#34;&gt;previous post&lt;/a&gt;, we looked at the use of some &lt;code&gt;R&lt;/code&gt; packages developed by the &lt;a href=&#34;https://www.repidemicsconsortium.org&#34;&gt;&lt;strong&gt;R&lt;/strong&gt; &lt;strong&gt;E&lt;/strong&gt;pidemics &lt;strong&gt;Con&lt;/strong&gt;sortium (RECON)&lt;/a&gt; to undertake epidemiological analyses COVID-19 incidence data scraped from various web sources.&lt;/p&gt;
&lt;p&gt;Undertaking such value-adding analyses of COVID-19 incidence data, as the full horror of the pandemic unfolds, is a worthwhile endeavour. But it would also be useful to be able to gain a better understanding of the likely effects of various public health interventions on COVID-19 spread.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.fastcompany.com/90476143/the-story-behind-flatten-the-curve-the-defining-chart-of-the-coronavirus&#34;&gt;“Flattening-the-curve”&lt;/a&gt; infographics such as the one shown below are now everywhere. They are a useful and succinct way of communicating a key public health message – that social distancing and related measures will help take the strain off our health care systems in the coming months.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;https://upload.wikimedia.org/wikipedia/commons/c/c5/Covid-19-curves-graphic-social-v3.gif&#34; alt=&#34;Source: Siouxsie Wiles and Toby Morris&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Source: &lt;a href=&#34;https://thespinoff.co.nz/society/09-03-2020/the-three-phases-of-covid-19-and-how-we-can-make-it-manageable/&#34;&gt;Siouxsie Wiles and Toby Morris&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;However, as pointed out by several commentators, many of these infographics miss a crucial point: that public health measures can do more than just &lt;strong&gt;flatten&lt;/strong&gt; the curve, they can also &lt;strong&gt;shrink&lt;/strong&gt; it, thus reducing the total number of cases (and thus serious cases) of COVID-19 in a population, rather than just spread the same number of cases over a longer period such that the area under the curve remains the same.&lt;/p&gt;
&lt;p&gt;This crucial point was beautifully illustrated using R in a &lt;a href=&#34;https://staff.math.su.se/hoehle/blog/2020/03/16/flatteningthecurve.html&#34;&gt;post by Michael Höhle&lt;/a&gt;, which is highly recommended reading. Michael used a dynamic model of disease transmission, which is based on solving a system of ordinary differential equations (ODEs) with the tools found in base &lt;code&gt;R&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Such mathematical approaches to disease outbreak simulation are elegant, and efficient to compute, but they can become unwieldy as the complexity of the model grows. An alternative is to use a more computational approach. In this post, we will briefly look at the individual contact model (ICM) simulation capability implemented in the excellent &lt;a href=&#34;http://www.epimodel.org&#34;&gt;&lt;code&gt;EpiModel&lt;/code&gt;&lt;/a&gt; package by Samuel Jenness and colleagues at the Emory University Rollins School of Public Health, and some extensions to it. Note also that this post is based on &lt;a href=&#34;https://timchurches.github.io/blog/&#34;&gt;two more detailed posts&lt;/a&gt; that provide more technical details and access to relevant source code.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;the-epimodel-package&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;The &lt;code&gt;EpiModel&lt;/code&gt; package&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;EpiModel&lt;/code&gt; package provides facilities to explore three types of disease transmission model (or simulations): dynamic contact models (DCMs) as used by &lt;a href=&#34;https://staff.math.su.se/hoehle/blog/2020/03/16/flatteningthecurve.html&#34;&gt;Michael Höhle&lt;/a&gt;, stochastic individual contact models (ICMs) and stochastic network models. The last are particularly interesting, as they can accurately model disease transmission with shifting social contact networks – they were developed to model HIV transmission, but have been used to model transmission of other diseases, including ebola, and even the propagation of &lt;em&gt;memes&lt;/em&gt; in social media networks. These network models potentially have application to COVID-19 modelling – they could be used to model shifting household, workplace or school and wider community interactions, and thus opportunity for transmission of the virus. However, the networks models as currently implemented are not quite suitable for such purposes, modifying them is complex, and they are also very computationally intensive to run. For these reasons, we will focus on the simpler ICM simulation facilities provided by &lt;code&gt;EpiModel&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Interested readers should consult the extensive tutorials and other documentation for &lt;code&gt;EpiModel&lt;/code&gt; for a fuller treatment, but in a nutshell, an &lt;code&gt;EpiModel&lt;/code&gt; ICM simulation starts with a hypothetical population of individuals who are permitted to be in one of several groups, or &lt;em&gt;compartments&lt;/em&gt;, at any particular time. Out-of-the-box, &lt;code&gt;EpiModel&lt;/code&gt; supports several types of models, including the popular SIR model which uses &lt;strong&gt;S&lt;/strong&gt;usceptible, &lt;strong&gt;I&lt;/strong&gt;nfectious and &lt;strong&gt;R&lt;/strong&gt;ecovered compartments. At each time step of the simulation, individuals randomly encounter and are exposed to other individuals in the population. The intensity of this population mixing is controlled by an &lt;em&gt;act rate&lt;/em&gt; parameter, with each “act” representing an opportunity for disease transmission, or at least those “acts” between susceptible individuals and infectious individuals. Recovered individuals are no longer infectious and are assumed to be immune from further re-infection, so we are not interested in their interactions with others, nor are we interested in interactions between pairs of susceptible individuals, only the interactions between susceptible and infectious individuals. However, not every such opportunity for disease transmission will result in actual disease transmission. The probability of transmission at each interaction is controlled by an &lt;em&gt;infection probability&lt;/em&gt; parameter.&lt;/p&gt;
&lt;p&gt;It is easy to see that decreasing the &lt;code&gt;act.rate&lt;/code&gt; parameter is equivalent to increasing social distancing in the population, and decreasing the &lt;code&gt;inf.prob&lt;/code&gt; parameter is equates to increased practice of hygiene measures such as hand washing, use of hand sanitisers, not touching one’s face, and mask wearing by the infectious. This was what I explored in some detail in my &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-03-10-modelling-the-effects-of-public-health-interventions-on-covid-19-transmission-part-1/&#34;&gt;first personal blog post on simulating COVID-19 spread&lt;/a&gt;.&lt;/p&gt;
&lt;div id=&#34;extensions-to-epimodel&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Extensions to &lt;code&gt;EpiModel&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;However, the SIR model type is a bit too simplistic if we want to use the model to explore the potential effect of various public health measures on COVID-19 spread. Fortunately, &lt;code&gt;EpiModel&lt;/code&gt; provides a plug-in architecture that allows more elaborate models to be implemented. The full details of my recent extensions to &lt;code&gt;EpiModel&lt;/code&gt; can be found in my &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-03-18-modelling-the-effects-of-public-health-interventions-on-covid-19-transmission-part-2/&#34;&gt;second personal blog post on COVID-19 simulation&lt;/a&gt;, but the gist of it is that several new compartment types were added, as shown in the table below, with support for transition between them as shown in the diagram below the table. The dashed lines indicate infection interactions.&lt;/p&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col width=&#34;13%&#34; /&gt;
&lt;col width=&#34;86%&#34; /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th&gt;Compartment&lt;/th&gt;
&lt;th&gt;Functional definition&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;S&lt;/td&gt;
&lt;td&gt;Susceptible individuals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;E&lt;/td&gt;
&lt;td&gt;Exposed &lt;strong&gt;and&lt;/strong&gt; infected, not yet symptomatic but potentially infectious&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;I&lt;/td&gt;
&lt;td&gt;Infected, symptomatic &lt;strong&gt;and&lt;/strong&gt; infectious&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;Q&lt;/td&gt;
&lt;td&gt;Infectious, but (self-)quarantined&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;H&lt;/td&gt;
&lt;td&gt;Requiring hospitalisation (would normally be hospitalised if capacity available)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;R&lt;/td&gt;
&lt;td&gt;Recovered, immune from further infection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;F&lt;/td&gt;
&lt;td&gt;Case fatality (death due to COVID-19, not other causes)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div id=&#34;htmlwidget-1&#34; style=&#34;width:672px;height:480px;&#34; class=&#34;grViz html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-1&#34;&gt;{&#34;x&#34;:{&#34;diagram&#34;:&#34;\ndigraph SEIQHRF {\n\n  # a \&#34;graph\&#34; statement\n  graph [overlap = false, fontsize = 10] #, rankdir = LR]\n\n  # several \&#34;node\&#34; statements\n  node [shape = box,\n        fontname = Helvetica]\n  S[label=\&#34;S=Susceptible\&#34;];\n  E[label=\&#34;E=Exposed and infected,\nasymptomatic,\npotentially infectious\&#34;];\n  I[label=\&#34;I=Infected and infectious\&#34;];\n  Q[label=\&#34;Q=(Self-)quarantined\n(infectious)\&#34;];\n  H[label=\&#34;H=Requires\nhospitalisation\&#34;];\n  R[label=\&#34;R=Recovered/immune\&#34;];\n  F[label=\&#34;F=Case fatality\&#34;]\n\n  # several \&#34;edge\&#34; statements\n  S-&gt;E\n  I-&gt;S[style=\&#34;dashed\&#34;]\n  E-&gt;I\n  E-&gt;S[style=\&#34;dashed\&#34;]\n  I-&gt;Q\n  Q-&gt;S[style=\&#34;dashed\&#34;]\n  I-&gt;R\n  I-&gt;H\n  H-&gt;F\n  H-&gt;R\n  Q-&gt;R\n  Q-&gt;H\n}\n&#34;,&#34;config&#34;:{&#34;engine&#34;:&#34;dot&#34;,&#34;options&#34;:null}},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;p&gt;Another capability that has been added is the ability to specify time-variant parameters, as a vector of the same length as there are time steps in the simulation. This allows us to smoothly (or step-wise) introduce, and withdraw, various interventions at arbitrary times during the course of our simulation.&lt;/p&gt;
&lt;p&gt;We won’t cover here the details of how to obtain these extensions, which at the time of writing should still be considered &lt;em&gt;alpha&lt;/em&gt; quality code – please see the &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-03-18-modelling-the-effects-of-public-health-interventions-on-covid-19-transmission-part-2/&#34;&gt;blog post&lt;/a&gt; for those. Let’s just proceed to running some simulations.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;baseline-simulation&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Baseline simulation&lt;/h1&gt;
&lt;p&gt;First we’ll run a baseline simulation for a hypothetical population of 10,000 people, in which there are just three infectious COVID-19 cases at the outset. We’ll run it for 365 days, and we’ll set a very low rate at which infectious individuals enter self-quarantine (thereby dramatically lowering their rate of interactions with others) after they become symptomatic (or have been tested and found positive), and thus aware of their infectivity. Because it is stochastic, the simulation is run eight times, using parallel processing if available, and the results averaged.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;tic()
baseline_sim &amp;lt;- simulate(ncores = 4)
toc()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 58.092 sec elapsed&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s visualise the results as a set of time-series of the daily count of our 10,000 individuals in each compartment.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-19-simulating-covid-19-interventions-with-r/index_files/figure-html/unnamed-chunk-5-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;OK, that looks very reasonable. Note that almost the entire population ends up being infected. However, the &lt;strong&gt;S&lt;/strong&gt; and &lt;strong&gt;R&lt;/strong&gt; compartments dominate the plot (which is good, because it means humanity will survive!), so let’s re-plot leaving out those compartments so we can see a bit more detail.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-19-simulating-covid-19-interventions-with-r/index_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Notice that the &lt;strong&gt;I&lt;/strong&gt; compartment curve lags behind the &lt;strong&gt;E&lt;/strong&gt; compartment curve – the lag is the incubation period, and that the &lt;strong&gt;Q&lt;/strong&gt; curve lags still further as infected people only reluctantly and belatedly quarantine themselves (in this baseline scenario).&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;running-intervention-experiments&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Running intervention experiments&lt;/h1&gt;
&lt;p&gt;Now we are in a position to run an experiment, by altering some parameters of our baseline model.&lt;/p&gt;
&lt;p&gt;Let’s model the effect of decreasing the infection probability at each exposure event by smoothly decreasing the &lt;code&gt;inf.prob&lt;/code&gt; parameters for the &lt;strong&gt;I&lt;/strong&gt; compartment. The infection probability at each exposure event (for the &lt;strong&gt;I&lt;/strong&gt; compartment individuals) starts at 5%, and we’ll reduce it to 2% between days 15 and 30. This models the effect of symptomatic infected people adopting better hygiene practices such as wearing masks, coughing into their elbows, using hand sanitisers, not shaking hands and so on, perhaps in response to a concerted public health advertising campaign by the government.&lt;/p&gt;
&lt;p&gt;Let’s examine the results of experiment 1, alongside the baseline for comparison:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;exp-1.png&#34; height = &#34;500&#34; width=&#34;700&#34;&gt;&lt;/p&gt;
&lt;p&gt;We can see from the plots on the left that by encouraging hygiene measures in symptomatic infectious individuals, we have not only substantially “flattened the curve”, but we have actually shrunk it. The result, as shown in the plots on the right, is that demand for hospital beds is substantially reduced, and only briefly exceeds our defined hospital capacity of 40 bed. This results in a substantially reduced mortality rate, shown by the black line.&lt;/p&gt;
&lt;div id=&#34;more-experiments&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;More experiments&lt;/h2&gt;
&lt;p&gt;We can now embark on a series of experiments, exploring various interventions singly, or in combination, and with different timings.&lt;/p&gt;
&lt;div id=&#34;experiment-2&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Experiment 2&lt;/h3&gt;
&lt;p&gt;Let’s repeat experiment 1, but let’s delay the start of the hygiene campaign until day 30 and make it less intense so it takes until day 60 to achieve the desired increase in hygiene in the symptomatic infected.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;infectious_hygiene_delayed_ramp &amp;lt;- function(t) {
  ifelse(t &amp;lt; 30, 0.05, ifelse(t &amp;lt;= 60, 0.05 - (t - 30) * (0.05 - 
    0.02)/30, 0.02))
}

infectious_hygiene_delayed_ramp_sim &amp;lt;- simulate(inf.prob.i = infectious_hygiene_delayed_ramp(1:366))&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;experiment-3&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Experiment 3&lt;/h3&gt;
&lt;p&gt;Let’s repeat experiment 1, except this time instead of promoting hygiene measures in the symptomatic infected, we’ll promote, starting at day 15, prompt self-quarantine by anyone who is infected as soon as they become symptomatic. By “prompt”, we mean most such people will self-quarantine themselves immediately, but with an exponentially declining tail of such people taking longer to enter quarantine, with a few never complying. Those in self-quarantine won’t or can’t achieve complete social isolation, so we have set the &lt;code&gt;act.rate&lt;/code&gt; parameter for the quarantined compartment to a quarter of that for the other compartments to simulate such a reduction in social mixing (an increase in social distancing) in that group.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;quarantine_ramp &amp;lt;- function(t) {
  ifelse(t &amp;lt; 15, 0.0333, ifelse(t &amp;lt;= 30, 0.0333 + (t - 15) * 
    (0.3333 - 0.0333)/15, 0.333))
}

quarantine_ramp_sim &amp;lt;- simulate(quar.rate = quarantine_ramp(1:366))&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;experiment-4&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Experiment 4&lt;/h3&gt;
&lt;p&gt;Let’s add a moderate increase in social distancing for everyone (halving the &lt;code&gt;act.rate&lt;/code&gt;), again ramping it down between days 15 and 30.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;social_distance_ramp &amp;lt;- function(t) {
  ifelse(t &amp;lt; 15, 10, ifelse(t &amp;lt;= 30, 10 - (t - 15) * (10 - 
    5)/15, 5))
}

soc_dist_ramp_sim &amp;lt;- simulate(act.rate.i = social_distance_ramp(1:366), 
  act.rate.e = social_distance_ramp(1:366))&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;experiment-5&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Experiment 5&lt;/h3&gt;
&lt;p&gt;Let’s combine experiments 3 and 4: we’ll add a moderate increase in social distancing for everyone, as well as prompt self-quarantining in the symptomatic.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;quar_soc_dist_ramp_sim &amp;lt;- simulate(quar.rate = quarantine_ramp(1:366), 
  act.rate.i = social_distance_ramp(1:366), act.rate.e = social_distance_ramp(1:366))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now let’s examine the results.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;exp-5A.png&#34; height = &#34;500&#34; width=&#34;700&#34;&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;discussion&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Discussion&lt;/h2&gt;
&lt;p&gt;The results of our experiments almost speak for themselves, but a few things are worth highlighting:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Implementing interventions too late is almost worthless. Act early and decisively. You can always wind back the intervention later, whereas a failure to act early enough can never be recovered from.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prompt self-quarantining of symptomatic cases is effective. In practice that means everyone with COVID-19-like symptoms, whether they actually have COVID-19 or something else, should immediately self-quarantine. Don’t wait to be tested.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A moderate increase in social distancing (decrease in social mixing) in everyone is also effective, mainly because it reduces exposure opportunities with both the asymptomatic-but-infected and the symptomatic infected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Combining measures is even more effective, as can be seen in experiment 5. In fact, there are theoretical reasons to believe that the effect of combined measures is partially multiplicative, not just additive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Public health interventions don’t just flatten the curve, they shrink it, and the result is very substantially reduced mortality due to COVID-19.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;None of these insights are novel, but it is nice to be able to independently confirm the recommendations of various expert groups, such as the WHO Collaborating Centre for Infectious Disease Modelling at Imperial College London (ICL) who have recently released a &lt;a href=&#34;https://www.imperial.ac.uk/mrc-global-infectious-disease-analysis/news--wuhan-coronavirus/&#34;&gt;report on the impact of non-pharmaceutical interventions (NPIs) to reduce COVID-19 mortality and healthcare demand&lt;/a&gt; which recommends similar strategies to those we have just discovered from our modest simulations in &lt;code&gt;R&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;two-more-experiments&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Two more experiments&lt;/h1&gt;
&lt;p&gt;What happens if we dramatically increase social distancing through a two week lock-down, which is then relaxed? We’ll use a step function to model this. We test such a lock-down lasting from day 15 to 30, and separately a lock-down from day 30 to day 45 instead. We’ll model the lock-down by reducing the &lt;code&gt;act.rate&lt;/code&gt; parameters for all compartments from 10 to 2.5.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;twoweek_lockdown_day15_vector &amp;lt;- c(rep(10, 15), rep(2.5, 15), 
  rep(10, 336))
twoweek_lockdown_day30_vector &amp;lt;- c(rep(10, 30), rep(2.5, 15), 
  rep(10, 321))

twoweek_lockdown_day15_sim &amp;lt;- simulate(act.rate.i = twoweek_lockdown_day15_vector, 
  act.rate.e = twoweek_lockdown_day15_vector)

twoweek_lockdown_day30_sim &amp;lt;- simulate(act.rate.i = twoweek_lockdown_day30_vector, 
  act.rate.e = twoweek_lockdown_day30_vector)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;exp-6A.png&#34; height = &#34;500&#34; width=&#34;700&#34;&gt;&lt;/p&gt;
&lt;p&gt;Wow, that’s a bit surprising! The two week lock-down starting at day 15 isn’t effective at all - it just stops the spread in its tracks for two weeks, and then it just resumes again.
But a two-week lock-down starting at day 30 is somewhat more effective, presumably because there are more infected people being taken out of circulation from day 30 onwards. But the epidemic still partially bounces back after the two weeks are over.&lt;/p&gt;
&lt;p&gt;What this tells us is that single lock-downs for only two weeks aren’t effective. What about a lock-down for a whole month, instead, combined with prompt quarantine with even more effective isolation and hygiene measures for those quarantined?&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;fourweek_lockdown_day15_vector &amp;lt;- c(rep(10, 15), rep(2.5, 30), 
  rep(7.5, 321))
fourweek_lockdown_day30_vector &amp;lt;- c(rep(10, 30), rep(2.5, 30), 
  rep(7.5, 306))

fourweek_lockdown_day15_sim &amp;lt;- simulate(act.rate.i = fourweek_lockdown_day15_vector, 
  act.rate.e = fourweek_lockdown_day15_vector, quar.rate = quarantine_ramp(1:366), 
  inf.prob.q = 0.01)

fourweek_lockdown_day30_sim &amp;lt;- simulate(act.rate.i = fourweek_lockdown_day30_vector, 
  act.rate.e = fourweek_lockdown_day30_vector, quar.rate = quarantine_ramp(1:366), 
  inf.prob.q = 0.01)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;exp-7A.png&#34; height = &#34;500&#34; width=&#34;700&#34;&gt;&lt;/p&gt;
&lt;p&gt;Well, that’s satisfying! By acting early, and decisively, we’ve managed to stop COVID-19 dead in it tracks in experiment 8, and in doing so have saved many lives – at least, we have in our little simulated world. But even experiment 9 provides a much better outcome, indicating that decisive action, even if somewhat belated, is much better than none.&lt;/p&gt;
&lt;p&gt;Of course, the real world is far more complex and messier, and COVID-19 may not behave in exactly the same way in real-life, but at least we can see the principles of public health interventions in action in our simulation, and perhaps better understand or want to question what is being done, or not done, or being done too late, to contain the spread of the virus in the real world.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;conclusion&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Although there is still a lot of work yet to be done on the extensions to &lt;code&gt;EpiModel&lt;/code&gt; demonstrated here, it seems that they offer promise as a tool for understanding real-world action and inaction on COVID-19, and prompting legitimate questions about such actions or lack thereof.&lt;/p&gt;
&lt;p&gt;One would hope that governments are using far more sophisticated simulation models than the one we have described here, which was built over the course of just a few days, to plan or inform their responses to COVID-19. If not, they ought to be.&lt;/p&gt;
&lt;/div&gt;

        &lt;script&gt;window.location.href=&#39;https://rviews.rstudio.com/2020/03/19/simulating-covid-19-interventions-with-r/&#39;;&lt;/script&gt;
      </description>
    </item>
    
    <item>
      <title>COVID-19 epidemiology with R</title>
      <link>https://rviews.rstudio.com/2020/03/05/covid-19-epidemiology-with-r/</link>
      <pubDate>Thu, 05 Mar 2020 00:00:00 +0000</pubDate>
      
      <guid>https://rviews.rstudio.com/2020/03/05/covid-19-epidemiology-with-r/</guid>
      <description>
        


&lt;p&gt;&lt;em&gt;Tim Churches is a Senior Research Fellow at the UNSW Medicine South Western Sydney Clinical School at Liverpool Hospital, and a health data scientist at the Ingham Institute for Applied Medical Research, also located at Liverpool, Sydney. His background is in general medicine, general practice medicine, occupational health, public health practice, particularly population health surveillance, and clinical epidemiology.&lt;/em&gt;&lt;/p&gt;
&lt;div id=&#34;introduction&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;As I write this on 4th March, 2020, the world is on the cusp of a global COVID-19 pandemic caused by the SARS-Cov2 virus. Every news report is dominated by alarming, and ever-growing cumulative counts of global cases and deaths due to COVID-19. &lt;a href=&#34;https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html&#34;&gt;Dashboards of global spread&lt;/a&gt; are beginning to light up like Christmas trees.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;R&lt;/code&gt; users, an obvious question is: “Does &lt;code&gt;R&lt;/code&gt; have anything to offer in helping to understand the situation?”.&lt;/p&gt;
&lt;p&gt;The answer is: “Yes, a lot!”.&lt;/p&gt;
&lt;p&gt;In fact, &lt;code&gt;R&lt;/code&gt; is one of the tools of choice for outbreak epidemiologists, and a quick search will yield many &lt;code&gt;R&lt;/code&gt; libraries on CRAN and elsewhere devoted to outbreak management and analysis. This post doesn’t seek to provide a review of the available packages – rather it illustrates the utility of a few of the excellent packages available in the &lt;a href=&#34;https://www.repidemicsconsortium.org&#34;&gt;&lt;strong&gt;R&lt;/strong&gt; &lt;strong&gt;E&lt;/strong&gt;pidemics &lt;strong&gt;Con&lt;/strong&gt;sortium (&lt;strong&gt;RECON&lt;/strong&gt;) suite&lt;/a&gt;, as well as the use of base &lt;code&gt;R&lt;/code&gt; and &lt;a href=&#34;https://www.tidyverse.org&#34;&gt;&lt;code&gt;tidyverse&lt;/code&gt;&lt;/a&gt; packages for data acquisition, wrangling and visualization. This post is based on &lt;a href=&#34;https://timchurches.github.io/blog/&#34;&gt;two much longer and more detailed blog posts&lt;/a&gt; I have published in the last few weeks on the same topic, but it uses US data.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;data-acquisition&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Data acquisition&lt;/h1&gt;
&lt;p&gt;Obtaining detailed, accurate and current data for the COVID-19 epidemic is not as straightforward as it might seem. Various national and provincial/governmental web sites in affected countries provide detailed summary data on incident cases, recovered cases and deaths due to the virus, but these data tend to be in the form of counts embedded in (usually non-English) text.&lt;/p&gt;
&lt;p&gt;There are several potential sources of data which have been abstracted and collated from such governmental sites. A widely-used source is a &lt;a href=&#34;https://github.com/CSSEGISandData/COVID-19&#34;&gt;dataset&lt;/a&gt; which is being collated by Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) and which is used as the source for &lt;a href=&#34;https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6&#34;&gt;the dashboard&lt;/a&gt; mentioned above. It is very easy to use – just read CSV files from the appropriate GitHub URL. However, it lacks detail (that wasn’t its intended purpose) and contains quite a few missing or anomalous data points when examined as a differenced daily time-series of incident cases, a relatively minor issue that is explored further &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-02-18-analysing-covid-19-2019-ncov-outbreak-data-with-r-part-1/#checking-the-data&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Another set of convenient sources are relevant wikipedia pages, such as &lt;a href=&#34;https://en.wikipedia.org/wiki/Timeline_of_the_2019–20_Wuhan_coronavirus_outbreak&#34;&gt;this one for China&lt;/a&gt;. There are equivalent pages for &lt;a href=&#34;https://en.wikipedia.org/wiki/Template:2019–20_coronavirus_outbreak_data/Japan_medical_cases&#34;&gt;Japan&lt;/a&gt;, &lt;a href=&#34;https://en.wikipedia.org/wiki/Template:2019–20_coronavirus_outbreak_data/South_Korea_medical_cases&#34;&gt;South Korea&lt;/a&gt;, &lt;a href=&#34;https://en.wikipedia.org/wiki/Template:2019–20_coronavirus_outbreak_data/Iran_medical_cases&#34;&gt;Iran&lt;/a&gt;, &lt;a href=&#34;https://en.wikipedia.org/wiki/Template:2019–20_coronavirus_outbreak_data/Italy_medical_cases&#34;&gt;Italy&lt;/a&gt; and many other countries. These wikipedia pages tend to be much more detailed and are well-referenced back to the original source web pages, but they are quite challenging to web-scrape because the format of the tables in which the data appears changes quite often, as various wikipedia contributors adjust their appearance. Nonetheless, we’ll scrape some detailed data about the initial set of identified COVID-19 cases in the United States (as at 4th March) from a suitable wikipedia page. The saving grace is that wikipedia pages are versioned, and thus it is possible to scrape data from a specific version of a table. But if you want daily updates to your data, using wikipedia pages as a source will involve daily maintenance of your web scraping code.&lt;/p&gt;
&lt;div id=&#34;incidence-data-collated-by-john-hopkins-university&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Incidence data collated by John Hopkins University&lt;/h2&gt;
&lt;p&gt;Acquiring these data is easy. The time-series format they provide is the most convenient for our purposes. We’ll also remove columns of US cases associated with the &lt;em&gt;Diamond Princess&lt;/em&gt; cruise ship because we can assume that those cases were (home) quarantined on repatriation and were unlikely, or at least a lot less likely, to give rise to further cases. We also shift the dates in the JHU data back one day reflect US time zones, somewhat approximately, because the original dates are with respect to midnight UTC (Greenwich time). That is necessary because we will be combining the JHU data with wikipedia-sourced US data, which is tabulated by dates referencing local US time zones.&lt;/p&gt;
&lt;p&gt;We also need to difference the JHU data, which is provided as cumulative counts, to get daily incident counts. Incident counts of cases are a lot more epidemiologically useful than cumulative counts. &lt;code&gt;dplyr&lt;/code&gt; makes short work of all that.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;jhu_url &amp;lt;- paste(&amp;quot;https://raw.githubusercontent.com/CSSEGISandData/&amp;quot;, 
  &amp;quot;COVID-19/master/csse_covid_19_data/&amp;quot;, &amp;quot;csse_covid_19_time_series/&amp;quot;, 
  &amp;quot;time_series_19-covid-Confirmed.csv&amp;quot;, sep = &amp;quot;&amp;quot;)

us_confirmed_long_jhu &amp;lt;- read_csv(jhu_url) %&amp;gt;% rename(province = &amp;quot;Province/State&amp;quot;, 
  country_region = &amp;quot;Country/Region&amp;quot;) %&amp;gt;% pivot_longer(-c(province, 
  country_region, Lat, Long), names_to = &amp;quot;Date&amp;quot;, values_to = &amp;quot;cumulative_cases&amp;quot;) %&amp;gt;% 
  # adjust JHU dates back one day to reflect US time, more or
# less
mutate(Date = mdy(Date) - days(1)) %&amp;gt;% filter(country_region == 
  &amp;quot;US&amp;quot;) %&amp;gt;% arrange(province, Date) %&amp;gt;% group_by(province) %&amp;gt;% 
  mutate(incident_cases = c(0, diff(cumulative_cases))) %&amp;gt;% 
  ungroup() %&amp;gt;% select(-c(country_region, Lat, Long, cumulative_cases)) %&amp;gt;% 
  filter(str_detect(province, &amp;quot;Diamond Princess&amp;quot;, negate = TRUE))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can now visualize the JHU data using &lt;code&gt;ggplot2&lt;/code&gt;, summarized for the whole of the US:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/plot_jhu_data-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;So, not a lot of data to work with as yet. One thing that is missing is information on whether those cases were &lt;em&gt;imported&lt;/em&gt;, that is, the infection was most likely acquired outside the US, or whether they were &lt;em&gt;local&lt;/em&gt;, as a result of local transmission (possibly from imported cases).&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;scraping-wikipedia&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Scraping wikipedia&lt;/h2&gt;
&lt;p&gt;The wikipedia page on COVID-19 in the US contains several tables, one of which contains a line-listing of all the initial US cases, which at the time of writing appeared to be fairly complete up to 2nd March. We’ll scrape that line-listing table from &lt;a href=&#34;https://en.wikipedia.org/w/index.php?title=2020_coronavirus_outbreak_in_the_United_States&amp;amp;oldid=944107102&#34;&gt;this version of the wikipedia page&lt;/a&gt;, leveraging the excellent &lt;code&gt;rvest&lt;/code&gt; package, part of the &lt;code&gt;tidyverse&lt;/code&gt;. Once again we need to do a bit of data wrangling to get the parsed table into a usable form.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# the URL of the wikipedia page to use is in wp_page_url
wp_page_url&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;https://en.wikipedia.org/w/index.php?title=2020_coronavirus_outbreak_in_the_United_States&amp;amp;oldid=944107102&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# read the page using the rvest package.
outbreak_webpage &amp;lt;- read_html(wp_page_url)

# parse the web page and extract the data from the eighth
# table
us_cases &amp;lt;- outbreak_webpage %&amp;gt;% html_nodes(&amp;quot;table&amp;quot;) %&amp;gt;% .[[8]] %&amp;gt;% 
  html_table(fill = TRUE)

# The automatically assigned column names are OK except that
# instead of County/city and State columns we have two
# columns called Location, due to the unfortunate use of
# colspans in the header row.  The tidyverse abhors
# duplicated column names, so we have to fix those, and make
# some of the other colnames a bit more tidyverse-friendly.
us_cases_colnames &amp;lt;- colnames(us_cases)
us_cases_colnames[min(which(us_cases_colnames == &amp;quot;Location&amp;quot;))] &amp;lt;- &amp;quot;CityCounty&amp;quot;
us_cases_colnames[min(which(us_cases_colnames == &amp;quot;Location&amp;quot;))] &amp;lt;- &amp;quot;State&amp;quot;
us_cases_colnames &amp;lt;- us_cases_colnames %&amp;gt;% str_replace(&amp;quot;Location&amp;quot;, 
  &amp;quot;CityCounty&amp;quot;) %&amp;gt;% str_replace(&amp;quot;Location&amp;quot;, &amp;quot;State&amp;quot;) %&amp;gt;% str_replace(&amp;quot;Case no.&amp;quot;, 
  &amp;quot;CaseNo&amp;quot;) %&amp;gt;% str_replace(&amp;quot;Date announced&amp;quot;, &amp;quot;Date&amp;quot;) %&amp;gt;% str_replace(&amp;quot;CDC origin type&amp;quot;, 
  &amp;quot;OriginTypeCDC&amp;quot;) %&amp;gt;% str_replace(&amp;quot;Treatment facility&amp;quot;, &amp;quot;TreatmentFacility&amp;quot;)
colnames(us_cases) &amp;lt;- us_cases_colnames

# utility function to remove wikipedia references in square
# brackets
rm_refs &amp;lt;- function(x) stringr::str_split(x, &amp;quot;\\[&amp;quot;, simplify = TRUE)[, 
  1]

# now remove references from CaseNo column, convert it to
# integer, convert the date column to date type and then lose
# all rows which then have NA in CaseNo or NA in the date
# column
us_cases &amp;lt;- us_cases %&amp;gt;% mutate(CaseNo = rm_refs(CaseNo)) %&amp;gt;% 
  mutate(CaseNo = as.integer(CaseNo), Date = as.Date(parse_date_time(Date, 
    c(&amp;quot;%B %d, %Y&amp;quot;, &amp;quot;%d %B, %Y&amp;quot;)))) %&amp;gt;% filter(!is.na(CaseNo), 
  !is.na(Date)) %&amp;gt;% # convert the various versions of unknown into NA in the
# OriginTypeCDC column
mutate(OriginTypeCDC = if_else(OriginTypeCDC %in% c(&amp;quot;Unknown&amp;quot;, 
  &amp;quot;Undisclosed&amp;quot;), NA_character_, OriginTypeCDC))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At this point we have an acceptably clean table, that looks like this:&lt;/p&gt;
&lt;style&gt;html {
  font-family: -apple-system, BlinkMacSystemFont, &#39;Segoe UI&#39;, Roboto, Oxygen, Ubuntu, Cantarell, &#39;Helvetica Neue&#39;, &#39;Fira Sans&#39;, &#39;Droid Sans&#39;, Arial, sans-serif;
}

#aessoebrkv .gt_table {
  display: table;
  border-collapse: collapse;
  margin-left: auto;
  margin-right: auto;
  color: #333333;
  font-size: 16px;
  background-color: #FFFFFF;
  width: auto;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #A8A8A8;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #A8A8A8;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
}

#aessoebrkv .gt_heading {
  background-color: #FFFFFF;
  text-align: center;
  border-bottom-color: #FFFFFF;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#aessoebrkv .gt_title {
  color: #333333;
  font-size: 125%;
  font-weight: initial;
  padding-top: 4px;
  padding-bottom: 4px;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 0;
}

#aessoebrkv .gt_subtitle {
  color: #333333;
  font-size: 85%;
  font-weight: initial;
  padding-top: 0;
  padding-bottom: 4px;
  border-top-color: #FFFFFF;
  border-top-width: 0;
}

#aessoebrkv .gt_bottom_border {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#aessoebrkv .gt_col_headings {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
}

#aessoebrkv .gt_col_heading {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  padding-left: 5px;
  padding-right: 5px;
  overflow-x: hidden;
}

#aessoebrkv .gt_column_spanner_outer {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: normal;
  text-transform: inherit;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
}

#aessoebrkv .gt_column_spanner_outer:first-child {
  padding-left: 0;
}

#aessoebrkv .gt_column_spanner_outer:last-child {
  padding-right: 0;
}

#aessoebrkv .gt_column_spanner {
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: bottom;
  padding-top: 5px;
  padding-bottom: 6px;
  overflow-x: hidden;
  display: inline-block;
  width: 100%;
}

#aessoebrkv .gt_group_heading {
  padding: 8px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
}

#aessoebrkv .gt_empty_group_heading {
  padding: 0.5px;
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  vertical-align: middle;
}

#aessoebrkv .gt_striped {
  background-color: rgba(128, 128, 128, 0.05);
}

#aessoebrkv .gt_from_md &gt; :first-child {
  margin-top: 0;
}

#aessoebrkv .gt_from_md &gt; :last-child {
  margin-bottom: 0;
}

#aessoebrkv .gt_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  margin: 10px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 1px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 1px;
  border-right-color: #D3D3D3;
  vertical-align: middle;
  overflow-x: hidden;
}

#aessoebrkv .gt_stub {
  color: #333333;
  background-color: #FFFFFF;
  font-size: 100%;
  font-weight: initial;
  text-transform: inherit;
  border-right-style: solid;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
  padding-left: 12px;
}

#aessoebrkv .gt_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#aessoebrkv .gt_first_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
}

#aessoebrkv .gt_grand_summary_row {
  color: #333333;
  background-color: #FFFFFF;
  text-transform: inherit;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
}

#aessoebrkv .gt_first_grand_summary_row {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 5px;
  padding-right: 5px;
  border-top-style: double;
  border-top-width: 6px;
  border-top-color: #D3D3D3;
}

#aessoebrkv .gt_table_body {
  border-top-style: solid;
  border-top-width: 2px;
  border-top-color: #D3D3D3;
  border-bottom-style: solid;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
}

#aessoebrkv .gt_footnotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#aessoebrkv .gt_footnote {
  margin: 0px;
  font-size: 90%;
  padding: 4px;
}

#aessoebrkv .gt_sourcenotes {
  color: #333333;
  background-color: #FFFFFF;
  border-bottom-style: none;
  border-bottom-width: 2px;
  border-bottom-color: #D3D3D3;
  border-left-style: none;
  border-left-width: 2px;
  border-left-color: #D3D3D3;
  border-right-style: none;
  border-right-width: 2px;
  border-right-color: #D3D3D3;
}

#aessoebrkv .gt_sourcenote {
  font-size: 90%;
  padding: 4px;
}

#aessoebrkv .gt_left {
  text-align: left;
}

#aessoebrkv .gt_center {
  text-align: center;
}

#aessoebrkv .gt_right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#aessoebrkv .gt_font_normal {
  font-weight: normal;
}

#aessoebrkv .gt_font_bold {
  font-weight: bold;
}

#aessoebrkv .gt_font_italic {
  font-style: italic;
}

#aessoebrkv .gt_super {
  font-size: 65%;
}

#aessoebrkv .gt_footnote_marks {
  font-style: italic;
  font-size: 65%;
}
&lt;/style&gt;
&lt;div id=&#34;aessoebrkv&#34; style=&#34;overflow-x:auto;overflow-y:auto;width:auto;height:auto;&#34;&gt;&lt;table class=&#34;gt_table&#34;&gt;
  &lt;thead class=&#34;gt_header&#34;&gt;
    &lt;tr&gt;
      &lt;th colspan=&#34;10&#34; class=&#34;gt_heading gt_title gt_font_normal&#34; style&gt;US cases of COVID-19 as at 3rd March 2020&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th colspan=&#34;10&#34; class=&#34;gt_heading gt_subtitle gt_font_normal gt_bottom_border&#34; style&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;thead class=&#34;gt_col_headings&#34;&gt;
    &lt;tr&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;CaseNo&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;Date&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;Status&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;OriginTypeCDC&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;Origin&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;CityCounty&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;State&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;TreatmentFacility&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;Sex&lt;/th&gt;
      &lt;th class=&#34;gt_col_heading gt_columns_bottom_border gt_left&#34; rowspan=&#34;1&#34; colspan=&#34;1&#34;&gt;Age&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody class=&#34;gt_table_body&#34;&gt;
    &lt;tr class=&#34;gt_group_heading_row&#34;&gt;
      &lt;td colspan=&#34;10&#34; class=&#34;gt_group_heading&#34;&gt;Last 6 rows&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;60&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-04&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Deceased&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;NA&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Unknown&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Placer County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;California&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Hospitalized&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Elderly adult&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;61&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-04&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;NA&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Unknown&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Santa Clara County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;California&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Hospitalized&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;62&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-04&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Person-to-person spread&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Santa Clara County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;California&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;In-home isolation&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;63&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-04&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Person-to-person spread&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Santa Clara County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;California&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;In-home isolation&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;64&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-04&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;NA&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Unknown&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Williamson County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Tennessee&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;In-home isolation&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;44&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;65&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-05&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Unknown&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Clark County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Nevada&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;VA Southern Nevada Healthcare System&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;50&#39;s&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;66&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-03-05&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Unknown&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Chicago&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Illinois&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Rush University Medical Center&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;20&#39;s&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr class=&#34;gt_group_heading_row&#34;&gt;
      &lt;td colspan=&#34;10&#34; class=&#34;gt_group_heading&#34;&gt;First 6 rows&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;1&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-01-21&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Recovered&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Wuhan, China&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Snohomish County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Washington&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Providence Regional Medical Center Everett&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;35&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;2&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-01-24&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Recovered&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Wuhan, China&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Chicago&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Illinois&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;St. Alexius Medical Center&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Female&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;60s&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;3&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-01-25&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Recovered&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Wuhan, China&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Orange County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;California&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;In-home isolation&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;50s&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;4&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-01-26&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Confirmed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Wuhan, China&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Los Angeles County&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;California&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Undisclosed&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;5&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-01-26&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Recovered&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Travel-related&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Wuhan, China&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Tempe&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Arizona&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;In-home isolation&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Under 60&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_row gt_left gt_stub&#34;&gt;6&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;2020-01-30&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Recovered&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Person-to-person spread&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Spouse&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Chicago&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Illinois&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;St. Alexius Medical Center&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;Male&lt;/td&gt;
      &lt;td class=&#34;gt_row gt_left&#34;&gt;60s&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;tfoot class=&#34;gt_sourcenotes&#34;&gt;
    &lt;tr&gt;
      &lt;td class=&#34;gt_sourcenote&#34; colspan=&#34;10&#34;&gt;Source: &lt;a href=&#34;https://en.wikipedia.org/w/index.php?title=2020_coronavirus_outbreak_in_the_United_States&amp;amp;oldid=944107102&#34;&gt;wikipedia: 2020 coronavirus outbreak in the United States&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tfoot&gt;
  
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;We’ll won’t bother cleaning all the columns, because we’ll only be using a few of them here.&lt;/p&gt;
&lt;p&gt;OK, so we’ll use the wikipedia data prior to 20th February, but the JHU counts after that, but we’ll use the wikipedia data after 20th February to divide the JHU counts into travel-related or not, more or less. That will give us a data set which distinguishes local from imported cases, at least to the extent of completeness of our data sources. Outbreak epidemiology involves practicing the art of &lt;em&gt;good enough for now&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Let’s visualize each of our two sources, and the combined data set.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/combine_us_data-1.png&#34; width=&#34;768&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;analysis-with-the-earlyr-and-epiestim-packages&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Analysis with the &lt;code&gt;earlyR&lt;/code&gt; and &lt;code&gt;EpiEstim&lt;/code&gt; packages&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&#34;https://www.repidemicsconsortium.org/earlyR/&#34;&gt;&lt;code&gt;earlyR&lt;/code&gt;&lt;/a&gt; package, as its name suggests, is intended for use early in an outbreak to calculate several key statistics. In particular the &lt;code&gt;get_R()&lt;/code&gt; function in &lt;code&gt;earlyR&lt;/code&gt; calculates a maximum-likelihood estimate for the reproduction number, which is the mean number of new cases each infected person give rise to. The &lt;code&gt;overall_infectivity()&lt;/code&gt; function in the &lt;code&gt;EpiEstim&lt;/code&gt; package calculates &lt;span class=&#34;math inline&#34;&gt;\(\lambda\)&lt;/span&gt; (lambda), which is a relative measure of the current “force of infection” or infectivity of an outbreak:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math display&#34;&gt;\[ \lambda = \sum_{s=1}^{t-1} {y_{s} w (t - s)} \]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;where &lt;span class=&#34;math inline&#34;&gt;\(w()\)&lt;/span&gt; is the probability mass function (PMF) of the serial interval, and &lt;span class=&#34;math inline&#34;&gt;\(y_s\)&lt;/span&gt; is the incidence at time &lt;span class=&#34;math inline&#34;&gt;\(s\)&lt;/span&gt;. If &lt;span class=&#34;math inline&#34;&gt;\(\lambda\)&lt;/span&gt; is falling, then that’s good: if not, bad.&lt;/p&gt;
&lt;p&gt;The critical parameter for these calculations is the distribution of &lt;em&gt;serial intervals&lt;/em&gt; (SI), which is the time between the date of onset of symptoms for a case and the dates of onsets for any secondary cases that case gives rise to. Typically a discrete &lt;span class=&#34;math inline&#34;&gt;\(\gamma\)&lt;/span&gt; distribution for these &lt;em&gt;serial intervals&lt;/em&gt; is assumed, parameterised by a mean and standard deviation, although more complex distributions are probably more realistic. See the &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-02-18-analysing-covid-19-2019-ncov-outbreak-data-with-r-part-1/#estimating-changes-in-the-effective-reproduction-number&#34;&gt;previous post&lt;/a&gt; for more detailed discussion of the &lt;em&gt;serial interval&lt;/em&gt;, and the paramount importance of line-listing data from which it can be empirically estimated.&lt;/p&gt;
&lt;p&gt;For now, we’ll just use a discrete &lt;span class=&#34;math inline&#34;&gt;\(\gamma\)&lt;/span&gt; distribution with a mean of 5.0 days and a standard deviation of 3.4 for the &lt;em&gt;serial interval&lt;/em&gt; distribution. That mean is less than estimates published earlier in the outbreak in China, but appears to be closer to the behavior of the COVID-19 virus (based on a personal communication from an informed source who is party to WHO conference calls on COVID-19). Obviously a sensitivity analysis, using different but plausible &lt;em&gt;serial interval&lt;/em&gt; distributions, should be undertaken, but we’ll omit that here for the sake of brevity.&lt;/p&gt;
&lt;p&gt;Note that only local transmission is used to calculate &lt;span class=&#34;math inline&#34;&gt;\(\lambda\)&lt;/span&gt;. If we just use the JHU data, which includes both local and imported cases, our estimates of &lt;span class=&#34;math inline&#34;&gt;\(\lambda\)&lt;/span&gt; would be biased, upwards.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/us_lambda-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;The US is not winning the war against COVID-19, but it is early days yet.&lt;/p&gt;
&lt;p&gt;We can also estimate the &lt;em&gt;reproduction number&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/us_plot_r-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;That estimate of &lt;span class=&#34;math inline&#34;&gt;\(R_{0}\)&lt;/span&gt; is consistent with those reported recently by WHO, although higher than some initial estimates from Wuhan. The key thing is that it is well above 1.0, meaning that the outbreak is growing, rapidly.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;fitting-a-log-linear-model-to-the-epidemic-curve&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Fitting a log-linear model to the &lt;em&gt;epidemic curve&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;We can also use functions in the &lt;strong&gt;RECON&lt;/strong&gt; &lt;code&gt;incidence&lt;/code&gt; package to fit a log-linear model to our epidemic curve. Typically, two models are fitted, one for the growth-phase and one for the decay phase. Functions are provided in the package for finding the peak of the epidemic curve using naïve and optimizing methods. Examples of that can be found &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-03-01-analysing-covid-19-2019-ncov-outbreak-data-with-r-part-2/#modelling-epidemic-trajectory-in-hubei-province-using-log-linear-models&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But for now, the US outbreak is still in growth phase, so we only fit one curve.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;us_incidence_fit &amp;lt;- incidence::fit(local_cases_obj, split = NULL)

# plot the incidence data and the model fit
plot(local_cases_obj) %&amp;gt;% add_incidence_fit(us_incidence_fit)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/us_growth_fit-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;That’s clearly not a good fit, because we are including the handful of very early cases that did not appear to establish sustained chains of local transmission. Let’s exclude them.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/us_growth_refit-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;That’s a much better fit!&lt;/p&gt;
&lt;p&gt;From the that model, we can extract various (very preliminary at this early stage) parameters of interest: the &lt;strong&gt;growth rate is 0.54&lt;/strong&gt; (95% CI 0.32 - 0.77), which is equivalent to a &lt;strong&gt;doubling time of 1.3 days&lt;/strong&gt; (95% CI 0.9 - 2.2 days).&lt;/p&gt;
&lt;p&gt;That’s all a bit alarming, but these estimates are almost certainly biased because cases are being tabulated by their &lt;strong&gt;date of reporting&lt;/strong&gt;, and not by their &lt;strong&gt;date of symptom onset&lt;/strong&gt;. I discussed the extreme importance of health authorities reporting or providing data by &lt;strong&gt;date of onset&lt;/strong&gt; &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-03-01-analysing-covid-19-2019-ncov-outbreak-data-with-r-part-2/#data-limitations&#34;&gt;in an earlier post&lt;/a&gt;. Nonetheless, as the the epidemic in the US spreads, the bias due to use of date of reporting should diminish, provided that testing and reporting of cases occurs swiftly and consistently. The ability to test and report cases promptly is a key indicator of the quality of public health intervention capability.&lt;/p&gt;
&lt;p&gt;We can also project how many cases might be expected in the next week, assuming that public health controls don’t start to have an effect, and subject to the estimation biases discussed above, and bearing it mind our model is fitted to just a few days of data, so far. We’ll plot on a log scale so the observed cases so far aren’t obscured by the predicted values.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/us_growth__refit_predict-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;On a linear scale, that looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/post/2020-03-05-covid-19-epidemiology-with-r/index_files/figure-html/us_growth_refit_predict_linear-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;So, we predict, on very sketchy preliminary data, over 2211 new cases per day by 10 March. That’s probably an overestimate, due to potential reporting-date-not-onset-date bias already discussed, but it nevertheless illustrates the exponential nature of typical epidemic behavior.&lt;/p&gt;
&lt;p&gt;Humans tend to use linear heuristics when contemplating trends, and thus tend to be surprised by such exponential behavior, and fail to plan for it accordingly.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;estimating-the-instantaneous-effective-reproduction-ratio&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Estimating the instantaneous &lt;em&gt;effective reproduction ratio&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;One other statistic which the &lt;code&gt;EpiEstim&lt;/code&gt; package estimates is the instantaneous effective reproduction number, based on an adjustable sliding window. This is very useful for assessing how well public health interventions are working. There isn’t enough US data available, yet, to estimate this, but here is an example of a plot of the instantaneous &lt;span class=&#34;math inline&#34;&gt;\(R_{e}\)&lt;/span&gt; for Hubei province in China, taken from an &lt;a href=&#34;https://timchurches.github.io/blog/posts/2020-02-18-analysing-covid-19-2019-ncov-outbreak-data-with-r-part-1/#estimating-changes-in-the-effective-reproduction-number&#34;&gt;earlier blog post&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://timchurches.github.io/blog/posts/2020-02-18-analysing-covid-19-2019-ncov-outbreak-data-with-r-part-1/analysing-covid-19-2019-ncov-outbreak-data-with-r-part-1_files/figure-html5/Cori_empirical_si_model_fit_hubei_daily-1.png&#34; alt=&#34;Instantaneous effect reproduction number for Hubei province&#34; style=&#34;width:70.0%&#34; /&gt;
You can clearly see the effect of the lock-down implemented in Hubei province and Wuhan city on or around 24th January, and the fact that the instantaneous &lt;span class=&#34;math inline&#34;&gt;\(R_{e}\)&lt;/span&gt; started to fall a long time before the daily incidence of new cases reached its peak. Availability of such information helps governmental authorities to keep their nerve and to persist with unpopular public health measures, even in the face of rising incidence.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;conclusion&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;In this post we have seen how base &lt;code&gt;R&lt;/code&gt;, the &lt;code&gt;tidyverse&lt;/code&gt; packages, and libraries provided by &lt;a href=&#34;https://www.repidemicsconsortium.org&#34;&gt;&lt;strong&gt;R&lt;/strong&gt; &lt;strong&gt;E&lt;/strong&gt;pidemics &lt;strong&gt;Con&lt;/strong&gt;sortium (&lt;strong&gt;RECON&lt;/strong&gt;)&lt;/a&gt; can be used to assemble COVID-19 outbreak data, visualize it, and estimate some key statistics from it which are vital for assessing and planning the public health response to this disease. There are several other libraries for &lt;code&gt;R&lt;/code&gt; than can also be used for such purposes. It should only take a small team of data scientists a few days, using these and related tools, to construct ongoing reports or decision support tools, able to be updated continuously, or at least daily, to help support public health authorities in their (literally) life-and-death fight against COVID-19.&lt;/p&gt;
&lt;p&gt;But you need to start right away: epidemic behavior is exponential.&lt;/p&gt;
&lt;/div&gt;

        &lt;script&gt;window.location.href=&#39;https://rviews.rstudio.com/2020/03/05/covid-19-epidemiology-with-r/&#39;;&lt;/script&gt;
      </description>
    </item>
    
  </channel>
</rss>
