Code&Data Insights
(COMP233) Probability and Statics - Expectation, Variance and Covariance 본문
(COMP233) Probability and Statics - Expectation, Variance and Covariance
paka_corn 2023. 2. 3. 00:27
Covariance
: Covariance and Correlation, both describe the relationship between two numerical variables.
How to get a covariance value between X and Y?
1) Find the deviation from X to
x. (Y and
y) ------------> (x-
x) and (y-
y)
2) multiply (x-
x) and (y-
y)
3) Add the values, find the sum
4) divide by n-1
-> WHY did we divide by n-1, not just n?
: " Degrees of Freedom" - We can't calculate the covariance for only the first value of X and Y.
It could become a moot(고려할 가치 X) calculation!
Cov[X, Y ] = E[(X − E[X])(Y − E[Y ])]
Using an argument similar to that for variance, we can rewrite this as,
Cov[X, Y ] = E[(X − E[X])(Y − E[Y ])]
= E[XY − XE[Y ] − Y E[X] + E[X]E[Y ]]
= E[XY ] − E[X]E[Y]
*** If X and Y are independent, then cov(X,Y) = 0 ***
If X and Y are independent, then E[f(X)g(Y )] = E[f(X)]E[g(Y )].
-> It does not mean that cov(X,Y)=0 equals to X and Y are independent !!!
*** If cov(X,Y)=0 , we say that X and Y are uncorrelated ***
reference : Khan academy, Xiao, Y. comp 233(concordia uni.), Zedstatics(youtube)