reconhub / outbreaker2
Showing 1 of 35 files from the diff.

@@ -43,7 +43,7 @@
Loading
43 43
#'     \code{custom_likelihood}, each function implementing a customised
44 44
#'     log-likelihood component of outbreaker. Functions which are not
45 45
#'     customised will result in a list(NULL, 0) component. Any function with
46 -
#'     arity 3 must have the third parameter default to NULL
46 +
#'     arity 3 must have the third parameter default to NULL.
47 47
#'
48 48
#' @author Thibaut Jombart (\email{thibautjombart@@gmail.com})
49 49
#'
@@ -54,14 +54,14 @@
Loading
54 54
#' @seealso See \href{http://www.repidemicsconsortium.org/outbreaker2/articles/customisation.html#customizing-likelihood}{customization vignette} for detailed examples on how to customize likelihoods.
55 55
#'
56 56
#' @export
57 -
#' 
57 +
#'
58 58
#' @examples
59 -
#' 
59 +
#'
60 60
#' ## specify a null model by disabling all likelihood components
61 61
#' f_null <- function(data, param) {
62 62
#'   return(0.0)
63 63
#' }
64 -
#' 
64 +
#'
65 65
#' null_model <- custom_likelihoods(genetic = f_null,
66 66
#'                                 timing_sampling = f_null,
67 67
#'                                 timing_infections = f_null,
@@ -75,7 +75,7 @@
Loading
75 75
#' ## load data
76 76
#' x <- fake_outbreak
77 77
#' data <- outbreaker_data(dates = x$sample, dna = x$dna, w_dens = x$w)
78 -
#' 
78 +
#'
79 79
#' res_null <- outbreaker(data = data,
80 80
#'                        config = null_config,
81 81
#'                        likelihoods = null_model)
@@ -141,13 +141,18 @@
Loading
141 141
        stop(msg)
142 142
    }
143 143
144 -
    # If the arity of the likelihood functions is three, the last argumen should
144 +
    # If the arity of the likelihood functions is three, the last argument should
145 145
    # be the (1-based) indices of the cases we're currently perturbing. This
146 146
    # allows us to calculate the local likelihood delta, rather than having to
147 147
    # calculate the likelihood of the entire tree twice for every single
148 148
    # perturbation we make.
149 149
    if (!all(is_list_function_or_null)) {
150 -
        likelihoods <- lapply(likelihoods, function(x) { if (is.null(x)) return(list(x, 0)); list(x, length(methods::formalArgs(x))) })
150 +
      likelihoods <- lapply(
151 +
        likelihoods,
152 +
        function(x) {
153 +
          if (is.null(x)) return(list(x, 0)); list(x, length(methods::formalArgs(x)))
154 +
        }
155 +
      )
151 156
    }
152 157
153 158
    arity_two_or_three <- function(x) {
@@ -160,7 +165,7 @@
Loading
160 165
    legal_arity <- vapply(likelihoods, arity_two_or_three, logical(1))
161 166
162 167
    if (!all(legal_arity)) {
163 -
        culprits <- likelihood_names[!legal_arity]
168 +
        culprits <- likelihoods_names[!legal_arity]
164 169
        msg <- paste0("The following likelihoods do not have arity two or three: ",
165 170
                      paste(culprits, collapse=", "))
166 171
        stop(msg)
Files Coverage
R 60.21%
src 92.23%
Project Totals (25 files) 69.96%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading