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

get_cpp_api()

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

## get functions in an environment api <- get_cpp_api() api
#> <environment: 0x000000003a142060>
## check content of the environment ls(api)
#> [1] "cpp_ll_all" "cpp_ll_contact" #> [3] "cpp_ll_genetic" "cpp_ll_reporting" #> [5] "cpp_ll_timing" "cpp_ll_timing_infections" #> [7] "cpp_ll_timing_sampling" "cpp_move_alpha" #> [9] "cpp_move_eps" "cpp_move_kappa" #> [11] "cpp_move_lambda" "cpp_move_mu" #> [13] "cpp_move_pi" "cpp_move_swap_cases" #> [15] "cpp_move_t_inf" "cpp_prior_all" #> [17] "cpp_prior_eps" "cpp_prior_lambda" #> [19] "cpp_prior_mu" "cpp_prior_pi"
## test the prior for mu args(api$cpp_prior_mu)
#> function (param, config, custom_function = NULL) #> NULL
config <- create_config() api$cpp_prior_mu(list(mu = 0.00123), config)
#> [1] -0.00123
dexp(0.00123, rate = config$prior_mu, log = TRUE)
#> [1] -0.00123