relative_entropy function

Relative Entropy

Relative Entropy

Computes the relative entropy of two distributions.

relative_entropy(prior, posterior)

Arguments

  • prior: A prior probability distribution.
  • posterior: A posterior probability distribution.

Returns

A double with the relative entropy.

Examples

set.seed(222) prior <- rep(1 / 100, 100) posterior <- runif(100) posterior <- posterior / sum(posterior) relative_entropy(prior, posterior)
  • Maintainer: Bernardo Reckziegel
  • License: MIT + file LICENSE
  • Last published: 2022-09-29