Home › Forums › kdb+ › weighted correlation in Q? › Re: weighted correlation in Q?
-
There is no inbuilt weighted correlation, but you can easily implement Pearson Weighted Correlation as followswcov: {[x;y;w] w wavg (x-w wavg x)*y-w wavg y} // weighted covariancewcor: {[x;y;w] wcov[x;y;w]%sqrt wcov[x;x;w]*wcov[y;y;w]} // weighted correlation
-Ajay