How to use the covariance and variance in PostgreSQL I am going through the documentation:
https://www.postgresql.org/docs/9.5/static/functions-aggregate.html

for the aggregate functions: corr(Y, X), covar_pop(Y, X) but I cannot find any valid example. 

Can you please show me how to use these two functions or pointing me to some extra doc/examples?
There is an answer on https://stackoverflow.com/questions/3015846/calculating-correlation-coefficient-using-postgresql that is relevant for you.

Corr(y,x) is pretty easy. Say you have a table of people with columns height and weight. You wanted to know if those were correlated. 

select corr(height,weight) from people;