The density or mass of a distribution at points of its sample space. See
compile_loglik() to vary \(\theta\) at fixed outcomes instead.
Arguments
- dist
A distribution.
- x
(M, K)matrix of outcomes, or a length-Kvector for one outcome.
Examples
fam <- multinomial_family(n_trials = 4L, k = 3L)
log_density(fam(c(0.5, 0.3, 0.2)), c(2L, 1L, 1L))
#> [1] -1.714798