Skip to contents

A distance or divergence between matching rows; one-row inputs broadcast

Usage

metric_distance(
  reference,
  compared,
  metric = "nemd",
  epsilon = NULL,
  base = NULL,
  bandwidth = NULL,
  positions = NULL
)

Arguments

reference, compared

Distributions: cells, a matrix with one row per distribution, or a vector.

metric

A name from metric_names().

epsilon

Smoothing added before Kullback-Leibler, or NULL.

base

Logarithm base for KL and Jensen-Shannon, or NULL for 2.

bandwidth

Gaussian kernel bandwidth for MMD, or NULL.

positions

Option positions on the answer scale, or NULL for 0, 1, 2, ...

Value

A numeric vector with one value per row.

Examples

metric_distance(c(0.2, 0.8), c(0.5, 0.5), "total_variation")
#> [1] 0.3