Skip to contents

Reproduction number timeseries diagram

Usage

plot_rt(
  modelled = i_reproduction_number,
  ...,
  mapping = if (interfacer::is_col_present(modelled, class)) ggplot2::aes(colour = class)
    else ggplot2::aes(),
  events = i_events
)

Arguments

modelled

the modelled Rt estimate

A dataframe containing the following columns:

  • time (as.time_period + group_unique) - A (usually complete) set of singular observations per unit time as a `time_period`

  • rt.fit (double) - an estimate of the reproduction number

  • rt.se.fit (double) - the standard error of the reproduction number

  • rt.0.025 (double) - lower confidence limit of the reproduction number

  • rt.0.5 (double) - median estimate of the reproduction number

  • rt.0.975 (double) - upper confidence limit of the reproduction number

No mandatory groupings.

No default value.

...

Arguments passed on to geom_events

mapping

a ggplot2::aes mapping. Most importantly setting the colour to something if there are multiple incidence time series in the plot

events

Significant events or time spans

A dataframe containing the following columns:

  • label (character) - the event label

  • start (date) - the start date, or the date of the event

  • end (date) - the end date or NA if a single event

No mandatory groupings.

A default value is defined.

Value

a ggplot timeseries

Examples

# example code
tmp = growthrates::england_covid %>%
  time_aggregate(count=sum(count))
if (FALSE) {

  tmp2 = tmp %>%
    poisson_locfit_model() %>%
    rt_from_growth_rate()

  # comparing RT from growth rates with England consensus Rt:
  plot_rt(tmp2,colour="blue")+
    geom_errorbar(data=england_consensus_rt, mapping=aes(x=date-21,ymin=low,ymax=high),colour="red")

}