You need to enable JavaScript to run this app.
ByteHouse Enterprise Edition

ByteHouse Enterprise Edition

Copy page
Download PDF
Aggregate function
rankCorr
Copy page
Download PDF
rankCorr

Calculates the level Correlation coefficient.
Grammar

rankCorr(x, y)

Param
x — 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

Last updated: 2026.03.31 11:49:59