You are on page 1of 9

POM

Module 3: Demand Forecasting


Unit 5: Linear Regression Forecasting

Overview:

In this Unit, you will learn how to forecast using Linear Regression Analysis.

Module Objective:
After successful completion of this Unit, you should be able to:

• Forecast demand using Linear Regression Analysis.

Course Materials:
• Handout: Linear Regression Forecasting

Read:

LINEAR REGRESSION ANALYSIS

In this Unit, we will just limit our discussion on simple linear regression analysis. That
is, we will consider only:

1. Two variables: the dependent variable, y, being either demand or sales; and the
independent variable, x, being any factor deemed to influence demand or sales;
these factors, also referred to as predictors of y may include: time (indirect
predictor, of course, since other factors which are changing through time could
be the direct predictors), product price, promotion expenditures, population rate
(which, in turn, is affected by immigration, emigration, birth, and death rates),
inflation rate, seasons of the year (which could be expressed in terms of
quantifiable factors, such as temperature, precipitation, etc.), and so many other
ecological, economic, socio-cultural, politico-legal and technological factors.
Predictors should be quantifiable, so they could prove useful for quantitative
forecasting purposes.

2. Linear relationship between the two variables, x and y, which is expressed


according to the slope-intercept form of a linear equation: y = a + bx, where:
y = the dependent variable, demand or sales
a = the y-intercept; i.e., the value of y where the regression line intersects the y-
axis or the value of y when x is 0.
b = the slope of the line; that is, the rate of change of y with respect to the rate
of change of x.
x = the independent variable; the variable that affects y.

Linear regression is a statistical tool used to help predict future values from past values
of y based on its response to changes in x. A linear regression trendline uses the least
squares method to plot a straight line through plotted (x, y) data pairs, such that the
distances between the points and the resulting trendline are minimized.

When x is time, forecasting is done by projecting or overextending the regression line


into the future, with the assumption that whatever trend that was observed in the past,
and the underlying reasons behind it, will continue on into the future.

https://www.excel-easy.com/examples/trendline.html

When x is not time, however, the regression line may be validly used for forecasting
purposes only within the relevant range; i.e., only within the range of x values in the
given x and y data pairs. Referring to the Figure on the next page, the relevant range is
only within the minimum advertising expenditure of around $45 to a maximum of $100.
Forecasting sales corresponding to advertising expenditures lower than $45 or greater
than $100 may no longer be as accurate as when the values of the predictor variable
are within the relevant range, say, at $70.
Relevant Range

https://www.ablebits.com/office-addins-blog/2018/10/03/make-scatter-plot-excel/

Simple linear regression forecasting involves searching for a variable x that has a linear
relationship with y; establishing that linear relationship by calculating the correlation
coefficient, r; deriving the equation of the regression line; and using that derived
equation to forecast values of y given values of x.

STEPS IN LINEAR REGRESSION FORECASTING

Step 1. Gather pairs of x and y data, where y is demand or sales and x is any variable
that is likely to affect y. Bear in mind that there could be a time lag between x and y, so
the decision on which x data is to be paired with which y data is crucial. For example,
the impact of an intensified product promotion done this month may only be felt 3
months later, so if you pair the promotion expenses for, say, March with the sales in
March, your data set may not be reflective of reality and your forecasting efforts could
be in vain.

Step 2. Verify if the relationship between x and y is linear; that is, calculate the
correlation coefficient, r. If |r| < 0.7, better not use linear regression forecasting and
use other forecasting methods or models. If |r | ≥ 0.7, you may proceed to Step 3.

Step 3. Derive the equation of the regression line, which is of the form: y = a + bx.

a. Calculate the slope of the line, b.


b. Calculate the y-intercept of the line, a.
c. Substitute the values of b and a to y = a + bx.

Step 4. Use the derived linear regression equation to forecast demand or sales given
values of x.
Calculate:
LINEAR REGRESSION FORECASTING EXERCISE

Shakey’s is interested in establishing the relationship between its advertising and sales
based on the following data:

Advertising Sales
Quarter (P100,000) (P Million)
1 4 1
2 10 4
3 15 5
4 12 4
5 8 3
6 16 4
7 5 2
8 7 1
9 9 4
10 10 2

1. Can Shakey’s use linear regression analysis to forecast its future sales given a
planned advertising expenditure?

2. Determine the estimated equation of the regression line that defines the
relationship between sales and advertising.

3. If Shakey’s advertising expense for the next quarter is expected to be P 1,100,000,


what would be the corresponding sales forecast?

4. If Shakey’s spends 5% of sales on pizza boxes, how much boxes, in peso volume,
should its operations manager order for the next quarter?

Solution

1. Can Shakey’s use linear regression analysis to forecast its future sales given a
planned advertising expenditure?

• To answer this question, we need to calculate the regression coefficient, r.


𝑛𝑛 ∑ 𝑥𝑥𝑥𝑥−∑ 𝑥𝑥 ∑ 𝑦𝑦
𝑟𝑟 = , must be greater than 0.7 for us to say “Yes”.
�[𝑛𝑛 ∑ 𝑥𝑥 2 −(∑ 𝑥𝑥)2 ][𝑛𝑛 ∑ 𝑦𝑦 2 −(∑ 𝑦𝑦)2 ]

• To solve for r, we need first to calculate the values of the following:


1. 𝑛𝑛
2. ∑ 𝑥𝑥𝑥𝑥
3. ∑ 𝑥𝑥
4. ∑ 𝑦𝑦
5. ∑ 𝑥𝑥 2
6. (∑ 𝑥𝑥)2
7. ∑ 𝑦𝑦 2
8. (∑ 𝑦𝑦)2

• 𝑛𝑛 is the number of data pairs (xi, yi); in this case, 𝑛𝑛 = 10


• ∑ 𝑥𝑥𝑥𝑥 is the sum of the products (xiyi) of each data pair
• ∑ 𝑥𝑥 is the sum of xi
• ∑ 𝑦𝑦 is the sum of yi
• ∑ 𝑥𝑥 2 is the sum of the squares of xi
• (∑ 𝑥𝑥)2 is the square of the sum of xi
• ∑ 𝑦𝑦 2 is the sum of the squares of yi
• (∑ 𝑦𝑦)2 is the square of the sum of yi

Advertising Sales
Quarter (P100,000) (P Million)
xi yi xi yi xi2 yi2
1 4 1 4*1=4 42 = 16 12 =1
2 10 4 10 * 4 = 40 102 = 100 42 = 16
3 15 5 15 * 5 = 75 152 = 225 52 = 25
4 12 4 12 * 4 = 48 122 = 144 42 = 16
5 8 3 8 * 3 = 24 82 = 64 32 = 9
6 16 4 16 * 4 = 64 162 = 256 42 = 16
7 5 2 5 * 2 = 10 52 = 25 22 = 4
8 7 1 7*1=7 72 = 49 12 = 1
9 9 4 9 * 4 = 36 92 = 81 42 = 16
10 10 2 10 * 2 = 20 102 = 100 22 = 4
∑𝑥𝑥 = 96 ∑𝑦𝑦 = 30 ∑𝑥𝑥𝑥𝑥 = 328 ∑x2 =1060 ∑y2 =108
(∑𝑥𝑥)2 = 9216 (∑𝑦𝑦)2 = 900

• Thus, the regression coefficient, r, is


10(328)−(96)(30) 3280−2880 400
𝑟𝑟 = = = = 0.801
�[10(1060)−9216][10(108)−900] �[10600−9216][1080−900] �[1384][180]

• Since r = 0.801 > 0.7, there’s strong correlation or linear relationship between x
(advertising expenditures) and y (sales); therefore, Shakey’s can use linear
regression to forecast y given values of x. (Note, however, that this conclusion is
valid only within the relevant range or the range of x values between P400,000
and P1,600,000; see the given data).
2. Determine the estimated equation of the regression line that defines the
relationship between sales and advertising.

• The linear regression equation is of the form: y = a + bx, where a is the y-intercept
of the line, and b is the slope of the line.

• What we need to do first is to calculate the slope, b, using the equation:


𝑛𝑛 ∑ 𝑥𝑥𝑥𝑥−∑ 𝑥𝑥 ∑ 𝑦𝑦 400
𝑏𝑏 = = = 0.289
𝑛𝑛 ∑ 𝑥𝑥 2 −(∑ 𝑥𝑥)2 1384

𝛥𝛥𝛥𝛥 𝐶𝐶ℎ𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑖𝑖𝑖𝑖 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠, 𝑃𝑃 𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚


• Since 𝑏𝑏 = = , then b can be
𝛥𝛥𝛥𝛥 𝐶𝐶ℎ𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑖𝑖𝑖𝑖 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒, 𝑃𝑃 100,000
interpreted as: For every P100,000 increase in advertising expenditure, sales
increases by P289,000.

• Next, we calculate the y-intercept of the regression line using the equation
∑ 𝑦𝑦 − 𝑏𝑏 ∑ 𝑥𝑥 30 − 0.289(96)
𝑎𝑎 = = = 0.226
𝑛𝑛 10

• Since a is the y-intercept or the value of y when x is zero, we may interpret a as:
Shakey’s may expect quarterly sales of around P226,000 even if they don’t
advertise.

• The linear regression equation is obtained by substituting the values of a and b


into the equation y = a + bx; thus,

y = 0.226 + 0.289x , where x is advertising expenditures in P100,000 and y is


sales in P million.

3. If Shakey’s advertising expense for the next quarter is expected to be P1,100,000,


what would be the corresponding sales forecast?

• Note that we cannot immediately substitute the value P1,100,000 as x into the
linear regression equation because x is supposed to be expressed in P100,000.
Hence, the value of x should be 11, since there are 11 P100,000 in P1,100,000.

• Substituting and solving for y

y = 0.226 + 0.289x = 0.226 + 0.289(11) = P3.405 million = P3,405,000.

4. If Shakey’s spends 5% of sales on pizza boxes, how much boxes, in peso volume,
should its operations manager order for the next quarter?

• Let B = the budget for pizza boxes for the next quarter (Quarter 11)

• B = 0.05(P3,405,000) = P170,250

If you’re interested, the procedure for using the built-in Linear Regression formulas in
your scientific calculator is found in the Appendix below.
Activities/Assessments:
Activity 9. Do the Exercise below:
Appendix
Note: The keys to press may vary depending on the calculator model or brand that you are using.

HOW TO USE THE LINEAR REGRESSION FUNCTION OF YOUR CALCULATOR


(Gray Screen; Black Font)

Step 1: Switch calculator ON


ALL

Step 2: Clear the calculator’s memory: SHIFT CLR 3 = =

REG LIN

Step 3: Go to Linear Regression Mode: MODE 3 1

Step 4: Encode Data: x1 y1


, M+

x2 y2
, M+

x3 y3
, M+

xn yn
, M+

Step 5: Determine the value of r: SHIFT 2 3 =

Step 5: Determine the value of a: SHIFT 2 1 =

Step 6: Determine the value of b: SHIFT 2 2 =

Step 7: Substitute the values of a and b to the model: y = a + bx


Note: The keys to press may vary depending on the calculator model or brand that you are using.
HOW TO USE THE LINEAR REGRESSION FUNCTION OF YOUR CALCULATOR
(Green Screen; Blue Font)

Step 1: Switch calculator ON


ALL

Step 2: Clear the calculator’s memory: SHIFT CLR 3 = AC

STAT A+BX

Step 3: Go to Linear Regression Mode: MODE 2 2

x y
Step 4: Encode Data:
1
2
3
4
5

:. :. :.
n

Step 5: AC
REG
Step 6: Determine the value of r: SHIFT 1 5 3 =

REG

Step 7: Determine the value of a: SHIFT 1 5 1 =

REG
Step 8: Determine the value of b: SHIFT 1 5 2 =

Step 9: Substitute the values of a and b to the model: y = a + bx

You might also like