View source: R/jsd_continuous.R
| jsd_continuous | R Documentation |
Computes Jensen-Shannon divergence (JSD) between two numeric vectors using kernel density estimation (KDE) and numerical integration.
jsd_continuous(
x,
y,
L = NULL,
U = NULL,
base = 2,
bw = "nrd0",
kernel = "gaussian",
grid_n = 4096,
qrange = c(0.001, 0.999),
extend = 3,
eps = 1e-12,
renormalize = TRUE,
na_rm = TRUE
)
x |
Numeric vector for group 1. |
y |
Numeric vector for group 2. |
L |
Optional lower integration bound. |
U |
Optional upper integration bound. |
base |
Logarithm base. Defaults to 2. Use 'exp(1)' for nats. |
bw |
Bandwidth passed to [stats::density()]. |
kernel |
Kernel passed to [stats::density()]. |
grid_n |
Number of grid points used for KDE. |
qrange |
Quantile range used when 'L' and 'U' are not supplied. |
extend |
Extension multiplier for the automatically chosen range. |
eps |
Small constant for numerical stability. |
renormalize |
Logical; renormalize estimated densities over the grid? |
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.