swh:1:snp:ffdd0a7d2c8ea15ad41d45b3b178f668bd942287
Tip revision: 576ff4b7a130640e672f054885dfc219c17aeb2f authored by Derek Young on 29 September 2009, 00:00:00 UTC
version 0.4.3
version 0.4.3
Tip revision: 576ff4b
ldmult.r
###########################################################################
# log density function of multinomial count vector y with parameter theta #
###########################################################################
ldmult<-function(y,theta){
if (any(is.nan(theta)) || any(theta==0)) {
# stop ("The theta parameter cannot have a zero component.")
out = -Inf
}
else {
if (length(y)==length(theta)+1)
theta=c(theta,1-sum(theta))
out=lgamma(1+sum(y)) - sum(lgamma(1+y)) + sum(y*log(theta))
}
out
}