The C++ functions bound to R via Rcpp used in outbreaker2 for priors,
likelihoods and movements are not visible to the user, as they are not exported
by the package. However, advanced users can access these functions using get_cpp_api()
, which returns an environment with all relevant functions:
library(outbreaker2) ## get all functions in an environment x <- get_cpp_api() x ## check content ls(x) ## all functions are Rcpp bindings to a C++ function x$cpp_ll_all
These functions take the following arguments:
list_args <- lapply(x, args)[ls(x)] list_args
Arguments are detailed in the next section.
Arguments of the Rcpp-bound C++ functions are:
list_formals <- lapply(x, formals) args <- sort(unique(unlist(lapply(list_formals, names)))) args
alpha
: a vector of integers of length 'N' (number of cases), indicating
infectors of each case, with values from 1 to N; missing values should be
NA
config
: a list containing configuration settings as returned by
create_config
custom_function
: a R function for a custom prior, with a single
argument, which must be a list of parameters and augmented data with the
class outbreaker_param
; returned values must be on the log scale
custom_functions
: a list of R functions obeying the rules of
custom_function
, named according to the priors; currently available names are:
temp <- sub("cpp_prior_", "", ls(x, pattern = "cpp_prior.*")) setdiff(temp, "all")
custom_ll
: a R function for a custom likelihood, taking two arguments:
data
(see data
), and param
(see param
)
custom_prior
: same as custom_function
data
: a valid 'outbreaker_data' list
i
: an integer scalar indicating the index of a case, from 1 to N (number of cases)
list_custom_ll
: a list of R functions obeying the rules of custom_ll
,
named according to the computed likelihood component; available names are:
temp <- sub("cpp_ll_", "", ls(x, pattern = "cpp_ll.*")) setdiff(temp, c("timing", "all"))
param
: a list containing parameters and augmented data with the class
outbreaker_param
t_inf
: a vector of integers of length N (number of cases), indicating
infection dates of each case; missing values should be NA
x
: a vector of integers to be sampled from
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.