For each individual requested, plots the median and 95

generate_cumulative_inf_plots(
  inf_chain,
  burnin = 0,
  indivs,
  real_inf_hist = NULL,
  start_inf = NULL,
  strain_isolation_times,
  nsamp = 100,
  ages = NULL,
  number_col = 1,
  pad_chain = TRUE,
  subset_years = NULL,
  return_data = FALSE
)

Arguments

inf_chain

the infection history chain

burnin

only plot samples where samp_no > burnin

indivs

vector of individual ids to plot

real_inf_hist

if not NULL, adds lines to the plots showing the known true infection times

start_inf

if not NULL, adds lines to show where the MCMC chain started

strain_isolation_times

vector of times at which individuals could have been infected

nsamp

how many samples from the MCMC chain to take?

ages

if not NULL, adds lines to show when an individual was born

number_col

how many columns to use for the cumulative infection history plot

pad_chain

if TRUE, pads the infection history MCMC chain to have entries for non-infection events

subset_years

if not NULL, pass a vector of indices to only take a subset of indices from strain_isolation_times

return_data

if TRUE, returns the infection history posterior densities used to generate the plots

Value

two ggplot objects

See also

Examples

if (FALSE) { data(example_inf_chain) data(example_antigenic_map) data(example_inf_hist) data(example_titre_dat) ages <- unique(example_titre_dat[,c("individual","DOB")]) times <- example_antigenic_map$inf_times indivs <- 1:10 generate_cumulative_inf_plots(example_inf_chain, 0, indivs, example_inf_hist, NULL, times, ages=ages, number_col=2,pad_chain=FALSE, return_data=TRUE) }