Plots measured antibody measurements and known infection histories for all individuals, faceted by sample time (multi-antigen panel) or biomarker_id variable (longitudinal single antigen)

plot_antibody_data(
  antibody_data,
  possible_exposure_times,
  n_indivs,
  infection_histories = NULL,
  study_design = "cross-sectional",
  measurement_ranges = NULL
)

Arguments

antibody_data

the data frame of antibody data

possible_exposure_times

the vector of times at which individuals could be infected

n_indivs

either the number of individuals to sample at random, or a vector of individual IDs to plot

infection_histories

optional infection-history matrix with rows in the same individual order as `antibody_data`

study_design

default "cross-sectional" facets by sample time. "longitudinal" gives sample time on the x-axis and colours by `biomarker_id`

measurement_ranges

data frame or tibble stating for each `biomarker_group` the `min_measurement` and `max_measurement`. If NULL, this is extracted from `antibody_data`

Value

A ggplot object showing the antibody measurements and, when supplied, known infection times.

Examples

if (FALSE) { # \dontrun{
data(example_antibody_data)
data(example_inf_hist)
data(example_antigenic_map)
possible_exposure_times <- example_antigenic_map$inf_times
plot_antibody_data(example_antibody_data, possible_exposure_times, 5, example_inf_hist)
} # }