Support for computing correlation and regression coefficient


We have tested the support for Stats aggregator in Druid which involves computation of Standard Deviation and Variance. Is there any way of computing stats like correlation coefficient and regression coefficients in Druid with group by operation.

Formula looks like as:

Corr = 1/n * Σ((x - mean(x))*(y - mean(y))/ (std(x)*std(y)))

Please note this correlation needs to be computed at each group level. Hence, we may not be able to use custom aggregator here as else we could have queried 2 times, one time for computing mean and std and second time for using a custom aggregator with computed values of mean and standard deviation. Can you please provide your inputs on this.