Forecasting - Linear regression - Example 1 - Part 1
In this video, you will learn how to find the demand forecast using linear regression.
Closed Caption:
let's look at an example of forecasting
using the linear regression analysis
maxis sales corporation is in the
business of selling laptops they
realized the advantages of forecasting
very early in their business they also
realized that in order to perform
effective forecast they need to keep
track of their current and past sales
numbers
currently they are in the process of
forecasting their sales numbers for each
quarter of the coming year in order to
this they have pulled up their sales
numbers for the last 12 quarters these
numbers have been given to us in this
table so for each quarter we have been
given the sales figures so for the first
quarter their sales were 600 now this is
all in terms of units for the second
quarter of their sales were 1550 units
third-quarter 1500 units and so on
use the least-squares method to find
forecast for the next four quarters so
we have to find the forecast for quarter
number 13 14 15 and 16 also find out
this standard error of the estimate now
in linear regression analysis there are
two types of variables first one is the
dependent variable
and second is the independent variable
so in our case time which is expressed
in terms of quarters is the independent
variable while sales is the dependent
variable so as it clearly is understood
here the number of quarters is not
dependent on the sales but the sales
figures are varying by the number of
quarters so the dependent variable is
the one that want to forecast because we
want to find out the forecast four
quarters 13 14 15 16 in terms of sales
units in linear regression analysis the
relationship between the variables is
assumed to be a straight line now the
equation of a straight line is generally
noted as y is equal to M X plus C we
have c is the constant and also the
y-intercept and m is the slope of the
straight line in linear regression
analysis it is commonly denoted as y is
equal to a plus B X here y is equal to
the dependent variable
for which we are trying to solve is
equal to the y-intercept be is the slope
and X is the independent variable which
in this case is time
so basically a is nothing but C in this
case because a is the y-intercept and in
our normal equation of a straight line c
is the y-intercept and b is nothing but
the slope of the line and X&Y remain as
it is so basically if the plot these
sales figures for the data that has been
given to us then the graph that looks
something like this
let's say time is on the x-axis because
x axis is the independent variable which
is time and y-axis is the dependent
variable so this will be sales now
reporting this to scale but you know the
point if we try to plot on this graph
will look something let's say like this
so this is nothing body
sales data now the least-squares method
is used to determine the line that can
be drawn using these points such that
the sum of the squares of the vertical
distances between each data point and
it's corresponding data point on the
line is minimized
so let's say we draw a line here let's
say this is the line so this is the
regression line now corresponding to a
value on the x-axis we will have a
corresponding point on this regression
line in relation to this sales data so
let's say this is why
and here we will have y dash so this
distance is known as the deviation
and we have to draw this line in ave
that these thumb of the squads of the
vertical distance between each data
point which in this case is represented
as Y and its corresponding data point on
the line is minimized
so basically if you calculate this
distance and then square each of these
and then add the squares of these
distances then that should be minimized
then we'll say that the regression line
is that good fit so basically in other
terms what we want to minimize is y 1
minus y 1 dash squared plus y 2 minus y
2 dash squared plus so on till white 12
minus y well dash square in this case
I'm taking 12 because we have 12
quarters so once we get this line which
is the best fit based on the data points
that has been given to us then if we
extend this line to the future quarters
then we can get the value of sales
corresponding to time . so if we draw
this in a graph to scale then using this
technique we can then find out these
sales numbers for the future quarters we
can also find out the numbers for the
future quarters by using a formula
limited so using the formula basically
we have to find out the values of a and
B and once we have the values of a and B
then if we put the value of x
which is the order number then we'll get
the corresponding value of y which is
the sales for that particular quarter
now it can be found out by using the
formula e is equal to x bar minus B X
bar and b is equal to Sigma X Y minus n
x bar y bar divided by sigma x squared
minus n x bar square where is the
y-intercept be is the slope of the line
y bar is the automatic mean of all wise
x bar is the automatic mean of all exes
x is the x axis values of each data
point why is the y axis values of each
data point and n is the number of data
points
so here basically for a what we have
done is we have brought TX on the other
side so becomes y minus B X now since we
have multiple values of X&Y we are
considering the mean values of X&Y
that's why x bar and while so a is
derived from here but again we derive
only if B is known and b is equal to
Sigma XY minus n x bar y bar divided by
sigma x squared minus n into X bar squad
now one easy way to remember this is
basically if you remember the numerator
Sigma X into y minus n X bar Y bar in
order to arrive at the denominator
replace wise with X so basically what
this becomes as x x x which becomes x
squared so minus $OPERAND and x x bar
into X bar so X bar into X bar becomes x
bar square so denominator becomes sigma
x square minus n x bar square so let's
proceed to find out these values so here
i have more down the values of X&Y which
in our case X is time and why is the
sales the first we'll try to find out
the value of B so in order to find the
value of B we have to find out the
values of x x y for each of these
quarters and then we have to add them up
so let's first find out x x y so 600 x 1
is 615 50 x 2 is 3100
1500 x 3 is 4500 1500 multiple over for
is 6,000 and so on so let me calculate
all these remaining values so these are
all the values of x x y and we need to
find out the sum of all these values so
let me do the total so the total astoria
16,200 now next we have to find out the
multiplication of n X bar and wine bar
now x bar is nothing but the average of
all the values of X and the average will
be the sum of the values of x divided by
n which is the number of values and y
bar is similarly the sum of all values
of Y divided by n so let me find out the
sum of all the X's and Y's so the sum of
all exit 78 so this becomes 78 / n which
is 12 so this is equal to 6.5 sum of all
wise is 33,000 350 / n which is 12 so
this becomes 277 9.17 so now we know
these some of the multiplication of x
and y we know the values of x bar y bar
we also need to find this sum of the
values of x squared so we have X but we
don't have x squared so let's find out
the values of x squared and then add
them up so x squared 1 square is 1 2
square is 4 3 squared is 9
foursquare is 16 5 squared is 25 and so
on
let me put the values here so the
talking is 650 so now we have all the
values that we need to calculate be so
let's proceed and calculate b so b is
equal to sum of X Y which is this so 268
200 minus in which is 12 x x bar which
is 6.5 x y bar which is 2779 . 17 / sum
of x squared so this is x squared some
650 minus n which is 12 x x bar square X
bar is 6.5 26.5 square so let me put my
calculator here 12 x 6.5 x 277 9.17
enter so this is 268 200 minus this
value here so this becomes 2 167 75.2
6/6 of t minus so
6.5 squared x 12 is 507 so this is equal
to 26 820 0-2 1677 5.26 so this is 5 14
24.7 4/6 fifty- 507 which is 143 so this
is equal to $OPERAND / 143 so three 59.6
so this is the value of B
now we can plug in this value into this
equation to find the value of e so let's
do that
so is equal to y bar minus B X bar Y bar
is 277 9.17 minus B which is 359 or in 6
x x bar 26.5 so this is equal to that
people the calculator here so three 59.6
x 6.5 minus and this 2277 9.17 so the
one who is 440 1.77 so this is equal to
440 1.77 so this is the value of e so at
this point we have the values of both a
and B so we can come up with the
equation of the regression line so let
us plug these numbers into that equation
so the equation of the regression line
is y is equal to a plus B X so plugging
in the values of a and B in this
equation so y is equal to 440 1.77 plus
59.6 X now ask for the example we have
to find the value of sales for the 13 14
15 and 16 quarter so in place of X will
put the values of 13 14 15 and 16 and we
can find out the corresponding alyssa
fly so let us do that so why 413 quarter
is equal to
440 1.77 plus 3 59.6 x 13 so this is
equal to 5 11 6.57 similarly Y 414 is
equal to four 41.7 7 plus 3 59.6 x 14
and this is equal to 5 47 6.17 y 4 15 is
equal to four 41.7 7 plus 3 59.6 x 15
and this is equal to 583 5.77 and y 4 16
is equal to four 41.7 7 plus 3 59.6 x 16
and this is equal to 6 195 . 37 so these
are the sales figures for the thirteen
fourteen fifteen sixteen quarter now in
the next part of this video we will find
out the standard error of the estimate
to evaluate how good this regression
line was
Video Length: 24:05
Uploaded By: maxus knowledge
View Count: 20,460