% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/renormalize.R
\name{expected_entropy}
\alias{expected_entropy}
\title{Expected entropy for samples from a Dirichlet distribution}
\usage{
expected_entropy(alpha, k = NULL)
}
\arguments{
\item{alpha}{Dirichlet parameter}

\item{k}{If length(alpha) is 1, number of components in symmetric Dirichlet distribution}
}
\value{
Expected entropy \eqn{E[H(P)]} in bits (log2 scale)
}
\description{
Samples P = <p1, p2, ..., pk> from Dirichlet distribution with parameter alpha = <alpha1, alpha2, ..., alphak> can be treated as categorical probability distributions with entropy \eqn{H(P) = \sum(-p \log p)}.  This function calculates the expected entropy \eqn{E[H(P)]} given alpha.
}
\details{
After \url{https://math.stackexchange.com/questions/2266285/expected-entropy-based-on-dirichlet-distribution/3195376#3195376}
}
\examples{
alpha = peak_alpha(50, 1)
set.seed(1357)
rdirichlet(500, alpha) |>
  apply(1, entropy) |>
  mean()
expected_entropy(alpha)
}
