powered by
Computes the Kullback-Leibler divergence for two arbitrary densities f1 and f2.
klDiv(f1, f2, lower = 0, upper = 1)
A real value.
density function of a real-valued random variable
density function of a real-values random variable
real value, the lower bound of integration
real value, the upper bound of integration
Chris Salahub
Given lower and upper bounds, this function integrates the expression for the Kullback-Leibler divergence KL(f1|f2).
klDiv(dunif, function(x) dbeta(x, 0.5, 1))
Run the code above in your browser using DataLab