Measure of the direction of linear relationship between 2 variables. Depends on the scale and unit of the variables.
Discrete version:
Cov(X,Y)=x∑y∑(x−μX)(y−μY)⋅P(X=x,Y=y)
Continuous version:
Cov(X,Y)=∫−∞∞∫−∞∞(x−μX)(y−μY)f(x,y)dxdy
| Sign of covariance | Description |
|---|
| Positive | Variables increase together |
| Negative | One increases as other decreases |
| Zero | No linear relationship |
Measure of strength and direction of linear relationship between 2 variables. Always in the range [−1,1].
ρ=σXσYCov(X,Y)
cov(X,Y)=n−11i=1∑n(xi−xˉ)(yi−yˉ)
r=sXsYcov(X,Y)=∑i=1n(xi−xˉ)2⋅∑i=1n(yi−yˉ)2∑i=1n(xi−xˉ)(yi−yˉ)