Generate a growth timeseries simulation based on a small set of fixed time points.

generateGrowthRate(
  name,
  dateAtTime0 = "2020-01-01",
  length = 365,
  breaks = sort(c(0, sample(0:364, 4))),
  rates = alternatingRandom(),
  smooth = TRUE,
  sawtooth = FALSE,
  Gt.mean = 5,
  Gt.sd = 4,
  ...
)

Arguments

name

- a meaningful name for this growth rate scenario

dateAtTime0

- the date at time zero

length

- how many days in the scenario

breaks

- time points (between 0 and length) when the growth rate is at a set value.

rates

- the values of the growth rate at the time points up to and including the break points, optionally an additional point for the period to the end of the time-series

smooth

- should the rates be interpolated with a spline. If so it may be a good ideal to specify the growth rate at zero.

sawtooth

- if the rates are not smooth should they be a step function or a saw-tooth linear function.

Gt.mean

- mean of the generation time for conversion to R_t

Gt.sd

- sd of the generation time for conversion to R_t

...

- ignored

Value

- a list containing name - the scenario name, ts - a tibble with the date, generated growth rate and R_t values, events - the time-points of the period, infectivityProfile - an infectivity_profile