distance_chi_cpp {distantia} | R Documentation |
(C++) Normalized Chi Distance Between Two Vectors
Description
Computed as:
xy <- x + y
y. <- y / sum(y)
x. <- x / sum(x)
sqrt(sum(((x. - y.)^2) / (xy / sum(xy))))
.
Cannot handle NA values. When x
and y
have zeros in the same
position, NaNs
are produced. Please replace these zeros with
pseudo-zeros (i.e. 0.0001) if you wish to use this distance metric.
Usage
distance_chi_cpp(x, y)
Arguments
x |
(required, numeric vector). |
y |
(required, numeric vector) of same length as |
Value
numeric
See Also
Other Rcpp_distance_methods:
distance_bray_curtis_cpp()
,
distance_canberra_cpp()
,
distance_chebyshev_cpp()
,
distance_cosine_cpp()
,
distance_euclidean_cpp()
,
distance_hamming_cpp()
,
distance_hellinger_cpp()
,
distance_jaccard_cpp()
,
distance_manhattan_cpp()
,
distance_russelrao_cpp()
,
distance_sorensen_cpp()
Examples
distance_chi_cpp(x = runif(100), y = runif(100))
[Package distantia version 2.0.0 Index]