Reference material for COVAR_SAMP
Computes the sample covariance between two numeric expressions. If either one of expressions is NULL
- that input row is ignored.
Use this when analyzing a sample rather than an entire population. For covariance of population see COVAR_POP.
Covariance and correlation both describe how two variables change together, but they do so in different ways:
Covariance measures the direction of the relationship between two variables:
Correlation, specifically Pearson correlation, standardizes the relationship:
For information on correlation see CORR
Parameter | Description | Supported input types |
---|---|---|
<expr1> | First numeric expression to use for covariance computation. | DOUBLE PRECISION |
<expr2> | Second numeric expression to use for covariance computation. | DOUBLE PRECISION |
COVAR_SAMP
returns a result of type DOUBLE PRECISION
.
The code examples use PlayStats
table from the sample UltraFast
database.
Example
The CurrentLevel
and CurrentScore
variables are highly correlated
Returns
473291.6614849927
Example
But CurrentLevel
and CurrentScore
variables are not correlated at all
Returns
0.040317002824098884