Skip to contents

Renormalises both inputs to sum to one and returns \(1 - \sum_i \sqrt{p_i q_i}\), which is one half of the squared Hellinger distance \(h^2(p, q) = \sum_i (\sqrt{p_i} - \sqrt{q_i})^2\) and lies in \([0, 1]\).

Usage

morie_gh_hellinger2(p, q)

Arguments

p

numeric vector of non-negative weights; renormalised internally

q

numeric vector of non-negative weights on the same support; renormalised internally

Value

numeric scalar in \([0, 1]\)

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_gh_hellinger2(V, V)
#> [1] 0