Nothing
#' Estimate Jensen-Shannon divergence
#'
#' Unified front-end for JSD estimation for continuous and discrete variables.
#'
#' @param x First vector.
#' @param y Second vector.
#' @param type One of `"auto"`, `"continuous"`, or `"discrete"`.
#' @param base Logarithm base. Defaults to 2. Use `exp(1)` for nats.
#' @param ... Additional arguments passed to the type-specific estimator.
#'
#' @return An object of class `"jsd_estimate"`.
#' @export
jsd <- function(x, y,
type = c("auto", "continuous", "discrete"),
base = 2,
...) {
type <- match.arg(type)
if (type == "auto") {
type <- detect_type(x, y)
}
out <- switch(
type,
continuous = jsd_continuous(x, y, base = base, ...),
discrete = jsd_discrete(x, y, base = base, ...),
stop("Unsupported type.")
)
out$call <- match.call()
out
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.