In reply to Rommel.

See this blog post: Computing covariance and correlation matrices