powered by
KL_divergence calculates the Kullback-Leibler divergence
KL_divergence
KL_divergence(theta, p_theta, q_theta)
a vector of numerics containing values of the RV \(\theta\)
a vector of numerics containing values of the pdf p at locations theta
a vector of numerics containing values of the pdf q at locations theta
The Kullback-Leibler divergence from q to p
# NOT RUN { theta=seq(from=-5,to=5,by=0.1) p_theta = dnorm(theta,mean = 0.2,sd = 1) q_theta = dnorm(theta,mean = 0.25,sd = 0.5) # }
Run the code above in your browser using DataLab