R/plot_attack_rates.R
plot_attack_rates.RdPlots inferred historical attack rates from the MCMC output on infection histories, with pointrange plots for per-time incidence estimates
plot_attack_rates(
infection_histories,
antibody_data = NULL,
demographics = NULL,
par_tab = NULL,
possible_exposure_times = NULL,
n_alive = NULL,
pointsize = 1,
fatten = 1,
pad_chain = FALSE,
prior_pars = NULL,
plot_den = FALSE,
plot_ribbon = FALSE,
true_ar = NULL,
by_group = FALSE,
group_subset = NULL,
plot_residuals = FALSE,
colour_by_taken = TRUE,
by_val = 5,
min_time = min(possible_exposure_times),
max_time = max(possible_exposure_times),
settings = NULL,
verbose = FALSE
)the MCMC chain for infection histories
the data frame of antibody data
optional demographic data used to assign population groups
the model control table used when demographic groups are present
vector of the epochs of potential infection
optional number-alive data. If NULL, the number alive is calculated from `antibody_data` and `birth`.
graphics option controlling point size
graphics option controlling the width of pointrange end caps
if TRUE, fills the infection-history data table with entries for non-infection events (0s). Set to FALSE for a faster, approximate plot.
if not NULL, a list of parameters for the attack rate prior, giving the assumed prior_version along with infection_model_prior_shape1 and infection_model_prior_shape2
if TRUE, produces a violin plot of attack rates rather than pointrange
if TRUE, plots a ribbon over time for the attack rate estimates, otherwise plots a pointrange plot
data frame of true attack rates with columns `population_group`, `time`, and `AR`; `time` should match `possible_exposure_times`
if TRUE, facets the plot by population_group ID
if not NULL, plots only this subset of groups eg. 1:5
if TRUE, plots the residuals between inferred and true attack rate
if TRUE, then colours the attack rates by whether or not titres against the circulating antigen at that time were measured
frequency of x-axis labels
minimum time shown on the x-axis
maximum time shown on the x-axis
if not NULL, list of serosolver settings as returned from the main serosolver function, such as `res$settings`
if TRUE, prints messages when settings are used
A ggplot2 object showing inferred attack rates for each potential infection time, either as pointranges, ribbons, or density plots depending on the plotting options.