# Calculate Entropy from Kernel Density estimates

I have a time series and wish to estimate its entropy, is it correct to use ksdensity function in Matlab to get estimates of the pdf at 100 points and then plug these into the standard Shannon entropy formula?

• Since a density is not a probability, the answer surely is no.
– whuber
Dec 9, 2016 at 17:12
• Any advice on how to estimate entropy of a time series or where to find the right info? Dec 9, 2016 at 18:25

Depends on which Shannon entropy formula you use. Broadly, $H = \mathrm{E}[\mathrm{I}(X)]$. In the discrete case, this would be $H = \mathrm{E}[-\ln P(X)]$ or $$-\sum \limits_{i=1}^{n} P(x_i)\ln P(x_i)$$ This would make sense if you're using a histogram estimate of $P(X)$.
The kernel density estimate generates an estimate of the (continuous) density function $f(X)$. A such, you'd need a continuous estimate of $H = \mathrm{E}[\mathrm{I}(X)] = \mathrm{E}[-\ln f(X)]$ or $$-\int f(x)\ln f(x) dx$$ Since the kernel density estimate outputs discrete points $x_i, f(x_i)$, it would make sense to use something like trapezoid or Simpson's rule to get the integral.