oubtreaker2 provides a platform for reconstructing densely sampled outbreaks using epidemiological and genetic data. See introduction vignette for a worked example.

Installing the package

To install the current stable, CRAN version of the package, type:


To benefit from the latest features and bug fixes, install the development, github version of the package using:


Note that this requires the package devtools installed.

Main visible functions of the package

The main functions of the package include:

  • outbreaker: the returned object is an instance of the (S3) class outbreaker_chains.

  • plot: this method (see ?plot.outbreaker_chains for details) plots outbreaker_chains objects.

  • summary: this method (see ?summary.outbreaker_chains for details) provides summaries for the various outputs of outbreaker2, stored in an outbreaker_chains object.

  • outbreaker_data: function processing input data.

  • create_config: function creating default settings, also used for specifying customised settings for outbreaker2.

  • custom_priors: function used for specifying customised functions to be used as priors in outbreaker2.

  • custom_likelihoods: function used for specifying customised functions to be used for likelihood computation in outbreaker2.

  • custom_moves: function used for specifying customised functions to be used for moving parameters and augmented data in outbreaker2.

Main internal functions

outbreaker2 uses many functions internally which are not visible to the user when loading the package. However, some of these functions will be useful when designing custom likelihoods or movement functions, or when contributing code. The most useful ones are C++ functions bound to R using Rcpp. The list of these functions is:

env <- asNamespace("outbreaker2")
ls(envir = env, pattern = "^cpp")  
##  [1] "cpp_are_possible_ancestors"    "cpp_find_descendents"         
##  [3] "cpp_find_local_cases"          "cpp_get_n_mutations"          
##  [5] "cpp_ll_all"                    "cpp_ll_contact"               
##  [7] "cpp_ll_genetic"                "cpp_ll_reporting"             
##  [9] "cpp_ll_timing"                 "cpp_ll_timing_infections"     
## [11] "cpp_ll_timing_sampling"        "cpp_lookup_sequenced_ancestor"
## [13] "cpp_move_alpha"                "cpp_move_eps"                 
## [15] "cpp_move_kappa"                "cpp_move_lambda"              
## [17] "cpp_move_mu"                   "cpp_move_pi"                  
## [19] "cpp_move_swap_cases"           "cpp_move_t_inf"               
## [21] "cpp_pick_possible_ancestor"    "cpp_prior_all"                
## [23] "cpp_prior_eps"                 "cpp_prior_lambda"             
## [25] "cpp_prior_mu"                  "cpp_prior_pi"                 
## [27] "cpp_sample1"                   "cpp_swap_cases"

See the vignette on Rcpp API for a detail of these functions.