Covariance is a measure of how changes in one variable are associated with changes in a second variable.
Although it measures the relationship between two variables, it is an absolute measure, not a normalized one, so giving them a quantitative meaning is very difficult. Its corresponding normalized measure is the correlation.
A positive value indicates a positive covariance, while
A negative value indicates a negative covariance.
covariance(column1, column2, group)
The first attribute you want to use in the function. The column1 parameter is mandatory.
The second attribute you want to use in the function. The column2 parameter is mandatory.
The attribute by which you want to further group results.
The following example uses the Bike-sales dataset.
In this example, we want to retrieve the covariance between the profit and cost attributes.
We type the following formula:
We want to go further with the analysis, and group our results.
In this case, we want to group our values by the Year attribute.
The formula will be:
The results can be read as follows:
and so on.
In this example, the covariance between the values is positive, so it displays that, as the Profit value increases, the Cost value tends to increase and vice versa.