Plots the MCMC trace and posterior density of inferred infections for selected exposure times.

plot_infection_history_chains_time(
  inf_chain,
  burnin = 0,
  times = NULL,
  n_alive = NULL,
  pad_chain = TRUE
)

Arguments

inf_chain

the infection-history chain returned by load_mcmc_chains, in long format

burnin

if not already discarded, discards rows with `samp_no <= burnin`

times

optional vector of `j` indices identifying the exposure times to plot

n_alive

optional data frame containing `j` and `n_alive`. If supplied, infection counts are divided by the number alive to show attack rates.

pad_chain

if TRUE, adds zero-valued entries for infection events that are absent from the sparse chain

Value

A list containing the MCMC trace plot and posterior density plot.

Examples

if (FALSE) { # \dontrun{
data(example_inf_chain)
data(example_antibody_data)
data(example_antigenic_map)
times <- example_antigenic_map$inf_times
n_alive_group <- get_n_alive_group(example_antibody_data, times,melt_data = TRUE)
n_alive_group$j <- times[n_alive_group$j]
plot_infection_history_chains_time(example_inf_chain, 0, sample(seq_along(times),10),n_alive_group,FALSE)
} # }