This function takes the trajectory samples of cumulative infections from an EpiFusion posterior object and performs a row-wise 'diff' to find the mean and HPD interval for new daily infections.

calculate_daily_infections(
  cumulative_infection_samples,
  index_date = NA,
  include_median = FALSE
)

Arguments

cumulative_infection_samples

the samples of cumulative infection trajectories from an Epifusion posterior object (generated using the extract_posterior_epifusion() function with include_samples set to TRUE)

index_date

(optional) date you'd like the time series to count from, as a date object or as a string with format YYYY-MM-DD

include_median

(default FALSE) set to TRUE if you would like the median trajectory to be included in the output table

Value

a table with a column for Time and a column for Mean, Upper and Lower 95%, 88% and 66% HPDs for inferred Infections and Rt