Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 12

nLinear Regression

MATH 111 – MATH IN THE MODERN


WORLD First Semester, SY 2020-2021

Prepared by: Prof. JEAN D. CENTINA


DAVAO DEL NORTE STATE COLLEGE
OBJECTIVES FOR THE LESSON

1. solve for variables in the equation y = b + mx, given a set of data


2. write the linear regression equation, given the set of data 3.
predict the value of a variable given certain conditions
Linear Regression – a statistical tool used to predict the value of a variable given certain
conditions Its simple linear regression equation is y = mx + b.
Given a data set, the constants m and b are determined from the formulas

below. ������ ���� − ��=1


��
����
�� =�� ��=1 ��
����2
��
����2 − ��=1 b = �� − �� ��
�� ��=1 Where
and

�� is the slope;
�� is the sample size;
��
���� ����is the some of all products of x and y;
��=1
��
����is the sum of all y;
��=1
��
����2is the sum of all X2;
��=1
��
����2is the square of the sum of all x;
��=1
b is the y-intercept;
�� is the mean of all y;
�� is the mean of all x.

Study the given example below and its calculation. ��


���� ���� − ��=1
Substituting the values to the formulas:
��
���� ��=1
It has been established that there is a ��
����2
positive correlation between scores in �� =�� ��=1 ��
�� ����2 − ��=1
mathematics and English for a group of ten �� ��
�� ��=1
students. The data are given below. Using these data, determine the linear regression equation and
use this equation to predict the score of a student in Engish test,
who got a score of 3 in the mathematics quiz.
Student Math Score English Score �������� ����2
�� = 10 298 −(48)(50)
2
�� ���� ���� 10 296 − (48)

1 4 5 20 16
�� = 0.884146
2 5 4 20 25

3 9 8 72 81

4 2 3 6 4
b = �� − �� ��
b = 5 - 0.884146 (4.8)
5 8 9 72 64
b = 0.756098
6 1 2 2 1

7 2 1 2 4 Substituting in y = mx + b and
8 7 6 42 49 rounding off to two decimal places, the linear regression equation is
9 6 7 42 36
y = ��. ���� + ��. ���� ��
10 4 5 20 16
Thus, the student who got 3 score in mathematics quiz will have also a
�� = 10 10 10 10 10
score of 3 in English test, as shown below.
����2 = 296
���� = 48 ���� = 50 �������
��=1 ��=1
� = 298 ��=1 y = 0.76 + 0.88 ��
48 50
��=1
y = 0.76 + 0.88 (3)
�� = 10 = 4.8 �� = 10 = 5 y = 3.41 or 3

Solving for m 10 298


USING THE SCIENTIFIC CALCULATOR: (( X )
2
- 5 10 296−(48)
( -
48 ( �� = 0.884146
X .884146
50 X
)) 4.8 b = ��−����
Divided by ) b = 5 - 0.884146 (4.8)
(( = b = 0.756098
10 .756098
x Substituting the values to the formulas: Substituting in y = mx + b and
296 rounding off to two decimal places, the linear
) �� regression equation is
-
�� = �� ��=1 ���� ���� −
�� y = ��. ����+��. ������
( ��=1 ���� ��=1
48 Thus, the student who got 3 score in
X^2 mathematics quiz will have also a score of 3 in
English test, as shown below.
)) ��
����
= ��
����2 y = 0.76+0.88��
0.884146 ��
����2− ��=1 y = 0.76+0.88(3)
y = 3.41 or 3
�� ��=1
Solving for b USING THE SCIENTIFIC �� = 10 298−(48)(50)
CALCULATOR:
Example 2.
The table below lists the scores of nine students in Chemistry and Physics tests.
��
Substituting the values to the formulas: ���� ���� − ��=1
��
���� ��=1
a. Compute for m and b in the linear ��
����2
regression equation. b. Give the regression �� =�� ��=1 ��
��
�� �� ����2 − ��=1
equation.
�� ��=1
c. Predict the Physics score of a student when he or she got a 4 8 6 48 6
score of 10 in Chemistry.
5 9 2 18 8
Student Chemistry Physics ������� ��
�� Score 6 4 3 12 1

���� Score 7 5 4 20 2
8 7 6 42 4
����
9 8 4 32 6
1 3 6 18
�� = 9 ���
2 6 5 30 ���� = ���� = ������
3 5 7 35 55 43 �� = 255
��=9 ��=9 ��=9 ��=9
Rounding off to two decimal places, the linear regression equation is
�� = 6.1 �� = 4.8 y = b + mx

y = 6.24 + (−0.2365) ��
�� = [ 9 255 − 55 43 ]
2
[(9) 369 − 55 ] Thus, the student who got 10 score in Chemistry will have a score of 4 in
Physics, as shown below.
�� = - 0.2365
y = 6.24 + (−0.2365) ��
b = �� − �� �� y = 6.24 + (−0.2365) (10)
b = 4.8 – (-0.2365)(6.1)
b = 6.24 y = 3.875 or 4
x y x y x^2
chem scoresphys scores

3 6 18 9 6 5 30 36 5 7 35 25 8 6 48 64 9 2 18 81 4 3 12 16 5 4 20 25 7 6 42 49 8 4 32 64 55 43 255 369
sum of x sum of y sum of xy sum of x^2 6.111111 4.777778
x mean y mean

m -0.23649 -0.236486
ACTIVITY 9 - LINEAR REGRESSION
PROBLEM A. The table below indicates the total number of enrolees of Ezrah Academy and the corresponding profit from 2008
to 2016.
��
Substituting the values to the formulas: ���� ���� − ��=1
��
���� ��=1
a. Compute for m and b in the linear �� ) �� = �� −( )( ) (��) − ( )��
regression equation. b. Give the regression ��
�� ��
equation. �� =�� ��=1 ��
����2
c. Predict the school’s profit in 2017 , the ��
����2 − ��=1
y , when the total enrolment is 12,000 (the
�� ��=1

YEAR ENROLMENT ���� (in million pesos) �������� ����2 b = �� − �� ��


TOTAL PROFIT ���� �� = ____________ b = ( ) – ( )( )

2008 16,000 250 2014 13,900 220


2009 15,000 200 2015 14,000 240
2010 10,500 150 2016 13,200 180
2011 11,000 180
2012 11,800 190
2013 13,400 200
9 y = _____ + ( ) ��
b = _____________
Thus, school’s profit in 2017 when the total enrolment is
Rounding off to two decimal places, the linear regression 12,000 is P___________, as shown below.
equation is
y = b + mx y = ______ + ( ) ��

�� = _____ �� = ___ �� = ______ ��=1 ______ in million


��=1 2
9
���� = ___ ��=1
9
���� = ___ ��=1 9 = ___ ���� = _____
��������
y = ______ + ( ) ( ) y =

LINEAR REGRESSION PROBLEM B ��=1


��
Substituting the values to the formulas: ���� ���� −
��
���� ��=1
The table below indicates the monthly cost compute for m and b in ��
����2
of electricity against air-conditioning ��
����2 − ��=1
temperature in a household. �� =�� ��=1
��
�� �� �� ��=1
a. Fit the data into a linear equation and
the linear regression equation. temperature of 16 ⁰C in a month (the y).
b. Give the regression equation. Month Air-con Cost of ������� ����
c. Predict the cost of electricity if the air-conditioner is set at a Temperatu Electricity �
��
()−()
re in ⁰C in pesos
���� ���� �� = ____________
1 25 3000
b = �� − �� ��
2 23 3300 b = ( ) – ( )( )
b = _____________
3 21 3500
4 19 3800 Rounding off to two decimal places, the linear regression equation is (y
= b + mx):
5 17 4000
�� =5 5
���� = 5
���� = 5
����� 5 y = _____ + ( ) ��
__ __ ��
��� = ___ Thus, the cost of electricity if the air-conditioner is set at a temperature
��=1 ��=1
of 16 ⁰C in a month is ________pesos, as shown below.
��=1 y = ______ + ( ) ��
�� = ___ �� = ___ ��=1
y = ______ + ( ) ( )

�� = −( )( ) y = ______
PROBLEM C.
A real estate agent wishes to examine the relationship between the selling price of a home and its size (measured in square
feet). Predict the price for a house with 2000 square feet.

House Price in Thousand Size in


Pesos Square Feet (X)
(Y)

245 1400 312 1600


279 1700 308 1875
199 1100 219 1550
405 2350 324 2450
319 1425 255 1700

You might also like