Statistics
COVAR_POP()
Overview
The COVAR_POP()
aggregate function calculates the population covariance between two sets of number pairs.
This function measures how much two variables change together, providing insight into their linear relationship.
Syntax
The syntax for this function is as follows:
Parameters
y
: variable being predictedx
: variable used for prediction
Example
For the needs of this section, we’re going to use a simplified version of the film
table from the Pagila database, containing only the title
, length
and rating
columns. The complete schema for the film
table can be found on the
Pagila database website.
The query below uses the COVAR_POP()
function to calculate the covariance between film length and rating:
By running the query above, we will get the following output: