plot_cumulative_infection_histories: Plot cumulative and per time posterior infection probability...

plot_cumulative_infection_historiesR Documentation

Plot cumulative and per time posterior infection probability densities

Description

For each individual requested, plots the median and 95

Usage

plot_cumulative_infection_histories(
  inf_chain,
  burnin = 0,
  indivs,
  real_inf_hist = NULL,
  start_inf = NULL,
  possible_exposure_times,
  nsamp = 100,
  ages = NULL,
  number_col = 1,
  pad_chain = TRUE,
  subset_times = 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

possible_exposure_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_times

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

return_data

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

Value

two ggplot objects

See Also

Other infection_history_plots: calculate_infection_history_statistics(), plot_antibody_data(), plot_individual_number_infections(), plot_infection_history_chains_indiv(), plot_infection_history_chains_time(), plot_model_fits(), plot_posteriors_infhist(), plot_total_number_infections()

Examples

## Not run: 
data(example_inf_chain)
data(example_antigenic_map)
data(example_inf_hist)
data(example_antibody_data)

ages <- unique(example_antibody_data[,c("individual","birth")])
times <- example_antigenic_map$inf_times
indivs <- 1:10
plot_cumulative_infection_histories(example_inf_chain, 0, indivs, example_inf_hist, NULL, times,
                              ages=ages, number_col=2,pad_chain=FALSE, return_data=TRUE)

## End(Not run)

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