MATLAB translation of R function estimate_R for estimates the reproduction number of an epidemic from the package EpiEstim.
Updated 12 Aug 2020

View License

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 <> 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,
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,

For data on serial interval see:
Hiroshi Nishiura, Natalie M Linton, Andrei R. Akhmetzhanov, Serial interval of novel coronavirus (2019-nCoV) infections,
Zhanwei Du et al., Serial Interval of COVID-19 among Publicly Reported Confirmed Cases,
Sheikh Taslim Ali et al. , Serial interval of SARS-CoV-2 was shortened over time by nonpharmaceutical interventions,

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.

Cite As

milan batista (2024). estimate_R (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!









Version Published Release Notes

Update descriotion


Correct calculation of incidence rate


Correct runCountry.m


Update descripion


Add various plot and config options. Add incidence rate to estimate_R class. Add epiData class.


Update description


Change title


add getRes.m with R-calculated results for comparison


add function trimData


Update description


Update description


Add function importDataWM


Update description


update description