[R] Kullback Leibler Divergence

Lavan rsumithran at yahoo.com
Sun Oct 19 16:00:07 CEST 2008


Hi there,

I'm trying to find the KL divergence measure between a prior and it's
posterior distributions, and I'm using the KLdiv method in the flexmix
package. plese see the example below:

require(flexmix)
x=seq(-4,4,length=100)
d1=dnorm(x,0,1)
d2=dunif(x,-3,3)

y=cbind(d1,d2)
kl=KLdiv(y)

but let say,
x1=seq(-5,5,length=100)
d3=dunif(x1,-3,3)

y1=cbind(d1,d3)
kl1=KLdiv(y1)

Notice that kl1 and kl are not the same. the documentation for the package
doesn't mention to evaluate the densities at the same points. which one is
correct? do I need to evaluate them at the same point or not?

Thanks,

Lavan
-- 
View this message in context: http://www.nabble.com/Kullback-Leibler-Divergence-tp20056359p20056359.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list