Remove all objects from workspace.
remove (list = objects () )
Load add-on packages - R0 - contains different methods to estimate reproduction number.
library (R0)
## Loading required package: MASS
#Question 1a
contact_rate = 10
transmission_probability = 0.06
infectious_period = 4
R0 = contact_rate * transmission_probability * infectious_period
c ("R0 = ", R0)
## [1] "R0 = " "2.4"
#Question 1b
contact_rate = 8
transmission_probability = 0.15
infectious_period = 6
R0 = contact_rate * transmission_probability * infectious_period
c ("R0 = ", R0)
## [1] "R0 = " "7.2"
#Attack rate = 30%
attack_rate = 0.3
est.R0.AR (AR = attack_rate)
## Reproduction number estimate using Attack Rate method.
## R : 1.188916
#Attack rate = 40%
attack_rate = 0.4
est.R0.AR (AR = attack_rate)
## Reproduction number estimate using Attack Rate method.
## R : 1.277064
#Attack rate = 55%
attack_rate = 0.55
est.R0.AR (AR = attack_rate)
## Reproduction number estimate using Attack Rate method.
## R : 1.451832
#Attack rate = 80%
attack_rate = 0.8
est.R0.AR (AR = attack_rate)
## Reproduction number estimate using Attack Rate method.
## R : 2.011797
#Question 3a
average_age = 10
life_expectancy = 65
R0 = life_expectancy / average_age
c ("R0 = ", R0)
## [1] "R0 = " "6.5"
#Question 3b
average_age = 5
life_expectancy = 70
R0 = life_expectancy / average_age
c ("R0 = ", R0)
## [1] "R0 = " "14"
Remove all objects from workspace.
remove (list = objects () )
Load add-on packages - R0 - contains different methods to estimate reproduction number.
library (R0)
Estimate R0 using contact rate, transmission probability, and infectious period
contact_rate = 5
transmission_probability = 0.15
infectious_period = 6
R0 = contact_rate * transmission_probability * infectious_period
c ("R0 = ", R0)
## [1] "R0 = " "4.5"
Estimate R0 using attack rate.
attack_rate = 0.6
R0 = (- log (1 - attack_rate)) / attack_rate
c ("R0 = ", R0)
## [1] "R0 = " "1.52715121979026"
Estimate R0 using attack rate.
attack_rate = 0.6
est.R0.AR (AR = attack_rate)
## Reproduction number estimate using Attack Rate method.
## R : 1.527151
Average age of infection for chicken pox was 6.7 in Maryland during 1913-1917, and life expectancy was 60 years.
average_age = 6.7
life_expectancy = 60
R0 = life_expectancy / average_age
c ("R0 = ", R0)
## [1] "R0 = " "8.95522388059701"
Estimate R0 using exponential growth rate for the 1918 influenza pandemic in Germany, using the data from the paper by Nishiura for key transmission parameters of an institutional outbreak during the 1918 influenza pandemic in Germany.
data (Germany.1918)
#plot epidemic
plot (Germany.1918, xlab = "Time")
#plot log of epidemic curve
plot (log (Germany.1918), xlab='Time')
#generation time distribution
mGT = generation.time ("gamma", c(3, 1.5))
#estimate R0 using exponential growth method using start date of first day and end date of 30 days.
#Question 4
est.R0.EG (Germany.1918, mGT, begin=1, end=30)
## Waiting for profiling to be done...
## Reproduction number estimate using Exponential Growth method.
## R : 1.43944[ 1.416545 , 1.462916 ]
#estimate R0 using maximum likelihood method
#Question 5
mGT = generation.time("gamma", c(2.45, 1.38))
est.R0.ML (Germany.1918, mGT)
## Reproduction number estimate using Maximum Likelihood method.
## R : 1.205348[ 1.152364 , 1.259946 ]