KL_divergence: Kullback-Leibler divergence

Description Usage Arguments Value Examples

View source: R/pdf_distances.R

Description

KL_divergence calculates the Kullback-Leibler divergence

Usage

1
KL_divergence(theta, p_theta, q_theta)

Arguments

theta

a vector of numerics containing values of the RV θ

p_theta

a vector of numerics containing values of the pdf p at locations theta

q_theta

a vector of numerics containing values of the pdf q at locations theta

Value

The Kullback-Leibler divergence from q to p

Examples

1
2
3
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)

exPrior documentation built on Nov. 15, 2019, 1:07 a.m.