chisqDistance: Chi-square distance between vectors

View source: R/04_comparison_metrics.R

chisqDistanceR Documentation

Chi-square distance between vectors

Description

Computes the chi-squared distance between each element of a pair of vectors which must be of the same length. Good for comparing color histograms if you don't want to weight by color similarity. Probably hugely redundant; alas.

Usage

chisqDistance(a, b)

Arguments

a

Numeric vector.

b

Numeric vector; must be the same length as a.

Value

Chi-squared distance, (a - b)^2/(a + b), between vectors a and b. If one or both elements are NA/NaN, contribution is counted as a 0.

Examples

colordistance:::chisqDistance(rnorm(10), rnorm(10))

hiweller/colordistance documentation built on Feb. 1, 2024, 7:49 p.m.