This functions determines if two vectors have a common ordering permutation.
check_comonotonicity(x, y, incompatible_lengths = NA)
numeric vector
numeric vector
single logical value,
value to return iff lengths of x
and y
differ
Returns a single logical value.
Two vectors x
, y
of equal length \(n\) are comonotonic,
if and only if there exists a permutation \(\sigma\) such that
\(x_{\sigma(1)}\le \dots \le x_{\sigma(n)}\) and
\(y_{\sigma(1)}\le \dots \le y_{\sigma(n)}\).
Thus, \(\sigma\) orders x
and y
simultaneously.
Equivalently, x
and y
are comonotonic,
iff \((x_i-x_j)(y_i-y_j)\ge 0\) for every i,j
.
If there are missing values in x
or y
, the function
returns NA
.
Currently, the algorithm implemented has \(O(n^2)\) time complexity.
Grabisch M., Marichal J.-L., Mesiar R., Pap E., Aggregation functions, Cambridge University Press, 2009.
Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7
Other binary_relations: pord_nd
,
pord_spread
, pord_weakdom
,
rel_graph
,
rel_is_antisymmetric
,
rel_is_asymmetric
,
rel_is_cyclic
,
rel_is_irreflexive
,
rel_is_reflexive
,
rel_is_symmetric
,
rel_is_total
,
rel_is_transitive
,
rel_reduction_hasse