File Exchange

image thumbnail

estimate_R

version 1.1.4 (3.91 MB) by milan batista
MATLAB translation of R function estimate_R for estimates the reproduction number of an epidemic from the package EpiEstim.

13 Downloads

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 <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
https://www.researchgate.net/publication/343345441_estimate_R_examples_verification

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.

Cite As

milan batista (2020). estimate_R (https://www.mathworks.com/matlabcentral/fileexchange/78760-estimate_r), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Angel Suarez

Hi.
How can I add the data from Puerto Rico to run this script???

Thanhs,
Angel

Glen Colby

Nicely done! Results seem to match the original Cori R code quite well. A welcomed addition to File Exchange.

Updates

1.1.4

Update descriotion

1.1.3

Correct calculation of incidence rate

1.1.2

Correct runCountry.m

1.1.1

Update descripion

1.1.0

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

1.0.11

Update description

1.0.10

Change title

1.0.9

add getRes.m with R-calculated results for comparison

1.0.7

add function trimData

1.0.6

Update description

1.0.4

Update description

1.0.3

Add function importDataWM

1.0.2

Update description

1.0.1

update description

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

epiTools_v02b

epiTools_v02b/data

epiTools_v02b/examples

epiTools_v02b/mEpiTools/mEpiData

epiTools_v02b/mEpiTools/mEpiData/@epiData

epiTools_v02b/mEpiTools/mEpiEstim

epiTools_v02b/mEpiTools/mEpiEstim/@estimate_R

epiTools_v02b/verification