kldiv: Kullback Leiber (KL) divergence between two multivariate...

Description Usage Arguments Value Examples

View source: R/miscellany.R

Description

From two mean vectors (mu0, mu1) and two covariance matrices (covmat0, covmat1), this function returns KL divergence between N(mu0,covmat0) and N(mu1,covmat1).

Usage

1
2
kldiv(covmat0, covmat1, mu0 = rep(0, nrow(covmat0)), mu1 = rep(0,
  nrow(covmat0)))

Arguments

covmat0

A covariance matrix of the first multivariate normal distribution

covmat1

A covariance matrix of the second multivariate normal distribution

mu0

A mean vector of the first multivariate normal distribution

mu1

A mean vector of the second multivariate normal distribution

Value

KL divergence between N(mu0,covmat0) and N(mu1,covmat1)

Examples

1
2
3
4
covmat0 <- diag(3)
covmat1 <- matrix(c(1, 0.9, 0.7, 0.9, 1, 0.4, 0.7, 0.4, 1), 3, 3)

kldiv(covmat0 = covmat0, covmat1 = covmat1)

myeongjong/GPsim documentation built on Dec. 11, 2019, 12:37 p.m.