dist4den {frechet} | R Documentation |
L^2
Wasserstein distance between two distributions.
Description
L^2
Wasserstein distance between two distributions.
Usage
dist4den(d1 = NULL, d2 = NULL, fctn_type = NULL, optns = list())
Arguments
d1 , d2 |
Lists holding the density functions or quantile functions of the two distributions.
Each list consists of two numeric vectors |
fctn_type |
Character vector of length 1 holding the function type in |
optns |
A list of control parameters specified by |
Details
Available control options are:
- nqSup
A scalar giving the length of the support grid of quantile functions based on which the
L^2
Wasserstein distance (i.e., theL^2
distance between the quantile functions) is computed. Default is 201.
Value
A scalar holding the L^2
Wasserstein distance between d1
and d2
.
Examples
d1 <- list(x = seq(-6,6,0.01))
d1$y <- dnorm(d1$x)
d2 <- list(x = d1$x + 1)
d2$y <- dnorm(d2$x, mean = 1)
dist <- dist4den(d1 = d1,d2 = d2)