Computes 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: large
values approach the multinomial at sample size \(N\), and values near zero
increase variance. With \(\theta = \exp(\ln\theta)\), the effective sample
size is \((1 + \theta N) / (1 + \theta)\), which never exceeds \(N\).
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.