Friday, November 23

Variance Covariance Formula


Variance: Variance is used in the statistical analysis to find the the extent to which a single variable is varying from its mean value given a set of values.

Variance of a random variable X is often denoted as VAR ( X). It is also denoted by the symbol `sigma` 2X

Covariance: Co-variance is used in statistical analysis to find the extent to which 2 variable are varying together given a set of values for both these variables.

Covariance of two random variable X and Y is denoted as COV ( X,Y). Unlike variance which has the mathematical symbol sigma ( `sigma` ), Covariance doesn't have any kind of symbol to depict it.
Formulae for Variance and Covariance.

Lets consider 2 sets of data namely X and Y such that the values in X are x1 , x2 , x3 , x4 , ......xn and similarly the values in Y are y1 , y2 , y3 , y4 , .......yn

Now lets denote the mean of the X set of variables to be    Xm

Mean Xm = X1 + X2 + X3 +........ + Xn / n

Similarly lets denote the mean of the Y set of variables to be Ym

Mean Ym = Y1 + Y2 + Y3 +.......+ Yn / n

Formulae for Variance of X = ( x1 - xm)2 + (x2 - xm)2 + ( x3 - xm)2 + .......+ (xn - xm)2 / n

VAR ( X ) = (1/n) `sum` (xi - xm)2

Formulae for Variance of Y = ( y1 - ym)2 + (y2 - ym)2 + ( y3 - ym)2 + .......+ (yn - ym)2 / n

VAR ( Y ) = (1/n) `sum` (yi - ym)2

Formulae for Covariance of (X,Y) = ( x1 - xm) ( y1 - ym) + (x2 - xm)(y2 - ym) + ( x3 - xm)( y3 - ym) + .......+ (xn - xm)(yn - ym) / n

COV ( X , Y ) = (1/n) `sum` (xi - xm)(yi - ym)
Example Problem 1 on Variance and co Variance

Lets assume the below set of marks received by Bill and Bob in Maths, Physics, Chemistry, English and Biology for the purpose of solving Variance and Co Variance

table

Based on the Formulae given in the previous paragraph, Lets calculate the Mean Marks for Bill and Bob

Mean Marks for Bill = 16+12+14+18+20 /5 = 16.00

Mean Marks for Bob = 14+18+15+18+20 /5 = 17.00

Now lets apply the formulae of variance and find out the Variance of Bill and Bob

Variance of Bill = (16-16)2 + (12-16)2 + (14-16)2 + (18-16)2 + (20 - 16)2 / 5 = 40 / 5 = 8

Variance of Bob = (14-17)2 + ( 18-17)2 + (15-17)2 + (18-17)2 + (20-17)2 / 5 = 24 / 5 = 4.8

Co variance of ( Bill , Bob ) = (16-16)*(14-17) + (12-16)*(18-17) + (14-16)*(15-17) + (18-16)(18-17) + (20-16)*(20-17) / 5

Co Variance of ( Bill , Bob ) = 21/5 = 4.2

I am planning to write more post on What are Line Segments and Perpendicular and Parallel Lines. Keep checking my blog.

Example Problem 2 on Variance and co Variance

Lets assume a class of 4 student who have been asked to rate their liking toward 2 musical instruments Guitar and Piano on a scale of 10




Based on the above data, lets calculate the Mean of the people liking Guitar and Mean of people liking Piano.

Mean(Guitar) = ( 5+3+7+9)/4 = 24/4 = 6

Mean(Piano) = (5+9+9+5)/4 = 28/4 = 7

Var(Guitar) = ((5-6)2 + (3-6)2 + (7-6)2 + (9-7)2 )/ 4 = (1+9+1+4)/4 = 15/4 = 3.75

Var(Piano) = ((5-7)2 + (9-7)2 + (9-7)2 + (5-7)2 ) / 4 = (4+4+4+4)/4 = 16/4 = 4

Cov(Guitar,Piano) = [(5-6)(5-7) + (3-6)(9-7) + (7-6)(9-7) + (9-7)(5-7) ] / 4 = (2+(-6)+2+(-4))/4 = -6/4 = -1.5

No comments:

Post a Comment