a data.frame() containing MCMC samples of antibody decay curve parameters
antigen_isos
antigen isotypes to analyze (can subset object)
verbose
verbose output
quantiles
Optional numeric vector of point-wise (over time) quantiles to plot (e.g., 10%, 50%, and 90% = c(0.1, 0.5, 0.9)). If NULL, no quantile lines are shown.
alpha_samples
alpha parameter passed to ggplot2::geom_line (has no effect if iters_to_graph is empty)
chain_color
logical: if TRUE (default), MCMC chain lines are colored by chain. If FALSE, all MCMC chain lines are black.
log_x
should the x-axis be on a logarithmic scale (TRUE) or linear scale (FALSE, default)?
log_y
should the Y-axis be on a logarithmic scale (default, TRUE) or linear scale (FALSE)?
n_curves
how many curves to plot (see details).
iters_to_graph
which MCMC iterations in curve_params to plot (overrides n_curves).
…
not currently used
Details
Fixed … arguments
The arguments fun, n, and args are set internally and cannot be overridden via …. Passing them will trigger an informative error.
n_curves and iters_to_graph
In most cases, object will contain too many rows of MCMC samples for all of these samples to be plotted at once.
Setting the n_curves argument to a value smaller than the number of rows in curve_params will cause this function to select the first n_curves rows to graph.
Setting n_curves larger than the number of rows in ’ will result all curves being plotted.
If the user directly specifies the iters_to_graph argument, then n_curves has no effect.
Value
a ggplot2::ggplot() object showing the antibody dynamic kinetics of selected antigen/isotype combinations, with optional posterior distribution quantile curves.
Examples
Code
library("serocalculator")# Load example datasetcurve<-typhoid_curves_nostrat_100|>dplyr::filter(antigen_iso%in%c("HlyE_IgA", "HlyE_IgG"))# Plot quantiles without showing all curvesplot1<-graph.curve.params(curve, n_curves =0)print(plot1)
Code
# Plot with additional quantiles and show all curvesplot2<-graph.curve.params(curve, n_curves =Inf, quantiles =c(0.1, 0.5, 0.9))print(plot2)
Code
# Plot with MCMC chains in blackplot3<-graph.curve.params(curve, n_curves =Inf, quantiles =c(0.1, 0.5, 0.9), chain_color =FALSE)print(plot3)