| jsd_discrete | R Documentation |
Computes Jensen-Shannon divergence (JSD) between two discrete variables using empirical probability mass functions.
jsd_discrete(
x,
y,
support = NULL,
base = 2,
eps = 1e-12,
add_smoothing = FALSE,
na_rm = TRUE
)
x |
Vector for group 1. Can be numeric, factor, character, or logical. |
y |
Vector for group 2. Can be numeric, factor, character, or logical. |
support |
Optional support values. If 'NULL', the union of observed values in 'x' and 'y' is used. |
base |
Logarithm base. Defaults to 2. Use 'exp(1)' for nats. |
eps |
Small constant for numerical stability. |
add_smoothing |
Logical; add 1 to each cell count? |
na_rm |
Logical; remove missing values? |
An object of class '"jsd_estimate"'.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.