custom_likelihoods: Customise likelihood functions for outbreaker

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function is used to specify customised likelihood functions for outbreaker. Custom functions are specified as a named list or series of comma-separated, named arguments, indicating which log-likelihood component they compute. Values currently available are:

Usage

1
2
3
4
custom_likelihoods(...)

## S3 method for class 'custom_likelihoods'
print(x, ...)

Arguments

...

a named list of functions, each computing a log-likelihood component.

x

an outbreaker_config object as returned by create_config.

Details

All log-likelihood functions should have the following arguments, in this order:

Value

A named list of functions with the class custom_likelihood, each implementing a customised log-likelihood components of outbreaker. Functions which are not customised will result in a NULL component.

a list of named functions

Author(s)

Thibaut Jombart ([email protected])

See Also

See customization vignette for detailed examples on how to customize likelihoods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## specify a null model by disabling all likelihood components
f_null <- function(data, param) {
  return(0.0)
}

null_model <- custom_likelihoods(genetic = f_null,
                                timing_sampling = f_null,
                                timing_infections = f_null,
                                reporting = f_null,
                                contact = f_null)

null_config <- list(find_import = FALSE,
                    n_iter = 200,
                    sample_every = 1)

## load data
x <- fake_outbreak
data <- outbreaker_data(dates = x$sample, dna = x$dna, w_dens = x$w)

res_null <- outbreaker(data = data,
                       config = null_config,
                       likelihoods = null_model)

## visualise ancestries to see if all transmission trees have been explored
plot(res_null, type = "alpha")

thibautjombart/outbreaker2 documentation built on July 1, 2019, 3:35 p.m.