Plots inferred historical attack rates from the MCMC output on infection histories

plot_attack_rates(
  infection_histories,
  titre_dat,
  strain_isolation_times,
  n_alive = NULL,
  pointsize = 1,
  fatten = 1,
  pad_chain = TRUE,
  prior_pars = NULL,
  plot_den = FALSE,
  true_ar = NULL,
  by_group = FALSE,
  group_subset = NULL,
  plot_residuals = FALSE,
  colour_by_taken = TRUE,
  by_val = 5
)

Arguments

infection_histories

the MCMC chain for infection histories

titre_dat

the data frame of titre data

strain_isolation_times

vector of the epochs of potential circulation

n_alive

vector with the number of people alive in each year of circulation. Can be left as NULL, and ages will be used to infer this

pointsize

Numeric - how big should each point be?

fatten

Numeric - fatten parameter for ggplot pointrange

pad_chain

if TRUE, fills the infection history data table with entries for non-infection events (ie. 0s). Can be switched to FALSE for speed to get a rough idea of what the attack rates look like.

prior_pars

if not NULL, a list of parameters for the attack rate prior, giving the assumed prior_version along with alpha and beta

plot_den

if TRUE, produces a violin plot of attack rates rather than pointrange

true_ar

data frame of true attack rates, with first column `year` equal to `strain_isolation_times`, and second column `AR` giving the attack rate. Column names: group, j, AR

by_group

if TRUE, facets the plot by group ID

group_subset

if not NULL, plots only this subset of groups eg. 1:5

plot_residuals

if TRUE, plots the residuals between inferred and true attack rate

colour_by_taken

if TRUE, then colours the attack rates by whether or not titres against the circulating virus at that time were measured

by_val

frequency of x-axis labels

resolution

divides strain isolation times by this number for x axis labels

Value

a ggplot2 object with the inferred attack rates for each potential epoch of circulation