seroprevalence.fit: Plot the fit of the seroprevalence vs. age

View source: R/plot_seropositive.R

seroprevalence.fitR Documentation

Plot the fit of the seroprevalence vs. age

Description

Plot the mean and credible interval of the posterior of the seroprevalence, given an object of the class FOIfit. See function seroprevalence for plotting the seroprevalence from the data. The function returns graphical objects that can be further modified.

Usage

seroprevalence.fit(
  FOIfit,
  individual_samples = 0,
  age_class = 10,
  YLIM = 1,
  ...
)

Arguments

FOIfit

The FOIfit object to be plotted.

individual_samples

Integer. Number of individual samples to be plotted additionally to the mean and the credible interval of the force of infection. The indivual_samples samples are randomly chosen in the chains. Default = 0.

age_class

Integer. Length of the age groups (in years). Used if show_data = TRUE. Default = 10.

YLIM

Upper limit of the y-axis. Default = 1. The lower limit is set to 0.

show_data

Boolean. If TRUE, shows the fraction of seropositive as well. By default, ages are associated in groups of age_class years. Default = TRUE.

Value

A list of ggplot2 objects.

Author(s)

Nathanael Hoze nathanael.hoze@gmail.com

Examples

data <- simulate_SeroData( max_age = 50, epidemic_years = c(1976,1992), foi = c(0.2,0.3))
model <- FOImodel(type='outbreak', background=TRUE, K = 2)

Fit <- fit(model = model, data = data)

# plot the fraction of seropositive, with 2 individual samples
p <- seroprevalence.fit(Fit,  individual_samples = 2,YLIM=0.2)



nathoze/Rsero documentation built on Dec. 1, 2024, 6:39 p.m.