# Calculating Hellinger Divergence from Results of Kernel Density Estimates in Matlab

Using the ksdensity function in matlab returns a density estimation in the form of 2 vectors f and xi. Where f are the density values and xi the corresponding points for the density values.

How do I calculate the hellinger distance between 2 density estimations based on their f and xi ?

-

This might be a better option, since your f might not be evaluated over the same range of xi values. However if it is, then the just use the simple formula. Lets say that $f = \{f_i\}_i$ and $g=\{g_i\}_i$ are the two tabulated densities over the same range of $x_i$ values. The Hellinger distance is $H = \sum\limits_i(\sqrt{f_i}-\sqrt{g_i})^2$ .