Perform a convolution given a pdf

Usage,
epi_convolve(cases, pdf, direction = "forward")

Arguments

cases

numeric, the observed cases

pdf

numeric vector, the pdf of cases

direction

string, one of forward or backwards convolution

Examples

{
  
true_cases <- rpois(100, 5)
out <- data.frame(reported = ceiling(epi_convolve(true_cases, pdf = c(.2,.2,.3,.2,.1))),
true_cases,
date = 1:100
)

library(ggplot2)
ggplot(out, aes(date))+
  geom_line(aes(y = true_cases))+
  geom_line(aes(y = reported), color = "blue")
}