klDiv | R Documentation |
Computes the Kullback-Leibler divergence for two arbitrary densities f1 and f2.
klDiv(f1, f2, lower = 0, upper = 1)
f1 |
density function of a real-valued random variable |
f2 |
density function of a real-values random variable |
lower |
real value, the lower bound of integration |
upper |
real value, the upper bound of integration |
Given lower and upper bounds, this function integrates the expression for the Kullback-Leibler divergence KL(f1|f2).
A real value.
Chris Salahub
klDiv(dunif, function(x) dbeta(x, 0.5, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.