Updated 12 Aug 2020
estimate_R calculates the reproduction number of an epidemics. It is MATLAB translation of R function estimate_R from package EpiEstim, ver 2.2-3. In the translation, the original structure of the functions and their names was preserved as far as possible, so that the EpiEstim reference manual can be used (A.Cori et al., Package EpiEstim)
Three methods are currently supported: 'parametric_si', 'non-parametric_si' and 'uncertain_si'.
The following are user functions:
runCountry.m run estimation for selected country and plot results.
runEU.m scan EU countries, produce a plot for EU and write R, IR and AR to EU_DDMMYYYY.csv file.
runWorld.m scan complete data set stored in the 'data' folder
Data for various countries can be obtained by running the function importDataWM.m. This function will read data from the <worldometers.info> website and store them to folder 'data'.
Function importData(country,start_date) colect data for specified country and store them into 'epiData' object, which can be use as input to estimate_R. Examples:
slo = importData('Slovenia',);
res = estimate_R(slo,___)
slo = importData('Slovenia',[2020,6,1]);
res = estimate_R(slo,___)
NOTE 1: Double-quoted strings in R must be changed to a MATLAB column. For example: "parametric_si" should be used as "parammetric_si.
NOTE2: Some new options have been added to the chart function (for details see folder @estimate_R / plot.m). In particular options for incidence, R, and serial interval plot are controlled by options class. Some new properties are added: plot_type, title, extend_title. Plot types for incidence plot and serial interval plot include 'line', 'bar', 'stairs','scatter', and for SI plot also 'area'.
NOTE 3: Option wind_len is added to make_config function to set sliding window size (see make_config.m)
NOTE4: Incidence rate (obj.IR) and attack rate (obj.AR) are calculated if user provide population. IR can then be add to the plot with plot with plot(__,'what',['IR',...],...)
NOTE 5. Verification of the program is available at
For a detailed description of the algorithms see:
Anne Cori, Neil M. Ferguson, Christophe Fraser, Simon Cauchemez , A New Framework and Software to Estimate Time-Varying Reproduction Numbers During Epidemics, American Journal of Epidemiology, Volume 178, Issue 9, 1 November 2013, Pages 1505–1512, https://doi.org/10.1093/aje/kwt133
R.N. Thompson, J.E. Stockwin, R.D. van Gaalen, J.A. Polonsky, Z.N. Kamvar, P.A. Demarsh, E. Dahlqwist, S. Li, E. Miguel, T. Jombart, J. Lessler, S. Cauchemez, A. Cori, Improved inference of time-varying reproduction numbers during infectious disease outbreaks, Epidemics, Volume 29, 2019, https://doi.org/10.1016/j.epidem.2019.100356.
For data on serial interval see:
Hiroshi Nishiura, Natalie M Linton, Andrei R. Akhmetzhanov, Serial interval of novel coronavirus (2019-nCoV) infections, https://www.medrxiv.org/content/10.1101/2020.02.03.20019497v2
Zhanwei Du et al., Serial Interval of COVID-19 among Publicly Reported Confirmed Cases,https://wwwnc.cdc.gov/eid/article/26/6/20-0357_article
Sheikh Taslim Ali et al. , Serial interval of SARS-CoV-2 was shortened over time by nonpharmaceutical interventions, https://science.sciencemag.org/content/early/2020/07/20/science.abc9004
DISCLAIMER: Software and data is for education and not for medical or commercial use. They are provided as-is, and any express or implied warranties, including but not limited to implied warranties of merchantability and fitness for a particular purpose, are disclaimed. Use it at your own discretion.
milan batista (2023). estimate_R (https://www.mathworks.com/matlabcentral/fileexchange/78760-estimate_r), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Correct calculation of incidence rate
Add various plot and config options. Add incidence rate to estimate_R class. Add epiData class.
add getRes.m with R-calculated results for comparison
add function trimData
Add function importDataWM