Skip to contents

Calculate seroincidence from output of the seroincidence calculator est.incidence.by().

Usage

# S3 method for class 'seroincidence.by'
summary(
  object,
  confidence_level = 0.95,
  showDeviance = TRUE,
  showConvergence = TRUE,
  ...
)

Arguments

object

A dataframe containing output of function est.incidence.by().

confidence_level

desired confidence interval coverage probability

showDeviance

Logical flag (FALSE/TRUE) for reporting deviance (-2*log(likelihood) at estimated seroincidence. Default = TRUE.

showConvergence

Logical flag (FALSE/TRUE) for reporting convergence (see help for optim() for details). Default = FALSE.

...

Additional arguments affecting the summary produced.

Value

A summary.seroincidence.by object, which is a tibble::tibble, with the following columns:

  • incidence.rate maximum likelihood estimate of lambda (seroincidence)

  • CI.lwr lower confidence bound for lambda

  • CI.upr upper confidence bound for lambda

  • Deviance (included if showDeviance = TRUE) Negative log likelihood (NLL) at estimated (maximum likelihood) lambda)

    • nlm.convergence.code (included if showConvergence = TRUE) Convergence information returned by stats::nlm() The object also has the following metadata (accessible through base::attr()):

  • antigen_isos Character vector with names of input antigen isotypes used in est.incidence.by()

  • Strata Character with names of strata used in est.incidence.by()

Examples

library(dplyr)

xs_data <- load_pop_data("https://osf.io/download//n6cp3/")

curve <- load_curve_params("https://osf.io/download/rtw5k/") %>%
  filter(antigen_iso %in% c("HlyE_IgA", "HlyE_IgG")) %>%
  slice(1:100, .by = antigen_iso) # Reduce dataset for the purposes of this example

noise <- load_noise_params("https://osf.io/download//hqy4v/")

est2 <- est.incidence.by(
  strata = c("catchment"),
  pop_data = xs_data %>% filter(Country == "Pakistan"),
  curve_params = curve,
  noise_params = noise %>% filter(Country == "Pakistan"),
  antigen_isos = c("HlyE_IgG", "HlyE_IgA"),
  #num_cores = 8 # Allow for parallel processing to decrease run time
)
#> Warning: curve_params is missing all strata variables, and will be used unstratified.
#> 
#> To avoid this warning, specify the desired set of stratifying variables in the `curve_strata_varnames` and `noise_strata_varnames` arguments to `est.incidence.by()`.
#> Warning: noise_params is missing all strata variables, and will be used unstratified.
#> 
#> To avoid this warning, specify the desired set of stratifying variables in the `curve_strata_varnames` and `noise_strata_varnames` arguments to `est.incidence.by()`.

summary(est2)
#> Seroincidence estimated given the following setup:
#> a) Antigen isotypes   : HlyE_IgG, HlyE_IgA 
#> b) Strata       : catchment 
#> 
#>  Seroincidence estimates:
#> # A tibble: 2 × 13
#>   Stratum   catchment     n est.start incidence.rate      SE CI.lwr CI.upr
#>   <chr>     <chr>     <int>     <dbl>          <dbl>   <dbl>  <dbl>  <dbl>
#> 1 Stratum 1 aku         294       0.1          0.118 0.00825  0.103  0.136
#> 2 Stratum 2 kgh         200       0.1          0.183 0.0139   0.157  0.212
#> # ℹ 5 more variables: coverage <dbl>, log.lik <dbl>, iterations <int>,
#> #   antigen.isos <chr>, nlm.convergence.code <ord>

if (FALSE) { # \dontrun{
# estimate seroincidence
seroincidence <- est.incidence.by(...)

# calculate summary statistics for the seroincidence object
seroincidenceSummary <- summary(seroincidence)
} # }