## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, output=FALSE------------------------------------------------------
library(serosv)

## -----------------------------------------------------------------------------
hav <- hav_be_1993_1994
model <- fp_model(
  hav,
  p=c(1.5, 1.6), link="cloglog")
plot(model)

## ----warning=FALSE------------------------------------------------------------
rubella <- rubella_uk_1986_1987

farrington_md <- farrington_model(
   rubella,
   start=list(alpha=0.07,beta=0.1,gamma=0.03)
   )
plot(farrington_md)

## -----------------------------------------------------------------------------
hav_mod <- polynomial_model(hav_bg_1964, k=3)

# customize plot
plot(hav_mod) +
  set_plot_style(
    sero = "#3de071",
    foi = "#2f22e0",
    ci = "#aaf2b2",
    foi_line = "dotted", 
    sero_line = "dotdash"
  )

## -----------------------------------------------------------------------------
# return gg object
class(plot(hav_mod))

## ----warning=FALSE------------------------------------------------------------
library(ggplot2)

# Set x and y limits
plot(hav_mod) +
  coord_cartesian(xlim = c(0, 50), ylim = c(0, 1.5))

# Configure the plot theme
plot(hav_mod) +
  theme_bw()

# Set titles and omit legends
plot(hav_mod) +
  theme_bw() +
  ggtitle("Age-stratified Hepatitis A prevalence in Bulgaria (1964)") +
  guides(
    colour = "none",
    linetype = "none",
    fill = "none"
  )

