Learn R Programming

outbreaker2 (version 1.1.4)

get_cpp_api: Access internal C++ rountines used in outbreaker2

Description

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

Usage

get_cpp_api()

Arguments

Value

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")).

Author

Thibaut Jombart (thibautjombart@gmail.com).

Examples

Run this code

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

## check content of the environment
ls(api)

## test the prior for mu
args(api$cpp_prior_mu)

config <- create_config()

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

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

Run the code above in your browser using DataLab