Plot method for summary.seroincidence.by objects

Description

Plot method for summary.seroincidence.by objects

Usage

## S3 method for class 'summary.seroincidence.by'
autoplot(object, type, ...)

Arguments

object a summary.seroincidence.by object (generated by applying the summary() method to the output of est_seroincidence_by()).
type

character string indicating which type of plot to generate. The implemented options are:

Arguments passed on to strat_ests_scatterplot, strat_ests_barplot

xvar
the name of a stratifying variable in object
alpha
transparency for the points in the graph (1 = no transparency, 0 = fully transparent)
shape
shape argument for geom_point()
dodge_width
width for jitter
CIs
logical, if TRUE, add CI error bars
color_var
character which variable in object to use to determine point color
group_var
character which variable in object to use to connect points with lines (NULL for no lines)
yvar
the name of a stratifying variable in object.
title
a title for the final plot.
xlab
a label for the x-axis of the final plot.
ylab
a label for the y-axis of the final plot.
fill_lab
fill label.
color_palette
optional color palette for bar color.

Value

a ggplot2::ggplot() object

Examples

Code
library("serocalculator")


library(dplyr)
library(ggplot2)

xs_data <-
  sees_pop_data_pk_100

curve <-
  typhoid_curves_nostrat_100 %>%
  filter(antigen_iso %in% c("HlyE_IgA", "HlyE_IgG"))

noise <-
  example_noise_params_pk

est2 <- est_seroincidence_by(
  strata = c("catchment", "ageCat"),
  pop_data = xs_data,
  sr_params = curve,
  noise_params = noise,
  curve_strata_varnames= NULL,
  noise_strata_varnames = NULL,
  antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
  num_cores = 2 # Allow for parallel processing to decrease run time
)

est2sum <- summary(est2)

est2sum |> autoplot(
    type ="scatter",
    xvar = "ageCat",
    color_var = "catchment",
    CIs = TRUE,
    group_var = "catchment")

Code
est2sum |> autoplot(
    type = "bar",
    yvar = "ageCat",
    color_var = "catchment",
    CIs = TRUE)