Compute "Rt" using EpiEtim for a set of simulated trajectories (e.g., the result of the $iterate() method of lancelot, mcstate::pmcmc() or mcstate::pmcmc_predict(). The trajectories should share parameters.

lancelot_rt_trajectories_epiestim(
  step,
  incidence,
  p,
  gt_distr = NULL,
  sliding_window_ndays = 7,
  mean_prior = 1,
  sd_prior = 1,
  n_GT = 10000,
  n_R = 1000,
  save_all_Rt_sample = TRUE,
  q = NULL
)

Arguments

step

A vector of steps

incidence

A matrix (n trajectories x n steps) of incidence counts

p

A single lancelot_parameters() object.

gt_distr

A vector giving the discrete (daily) distribution of the generation time. The first value must be zero. If NULL, the generation time distribution will be determined automatically from p.

sliding_window_ndays

An integer giving the length of the sliding window on which Rt will be estimated

mean_prior

The mean prior for Rt

sd_prior

The standard deviation of the prior for Rt

n_GT

An integer giving the number of generation times to be drawn to construct the discrete distribution of the generation time

n_R

An integer giving the number of Rt values to sample from for each incidence trajectory. These will then be aggregated across all incidence trajectories.

save_all_Rt_sample

A boolean determining whether to save all samples of Rt estimated or only a summary

q

A vector of quantiles to return values for

Value

A list with elements t_start (vector of first days of the sliding windows over which Rt is estimated), t_end (vector of last days of the sliding windows over which Rt is estimated), Rt a matrix (only present if save_all = TRUE) containing for each sliding window (each col in the matrix) a sample of n_R * nrow(inc) values of Rt for that sliding window (rows of the matrix) Rt_summary a matrix containing for each sliding window (each col in the matrix) the quantiles (q) and the mean of Rt for that sliding window (rows of the matrix) gt_distr a vector giving the discrete (daily) distribution of the generation time