Rt: Computes the effective reproductive number using alternative...

View source: R/Rt_functions.R

RtR Documentation

Computes the effective reproductive number using alternative distributions for the generation interval.

Description

Calculates the effective reproductive number from the growth rate of cases. Uses formula 4.2 in Wallinga and Lispitch (2007). Confidence interval assume ratio between two Poissons (see Luis Max documentation).

Usage

Rt(
  obj,
  count = "casos",
  gtdist,
  meangt,
  sdgt,
  CI = "beta",
  alpha = 0.95,
  a0 = 2,
  b0 = 3
)

Arguments

meangt

if gtdist = "delta" it is the exact period between primary and secondary infections). If gtdist = "normal", it is the mean generation time.

sdgt

if gtdist = "normal", it is the standard deviation of the generation time distribution.

CI

Model used to compute the confidence interval. Possible choice: "beta".

object

a data.frame with variables "casos" and "SE", ideally from getCases().

Value

data.frame with estimated Rt and confidence intervals.

Examples

d <- getCases(cities = 3302205, lastday ="2018-03-10") # dengue
# Rt original
rt<-Rtoriginal(obj = d, count = "casos", meangt=3)
plot(rt$Rt, type="l", xlab = "weeks", ylab = "Rt")
lines(rt$lwr,lty=3); lines(rt$upr,lty=3)
abline(h = 1, col = 2)
# Rt delta and normal
rtdelta<-Rt(obj = d, count = "casos", gtdist="delta", meangt=3)
rtnorm<-Rt(obj = d, count = "casos", gtdist="normal", meangt=3, sdgt = 1)
lines(rtdelta$Rt, col = 3)
lines(rtdelta$lwr,lty = 3, col = 3)
lines(rtdelta$upr,lty = 3, col = 3)
lines(rtnorm$Rt, col = 4)
lines(rtnorm$lwr,lty = 3, col = 4)
lines(rtnorm$upr,lty = 3, col = 4)
legend(30,3,c("original","delta","normal"),lty=1, col = c(1,3,4), cex = 0.7)

AlertaDengue/AlertTools documentation built on Nov. 27, 2024, 11:55 p.m.