Skip to contents

Reproduction number timeseries diagram

Usage

plot_rt(
  modelled = i_reproduction_number,
  ...,
  mapping = .check_for_aes(modelled, ...),
  events = i_events
)

Arguments

modelled

the modelled Rt estimate - a dataframe with columns:

  • time (ggoutbreak::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 (positive_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

Any grouping allowed.

...

Named arguments passed on to geom_events

events

Significant events or time spans - a dataframe with 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

Any grouping allowed.

A default value is defined.

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 with 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

Any grouping allowed.

A default value is defined.

Value

a ggplot timeseries

Examples

# example code
if (interactive()) {

  tmp2 = england_covid_poisson %>%
    rt_from_incidence()

  # comparing RT from growth rates with England consensus Rt
  # (N.B. offset by 17 days to align with estimates):

  plot_rt(tmp2,colour="blue")+
    ggplot2::geom_errorbar(
      data=england_consensus_rt,
      mapping=ggplot2::aes(x=date-17,ymin=low,ymax=high),
      colour="red")

}