R/priors.R

Defines functions uprior bprior

Documented in bprior uprior

#' Default priors for [aphylo_mcmc]
#' 
#' Convenient wrappers to be used with the `aphylo` estimation methods.
#' 
#' @param shape1,shape2,... Arguments passed to [stats::dbeta]
#' @return In the case of `bprior`, a wrapper of the function [stats::dbeta].
#' `uprior` returns a function `function(p) 1` (the uniform prior)
#' @examples 
#' bprior(1, 9)
#' uprior()
#' @export
bprior <- function(shape1=1, shape2=9, ...) {
  
  function(p) {
    
    stats::dbeta(p, shape1 = shape1, shape2 = shape2, ...)
    
  }
  
}

#' @rdname bprior
#' @export
uprior <- function() {
  function(p) 1
}

Try the aphylo package in your browser

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

aphylo documentation built on April 4, 2025, 2:18 a.m.