R/kl.diri.normal.R

Defines functions kl.diri.normal

Documented in kl.diri.normal

kl.diri.normal <- function(a) {
 
  d <- length(a) - 1
  da <- sum( lgamma(a) ) - lgamma( sum(a) )
  A <- sum(a)
  0.5 * d * ( 1 + log(2 * pi) ) - exp(da) + 
  sum( digamma(a) ) - A * digamma(A) + 0.5 * log( trigamma(a) ) + 
  0.5 * log( sum(1 / trigamma(a)) )

}

Try the Compositional package in your browser

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

Compositional documentation built on Oct. 9, 2024, 5:10 p.m.