Finds the total number of infections for each iteration of an MCMC chain

get_total_number_infections(inf_chain, pad_chain = TRUE)

Arguments

inf_chain

data table containing the infection-history chain, with `samp_no`, `chain_no`, `i`, `j`, and `x` columns.

pad_chain

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

Value

a data table with `chain_no`, `samp_no`, and the total number of infections for each MCMC sample

Examples

if (FALSE) { # \dontrun{
inf_chain <- load_infection_chains(thin=10,burnin=5000,chain_subset=1:3)
n_infs <- get_total_number_infections(inf_chain$chain, pad_chain=FALSE)
} # }