[dfe06d]: / R / ref_priors.R

Download this file

51 lines (27 with data), 1.4 kB

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## ON THE PURPOSE OF THESE FUNCTIONS
## These functions are no longer used in outbreaker2, but were part of the
## original implementation, and are still used in testing procedures to ensure
## that Rcpp versions give identical results.
## We use an exponential prior for the mutation rate; the prior rate, which does
## not change in the MCMC, is enclosed in the returned function.
.prior_mu <- function(param, rate) {
stats::dexp(param$mu, rate, log = TRUE)
}
## We use a beta prior for the reporting probability (which contrains it to lie
## between 0 and 1); the 2 shape parameters, which do not change in the MCMC,
## are enclosed in the returned function.
.prior_pi <- function(param, shape1, shape2) {
stats::dbeta(param$pi, shape1, shape2, log = TRUE)
}
## We use a beta prior for the contact reporting coverage (which contrains it to lie
## between 0 and 1); the 2 shape parameters, which do not change in the MCMC,
## are enclosed in the returned function.
.prior_eps <- function(param, shape1, shape2) {
stats::dbeta(param$eps, shape1, shape2, log = TRUE)
}
## We use a beta prior for the non-infectious contact rate (which contrains it
## to lie between 0 and 1); the 2 shape parameters, which do not change in the
## MCMC, are enclosed in the returned function.
.prior_lambda <- function(param, shape1, shape2) {
stats::dbeta(param$lambda, shape1, shape2, log = TRUE)
}