R/ref_priors.R

Defines functions .prior_lambda .prior_eps .prior_pi .prior_mu

## 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)
}

Try the outbreaker2 package in your browser

Any scripts or data that you put into this service are public.

outbreaker2 documentation built on May 23, 2022, 5:06 p.m.