Skip to contents

This function computes \(D_{KL}(p||q)\), where \(p\sim \text{Exp}(\lambda_1)\) and \(q\sim \text{Exp}(\lambda_2)\), in rate parametrization.

Usage

kld_exponential(lambda1, lambda2)

Arguments

lambda1

A scalar (rate parameter of true exponential distribution)

lambda2

A scalar (rate parameter of approximate exponential distribution)

Value

A scalar (the Kullback-Leibler divergence)

Examples

kld_exponential(lambda1 = 1, lambda2 = 2)
#> [1] 0.3068528