Evaluate a Dirichlet-multinomial log-likelihood
ddirmult.RdComputes the Dirichlet-multinomial log-likelihood following the
parameterization of Thorson et al. (CCSRA). The concentration parameters
are \(\alpha_k = \exp(\ln\theta) \times N \times \hat{p}_k\), so
\(\exp(\ln\theta)\) is the per-observation overdispersion scalar: values
near zero approach the multinomial and larger values increase variance.
Non-integer observed counts are supported via lgamma.
Arguments
- obs
Numeric vector of observed proportions of length \(K\) (need not sum exactly to 1 after
addtotagoffsets).- pred
Numeric vector of predicted proportions of length \(K\); must sum to 1.
- Ntotal
Numeric. Total count (input sample size \(N\)).
- ln_theta
Numeric. Log overdispersion parameter. The Dirichlet concentration is \(\exp(\ln\theta) \times N \times \hat{p}_k\).
- give_log
Logical. If
TRUE(default), returns the log-likelihood; otherwise returns the likelihood.