Skip to contents

The density or mass of a distribution at points of its sample space. See compile_loglik() to vary \(\theta\) at fixed outcomes instead.

Usage

log_density(dist, x)

Arguments

dist

A distribution.

x

(M, K) matrix of outcomes, or a length-K vector for one outcome.

Value

Length-M numeric vector.

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