The function eval_prior_list evaluates several prior distributions specified in a list. The function eval_prior_list_sumlog computes the sum of the logarithms of all prior values.

eval_prior_list(par, par_prior, log=FALSE, eps=1e-50)

eval_prior_list_sumlog(par, par_prior, use_grad=1)

Arguments

par

Parameter vector

par_prior

List of prior distributions specified in a list (see Examples)

log

Logical indicating whether the logarithm of the prior should be computed

eps

Decimal to be added to the prior to avoid computation of the logarithm for values of zero

use_grad

Integer value for computation value for gradient

Value

Vector or a numeric value

See also

Examples

#############################################################################
# EXAMPLE 1: Evaluation of prior values
#############################################################################

# normal distribution
b0 <- list( "dnorm", list(mean=0,sd=100) )
# t distribution with one degree of freedom (Cauchy distribution)
b1 <- list( "dt", list(df=1) )
# define list of priors
beta_prior <- list( b0, b1 )
# parameter value
beta <- c( 0.3, 1 )

#-- evaluate priors
mdmb::eval_prior_list(par=beta, par_prior=beta_prior)
mdmb::eval_prior_list_sumlog(par=beta, par_prior=beta_prior)