powered by
Allows data-weighting as parameter
ddirmult(x, prob, ln_theta, log = TRUE)
The log-likelihood resulting from the Dirichlet-multinomial distribution
numeric vector of observations across categories
numeric vector of category probabilities
logit-ratio of effective and input sample size
whether to return the log-probability or not
library(RTMB) prob = rep(0.1,10) x = rmultinom( n=1, prob=prob, size=20 )[,1] f = function( ln_theta ) ddirmult(x, prob, ln_theta) f( 0 ) F = MakeTape(f, 0) F$jacfun()(0)
Run the code above in your browser using DataLab