Let’s say that you want to know if the number of your visitors are related to how much you spend on media. The number of visitors and media spend are both data attributes. If we want to understand the relationship between these two data attributes (beyond just eyeballing them), we have to understand if they covary. That means that when one variable moves from its mean, we would expect that a related variables would change in a similar way. This is the correlation between data attributes.

In this post I will walk through what covariance is, how it is calculated and use R to test for it. This is a very valuable technique to determine relationships between variables and it is not difficult to apply.