Given outputs from an MCMC run and the data used for fitting, generates an NxM matrix of plots where N is the number of individuals to be plotted and M is the range of sampling times. Where data are available, plots the observed titres and model predicted trajectories

plot_infection_histories(
chain,
infection_histories,
titre_dat,
individuals,
antigenic_map = NULL,
strain_isolation_times = NULL,
par_tab,
nsamp = 100,
mu_indices = NULL,
measurement_indices_by_time = NULL
)

## Arguments

chain the full MCMC chain to generate titre trajectories from the MCMC chain for infection histories the data frame of titre data the subset of individuals to generate credible intervals for (optional) a data frame of antigenic x and y coordinates. Must have column names: x_coord; y_coord; inf_times. See example_antigenic_map (optional) if no antigenic map is specified, this argument gives the vector of times at which individuals can be infected the table controlling the parameters in the MCMC chain number of samples to take from posterior vector of integers. for random effects on boosting parameter, mu. If random mus are included in the parameter table, this vector specifies which mu to use for each circulation year. For example, if years 1970-1976 have unique boosting, then mu_indices should be c(1,2,3,4,5,6). If every 3 year block shares has a unique boosting parameter, then this should be c(1,1,1,2,2,2) default NULL, optional vector giving the index of measurement_bias that each strain uses the measurement shift from from. eg. if there's 6 circulation years and 3 strain clusters

## Value

a ggplot2 object

Other infection_history_plots: calculate_infection_history_statistics(), generate_cumulative_inf_plots(), plot_data(), plot_infection_history_chains_indiv(), plot_infection_history_chains_time(), plot_number_infections(), plot_posteriors_infhist(), plot_total_number_infections()

## Examples

if (FALSE) {
data(example_theta_chain)
data(example_inf_chain)
data(example_titre_dat)
data(example_antigenic_map)
data(example_par_tab)

model_fit_plot <- plot_infection_histories(example_theta_chain, example_inf_chain, example_titre_dat,
1:10, example_antigenic_map, example_par_tab)
}