Unit 2-Part 3-Linear Regression
Unit 2-Part 3-Linear Regression
Example
A researcher believes that there is a linear
relationship between BMI (Kg/m2) of
pregnant mothers and the birth-weight
(BW in Kg) of their newborn
σx
where r = karl Pearson’s coefficient of correlation
r = cov(x, y) / σxσy
line of regression of y on x
The equation of the line of regression of x on y is
x =a+by ----eq 1
, where x is dependent variable and y is
independent variable.
The line of regression always passes through point
( x, y) , x =a+by -- eq 2
bxy is the slope of the line r σx
σy
line of regression of x on y
Example
House size
11
Example
12
Estimating the Coefficients
15
y on x
y=a+bx substitute the values of a and b
rσ
a=y- bx b= y
y – y= r σy (x – x)
σx
x on y
x=a+by substitute the values of a and b
rσ
a=x- by b =σx x
x – x= r σx (y – y)
σy
Regression
LINE OF REGRESSION:
The equation of the line of regression of y on x is y=a+bx
bYX X bXY = r2
Example 1
Obtain the following for given data:
1) the least square regression line of y on x
2) line of regression of x on y
3) Also obtain an estimate of y for x = 8
4) Estimate value of X for Y = 2
5) Calculate the coefficient of correlation (r)
x 3 4 5 6 4 5 6 7
y 3 5 3 2 3 4 6 6
X Y X-X Y-Y (x-X)2 (Y-y)2 (x-x)(y-
Xmean =EX/n = 40/8 = 5
y)
3 3 -2 -1 4 1 2
Ymean =EY/n= 32/8 = 4
4 5 -1 1 1 1 -1
Coefficient of regression of y
5 3 0 -1 0 1 0
on x is:
6 2 1 -2 1 4 -2
4 3 -1 -1 1 1 1
5 4 0 0 0 0 0
=6/12=0.5
6 6 1 2 1 1 2 Line of regression of y on x is:
7 6 2 2 4 4 4
Sum Sum Sum = Sum= Sum= 6 Y – 4= 0.5 ( X – 5)
= 40 = 32
12 16
Y – 4 = 0.5 X - 2.5
Y = 0.5 X - 2.5 + 4
Y = 1.5 + 0.5 X
Also, Coefficient of regression of X on y is
= 6/16 =0.375
Line of regression of x on y is :
X- 5 = 0.375 ( y- 4)
X= 5 – 1.5 + 0.375 y
X= 3.5 + 0.375 y
Find Y when X=8:
as bYX X bXY = r2
r = (0.5 * 0.375) 1/2 = 0.43
Example 2
or
Find bYX & bXY then find r [as bYX X bXY = r2 ]
Xi Yi Xi- Yi- (xi-x)2 (yi-y)2 (xi-x) Xmean = sum X/n =15/5=3
mean mean (yi-y)
1 2 Ymean = sum Y/n =25/5=5
-2 -3 4 9 6
2 5 For regression line calculation:
-1 0 1 0 0
3 3
0 -2 0 4 0
4 8
1 3 1 9 3
5 7
2 2 4 4 4 =13/10=1.3
Sum Sum
= 15 =25 Sum=10 Sum=26 Sum=13
=0.5
Line of regression of y on x is
=13/26=0.5
Line of regression of y on x is
X-3=0.5(y-5)
X=0.5y+0.5
Calculate Value of r:
as bYX X bXY = r2
r = (1.3 * 0. 5) 1/2 = + 0.806
Example 3
as bYX X bXY = r2 Y on X
5y+3x=52 Y = a + bYXX y = (52/5) + (–3/5) x
X on Y
2x+y=30 X = a + bXYY x = 15 + (-1/2) y
bYX = –3/5
bXY = –1/2 r = - 0.5477
i) Let us consider
Line of y on x : 8x- 10y+66=0 y = 6.6 + 0.8 x bYX = 0.8
Line of x on y : 40x-18y =214 x = (214/40) + (18/40) y bXY = 18/40
as bYX X bXY = r2
r2 =0.8 *18/40 = 0.4 * 0.9 r = + 0.6
iii)
bYX = r σY / σX
0.8 = 0.6 * σY / 3
σY= 0.8 * 3 /0.6 = 4
σY = 4
Mean x= 67.657
Mean y = 68.70
r=0.513
Practice Questions
The two regression lines obtained from certain data were
y=x+5 and 16x =9y-94. find the variance of X where variance
of y is 16. also find the covariance between X and Y
(ans variance of X= 9, cov =9)
(hint : cov(x,y)/σxσy = r)
Practice Questions
The two regression lines obtained from certain data were
y=x+5 and 16x =9y-94. find the variance of X where variance
of y is 16. also find the covariance between X and Y
(ans variance of X= 9, cov =9)
(hint : cov(x,y)/σxσy = r)
Given: y = x +5 bYX = 1
16x =9y-94 bXY = 9/16
as bYX X bXY = r2
r= (1 * 9/16) 1/2 = 3/4---eq 1
x 1 3 4 6 8 9 11 14
y 1 2 4 4 5 7 8 9