get_cpp_api: Access internal C++ rountines used in outbreaker2

View source: R/get_cpp_api.R

get_cpp_apiR Documentation

Access internal C++ rountines used in outbreaker2


This function returns an environment containing all C++ functions (bound to R using Rcpp) used for priors, likelihoods, and movements of parameters in outbreaker2.




An environment containing Rcpp bindings to C++ functions used internally in outbreaker2. All functions are named as cpp_[type]_[component], where 'type' can be:

  • 'prior': prior computation

  • 'll': likelihood computation

  • 'move': movement of parameters or augmented data

And where 'component' can be:

  • 'mu': (parameter) mutation rate

  • 'pi': (parameter) reporting probability

  • 'lambda': (parameter) non-infectious contact rate

  • 'eps': (parameter) contact reporting coverage

  • 'alpha': (augmented data) ancestries of the cases

  • 'kappa': (augmented data) generation between cases on transmission chains

  • 't_inf': (augmented data) dates of infections

  • 'timing_infections': (likelihood component) timing between infectors and infectees

  • 'timing_sampling': (likelihood component) timing between infection and reporting / isolation

  • 'timing': (likelihood component) sum of the two timing components

  • 'genetic': (likelihood component) genetic diversity accumulated along transmission chains

  • 'reporting': (likelihood component) reporting of cases

  • 'all': (likelihood component) sum of all likelihood components

  • 'swap_cases': (type of movement) swap infectors and infectees on a transmission tree

For a description of the arguments of these functions, see the Rcpp_API vignette (vignette("Rcpp_API", package = "outbreaker2")).


Thibaut Jombart (


## get functions in an environment
api <- get_cpp_api()

## check content of the environment

## test the prior for mu

config <- create_config()

api$cpp_prior_mu(list(mu = 0.00123), config)

dexp(0.00123, rate = config$prior_mu, log = TRUE)

outbreaker2 documentation built on May 23, 2022, 5:06 p.m.