Expected entropy for samples from a Dirichlet distribution
Source:R/renormalize.R
expected_entropy.RdSamples P = <p1, p2, ..., pk> from Dirichlet distribution with parameter alpha = <alpha1, alpha2, ..., alphak> can be treated as categorical probability distributions with entropy \(H(P) = \sum(-p \log p)\). This function calculates the expected entropy \(E[H(P)]\) given alpha.
Examples
alpha = peak_alpha(50, 1)
set.seed(1357)
rdirichlet(500, alpha) |>
apply(1, entropy) |>
mean()
#> [1] 0.4568703
expected_entropy(alpha)
#> [1] 0.445642