CO 4 Session 34 Linear Regression and Its Applications

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

Mathematics for Computing

20MT1101
I/IV B. Tech. Semester-1
A.Y. 2021-2022

19/11/2022 MFC 1
Session 34

Linear Regression and


its Applications

19/11/2022 MFC 2
Regression
Definition: Regression is the measure of the average relationship between
two or more variables in terms of original units of data.

 The measure of the average relationship between two variables is called


bi-variate regression, and the measure of the relationship between three
or more variables is called multivariate regression.
 If two variables X and Y are correlated i.e., there exists an association
between them, we can see that the scatter diagram will be more or less
concentrated around a curve. This curve is called curve of regression.

19/11/2022 MFC 3
Lines of regression:
• When the dots of the scatter diagram tend to cluster along a well-defined
direction, it suggests a linear relationship between the two variables x and
y. Such a line of best-fit for the given distribution of dots is called the line
of regression.

• If the curve is a straight line, it is called the line of regression and the
regression is a linear regression.
• We shall have two regression lines as the regression of X on Y and the
regression of Y on X.
• The Regression line of Y on X gives the most probable values of Y for given
value of X.
• The Regression line of X on Y gives the most probable values of X for given
values of Y.
19/11/2022 MFC 4
Regression line equations
The equation of the regression line of Y on X is , …. (1)
where byx = is the regression coefficient of Y on X
This equation is used to predict the unknown values of Y for given values of X.
 
The equation of the regression line of X on Y is …. (2)
where bxy = is the regression coefficient of Y on X.
This equation is used to predict the unknown values of X for given values of Y.
In both equations = is the mean of X values and = is the mean of Y values.
 
Note1: The two regression lines intersect at the point (.
Note2: Both the regression coefficients must be of the same sign, and both can’t be
greater than one.
 

19/11/2022 MFC 5
Example:1
The values of x and the corresponding values of y are shown in the table
below:
X 0 1 2 3 4
y 2 3 5 4 6

a)Determine the regression line of y on x


b)Estimate the value of y when x=10
c)Determine the regression line of x on y

19/11/2022 MFC 6
Solution:
We now use the following table to compute the required sums

x y xy x2
0 2 0 9 4
1 3 3 1 9
2 5 10 4 25
3 4 12 9 16
4 6 24 16 36
=10 =20 =49 =30 =90

19/11/2022 MFC 7
Substituting n=5, =10, =20, =49 and =30 in the formula of regression coefficient of y
on x
byx = = = 0.9 , = = = 2 and = = 4
Equation of the regression line of y on x is y – = byx (x-
…. (1)
To find the value of y when x=10, put x=10 in (1).
Then y= 0.9(10) + 2.2= 11.2.
Substituting n=5, =10, =20, =49 and =90 in the formula of regression coefficient of x
on y
bxy = = = 0.9
Equation of the regression line of y on x is
…. (2)

19/11/2022 MFC 8
Example:2
The sales of a store ( In million rupees) for each year are shown below:

X(Year) 2005 2006 2007 2008 2009


Y(Sales) 12 19 29 37 45
a) Determine the regression line of Y on X
b) Use the regression line as a model to estimate the sales of the company in 2012.
Solution:
We first exchange the variable x in t such that t=X-2005 and therefore t represents
the number of years after 2005. Using t instead of x makes the numbers smaller
and thus manageable. Then the table of values becomes
t(Years after2005) 0 1 2 3 4
Y(Sales) 12 19 29 37 45

19/11/2022 MFC 9
Solution:
We now use the following table to compute the required sums

t y ty t2
0 12 0 9
1 19 19 1
2 29 58 4
3 37 111 9
4 45 180 16
=10 =142 =368 =30

19/11/2022 MFC 10
Substituting n=5, =10, =142, =368 and =30 in the formula of regression
coefficient of y on t
byt = = = 8.4, = 2 and = 28.4

Equation of the regression line of Y on t is y – = byt (t-


y- 28.4 = 8.4(t-2) y= 8.4t +11.6

To find the sales of the company in the year 2012 is obtained by putting
t= (2012-2005)=7 in (1)
Y= 8.4(7)+11.6= 70.4 million rupees.

19/11/2022 MFC 11
Example 3:
The age X in months and vocabulary Y were measured for 6 children, with
the results shown in the following table.

X 13 14 15 16 17 18
Y 8 10 15 20 27 30

(a) Compute the regression line Y upon X.


(b) Estimate the vocabulary when the age is 2 years.

19/11/2022 MFC 12
Solution:
We now use the following table to compute the required sums

x y xy x2
13 8 104 169
14 10 140 196
15 15 225 225
16 20 320 256
17 27 459 289
18 30 540 324
=93 =110 =1788 =1459

19/11/2022 MFC 13
Substituting n=6, =93, =110, =1788 and =1459 in the formula of regression
coefficient of y on x
byx = = = 4.74, = = =15.5 and
= = = 18.33
Equation of the regression line of y on x is y – = byx (x-
- 18.33 = 4.74(x-15.5) y= 4.74x -15.5 ….(1)
To find the vocabulary of the child when the child is 2 years is obtained by
putting x= 24 months in (1)
y= 4.74(24)-55.17= 58.89 59 words.

19/11/2022 MFC 14
Example: 4
The fat content in grams and calories for several burgers at a fast-food
restaurant are given below:

Fat(g) 20 23 31 33 37 38 40 43

Calories 410 490 570 590 580 630 670 680

Determine the equation of regression line to predict calories from fat and
estimate the calories when the fat is 35 grams.

19/11/2022 MFC 15
Solution:
Let X be the fat content and Y be the calories of a burger. Then we have to
find the regression line of Y on X.
We now use the following table to compute the required sums
x y xy x2
20 410 820 400
23 490 11270 529
31 570 17670 961
33 590 19470 1089
37 580 21460 1369
38 630 23940 1444
40 670 26800 1600
43 680 29240 1849
=265 =4620 =158050 =9241

19/11/2022 MFC 16
Substituting n=8, =265, =4620, =158050 and =9241 in the formula of
regression coefficient of y on x
byx = = = 10.829 ,
= = = 33.125 and
= = 577.5
Equation of the regression line of Y on X is y – = byx (x-
y- 577.5 = 10.829(x-33.125) y= 10.829x +218.78 …. (1)
To find the calories when the fat is 35 grams put x=35 in (1).
Then y= 10.829(10) + 218.78= 327.07 calories.

19/11/2022 MFC 17
Practice Problems:
1) In an attempt to increase the yield Y (Kg/h) of an industrial process a technician
varies the percentage of a certain additive(X) used when keeping all other
conditions as constant as possible. The results are shown below:
=34; =1057; =4504; =15.5.
Calculate the equation of the regression line of yield on percentage additive.
2) An experiment is conducted to investigate variation of solubility of chemical X in
water. The quantities in Kg. that dissolved in one liter of water at various
temperatures are shown in the following table:
Temperature 15 20 25 30 35 50 70
C(Y)
Mass of X (Kg) 2.1 2.6 2.9 3.3 4.0 4.1 7.0

Calculate the equation of the regression line of Y on X. What quantity must be


expected to dissolve at 42 degrees C?

19/11/2022 MFC 18
3) A student counted the number of words in an essay she had written, recording the total
every 10 lines
No. of lines (X) 10 20 30 40 50 60
No. of words (Y) 75 136 210 291 368 441

Find the formula to convert lines to words. How many words (approximately) has she
written if she writes (a) 35 lines (b) 100 lines?
4) If six test areas were given different concentrations of a new fertilizer and the resulting
crop was weighed

Concentration g/L (X) 1 2 4 6 7 8

Weight of crop (Y) 7 11.1 16.2 23.9 27 29

Draw the scatter plot diagram to show the data. Calculate the equation of the regression
line of Y on X and show it in your diagram. What increase in weight of crop might be
expected from raising the concentration of fertilizer by 1 g/L?
19/11/2022 MFC 19
5) The experimental data below were obtained by measuring the horizontal
distance Y cm, rolled by a n object raised from the point on a plane inclined
at to the horizontal

Distance (Y) 44 132 152 87 104 91


Angle () 8.0 25.0 31.5 17.5 20.0 10.5

Calculate the equation of the regression line of distance on angle. Estimate


the distance the original object would roll if released at an angle of (i) 12 0
(ii) 400.
 

19/11/2022 MFC 20
19/11/2022 MFC 21

You might also like