Calculates the level Correlation coefficient.
Grammar
rankCorr(x, y)
Paramx — any Value. Float32 or Float64.y — any Value. Float32 or Float64.
Return value
Returns the rank correlation coefficient for the ranks of x and y. The correlation coefficient ranges from -1 to +1. If fewer than two parameters are passed, the function returns an exception. A value close to +1 indicates a strong linear relationship where as one random variable increases, the second random variable also increases. A value close to -1 indicates a strong linear relationship where as one random variable increases, the second random variable decreases. A value close to or equals to 0 indicates no relationship between the two random variables.
Type: Float64.
Example
Search:
SELECT rankCorr(number, number) FROM numbers(100);
As a result:
┌─rankCorr(number, number)─┐ │ 1 │ └──────────────────────────┘
Search:
SELECT roundBankers(rankCorr(exp(number), sin(number)), 3) FROM numbers(100);
As a result:
┌─roundBankers(rankCorr(exp(number), sin(number)), 3)─┐ │ -0.037 │ └─────────────────────────────────────────────────────┘
See also
Spearman's rank correlation coefficient Spearman's rank correlation coefficient