COVAR_POP Function
Description
The COVAR_POP function computes the population covariance between two numeric columns. Covariance measures the degree to which two variables change together, and is a statistical measure of variable correlation.
Parameters
y: A numeric expression serving as the dependent variable. Must be a numeric type that can be cast toDOUBLE.x: A numeric expression serving as the independent variable. Must be a numeric type that can be cast toDOUBLE.
Return Type
- Returns a
DOUBLEvalue representing the population covariance.- Positive value: x and y tend to change in the same direction (positive correlation)
- Negative value: x and y tend to change in opposite directions (negative correlation)
- Close to 0: weak correlation between variables
Notes
- During computation,
NULLvalues are ignored. - If there are fewer than 1 valid data point, returns
NULL. - Population covariance uses the formula with denominator n, whereas sample covariance uses (n-1), so population covariance is typically smaller than sample covariance.
Examples
- Basic usage: compute population covariance
- Comparison with sample covariance
- Perfect positive correlation data
- Perfect negative correlation data
- Uncorrelated data
