WassSqDistH {HistDAWass} | R Documentation |
Method WassSqDistH
Description
Computes the squared L2 Wasserstein distance between two distributionH
objects.
Usage
WassSqDistH(object1, object2, ...)
## S4 method for signature 'distributionH,distributionH'
WassSqDistH(object1 = object1, object2 = object2, details = FALSE)
Arguments
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 |
Value
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.
References
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
Examples
## ---- 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)