WassSqDistH | R Documentation |
WassSqDistH
Computes the squared L2 Wasserstein distance between two distributionH
objects.
WassSqDistH(object1, object2, ...)
## S4 method for signature 'distributionH,distributionH'
WassSqDistH(object1 = object1, object2 = object2, details = FALSE)
object1 |
is an object of distributionH class |
object2 |
is an object of distributionH class |
... |
optional parameters |
details |
(optional, default=FALSE) is a logical value, if TRUE returns the decomposition of the distance |
If details=FALSE
, the function returns the squared L2 Wasserstein distance.
If details=TRUE
, the function returns list containing the squared distance, its
decomposition in three parts (position, size and shape) and the correlation coefficient between the quantile functions.
Irpino, A. and Romano, E. (2007): Optimal histogram representation of large data sets:
Fisher vs piecewise linear approximations. RNTI E-9, 99-110.
Irpino, A., Verde, R. (2015) Basic
statistics for distributional symbolic variables: a new metric-based
approach Advances in Data Analysis and Classification, DOI 10.1007/s11634-014-0176-4
## ---- create two distributionH objects ----
mydist1 <- distributionH(x = c(1, 2, 3), p = c(0, 0.4, 1))
mydist2 <- distributionH(x = c(7, 8, 10, 15), p = c(0, 0.2, 0.7, 1))
# -- compute the squared L2 Waaserstein distance
WassSqDistH(mydist1, mydist2)
# -- compute the squared L2 Waaserstein distance with details
WassSqDistH(mydist1, mydist2, details = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.