plot_attack_rates_pointrange: Plot historical attack rates with pointrange plots

plot_attack_rates_pointrangeR Documentation

Plot historical attack rates with pointrange plots

Description

Plots inferred historical attack rates from the MCMC output on infection histories, with pointrange plots for per-time incidence estimates

Usage

plot_attack_rates_pointrange(
  infection_histories,
  antibody_data = NULL,
  possible_exposure_times = NULL,
  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,
  min_time = min(possible_exposure_times),
  max_time = max(possible_exposure_times),
  settings = NULL
)

Arguments

infection_histories

the MCMC chain for infection histories

antibody_data

the data frame of antibody data

possible_exposure_times

vector of the epochs of potential infection

n_alive

vector with the number of people alive in each year of possible infection Can be left as NULL, and the 'birth' variable in 'antibody_data' will be used to calculate the number alive

pointsize

graphics option, numeric - how big should each point be?

fatten

graphics option, 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 infection_model_prior_shape1 and infection_model_prior_shape2

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 'time' matching 'possible_exposure_times', and second column 'AR' giving the attack rate. Column names: population_group, time, AR

by_group

if TRUE, facets the plot by population_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 antigen at that time were measured

by_val

frequency of x-axis labels

resolution

divides 'possible_exposure_times' by this number for x axis labels

Value

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


adamkucharski/serosolver documentation built on April 28, 2024, 6:19 p.m.