plot_infection_history_chains_time: Plot MCMC trace for infections per year

plot_infection_history_chains_timeR Documentation

Plot MCMC trace for infections per year

Description

Plot MCMC trace for infections per year

Usage

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

Arguments

inf_chain

the data table with infection history samples from run_MCMC

burnin

optionally remove all sampno < burnin from the chain

years

vector of integers, if not NULL, only plots a subset of years (where 1 is the first year eg. 1968)

n_alive

if not NULL, then divides number of infections per year by number alive to give attack rates rather than total infections

pad_chain

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

Value

a list of two ggplot objects - the MCMC trace and MCMC densities

See Also

plot_infection_history_chains_indiv

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

Examples

## Not run: 
data(example_inf_chain)
data(example_titre_dat)
data(example_antigenic_map)
times <- example_antigenic_map$inf_times
n_alive_group <- get_n_alive_group(example_titre_dat, strain_isolation_times,melt_dat = TRUE)
n_alive_group$j <- strain_isolation_times[n_alive_group$j]
plot_infection_history_chains_time(example_inf_chain, 0, sample(1:length(times),10),n_alive,FALSE)

## End(Not run)

seroanalytics/serosolver documentation built on April 24, 2023, 9:52 a.m.