Berl2244_Forecast_Lab2_23
Berl2244_Forecast_Lab2_23
LAB 2: FORECAST
1.
2.
3.
PROGRAMME BEEL
SECTION /
GROUP
DATE
1. ZULHAIRI OTHMAN
NAME OF
INSTRUCTOR(S)
2.
1
Rev Date Author(s) Description
.
No.
1. Zulhairi Othman 1. New online lab
1.0 10
APRIL
2023
1.
2.
2
1. INTRODUCTION
Time series forecasting is a method to make predictions based on historical time series data.
Examples of time series analysis are weather data, heart rate monitoring (EKG), quarterly
sales data and stock prices.
2. OBJECTIVE
To generate simple moving average forecast and chart using Excel average function
and data analysis tool
To generate exponential smoothing forecast and chart using Excel data analysis tool for 2
smoothing constants
3. PROCEDURE
3
𝐴𝑡−𝑛 + ⋯ + 𝐴𝑡−𝟐𝟐 + 𝐴𝑡−𝟑𝟑 + 𝐴𝑡−𝟐𝟐 +
𝐹𝑡 = 𝑀𝐴𝑛 = 𝐴𝑡−𝟏𝟏
= 𝐴𝑡−𝟏𝟏
𝑛
𝟑𝟑
One calculation technique is to insert an Excel function ‘=SUM(B2:B4)/3’ in cell C4.
i) But for this problem, you are going to use another function: in the 4th row e.g. cell
C6 in Figure1.2, type ‘=AVERAGE(B3:B5)’ as in Figure 1.2 – which is the same
equation as using ‘=SUM(B3:B5)/3’.
j) For video reference, you can click this YouTube tutorial – but it shows a 4 period
moving average instead.
k) Copy and paste this function to other cells – for example from C6 until C15.
l) Now change the number format of the Sales and 3 MA data to Currency with
2 decimal places.
Calculating Errors
m) To calculate forecast errors MAD, MSE and MAPE, make the following columns
next to column ‘3 MA’ as in the YouTube tutorial: Error, |Error|, Error2 and % Error –
as in the YouTube tutorial video.
n) In column ‘Error’, calculate the difference between Sales and 3 MA values.
o) In column ‘|Error|’, use function ‘=abs()’ to force negative values to be positive.
p) In column ‘Error2’, use ‘^2’ to square numbers.
4
q) In column ‘% Error’, divide numbers in column ‘|Error|’ by Sales. Then change
its number format to ‘Percentage’ by right-clicking the cell, select Format Cells…,
Number and then Percentage.
r) To calculate mean absolute deviation MAD, MSE and MAPE, add these error
names under the chart and then calculate the average of the respective errors as in
Figure 1.3.
Creating a Chart
s) Select the whole data set – from Month to 3 MA.
t) In the main menu, click Insert > Charts > 2D Line chart icon.
u) Then choose 2D Line chart. Don’t forget to add the chart title appropriately.
5
Problem 1.2: Moving Average using Data Analysis
a) Copy and paste link the table in Table 1.1 in your Data sheet to another Excel sheet.
Rename the new sheet ‘MA DA’. DA stands for Data Analysis that will overwrite
cells next to this table.
b) Before starting with this analysis, check if your Excel already have ‘Data
Analysis’ available as below. Click Data in the main menu:
c) If the Data Analysis tool is not shown in your Excel, activate this tool by following
the steps in the appendix on the last page of this lab sheet. Once this tool is activated,
go to the next step below.
6
f) In the Moving Average dialog box, enter the Input Range – which is the Sales data. If
you select the cell with text ‘Sales’ as well, put a tick on Labels in First Row. The
7
b) In the Moving Average dialog box, the input range is the same as for 3-month
moving average. But the interval is 5.
c) For the output range, set it next to standard error of the 3-month moving average data
as was calculated above. For example, set it to cell E21 until E32 if your table is as in
Figure 1.2 below:
d) Check the Standard Errors but we don’t need the Chart Output. You are going
to insert a 2D chart with 3-month and 5-month MA as below.
Creating a Chart
e) There are several ways to display the 3-month and 5-month forecast data on the same
2D line chart. The technique below create Sales and 3-month MA chart first and then
edit into the chart the 5-month MA forecast.
f) For video reference, click this YouTube multiple line plot tutorial.
g) First select the whole data set that include Month, Sales and 3-month MA – for
example from A20 to C32 as in Figure 1.2.
h) Next in the main menu, click Insert > in Charts area > 2D Line chart icon.
8
i) Then click on your chart so that it is highlighted and select Design in the main
menu and click on the Select Data icon in the toolbar.
You can also right-click on your chart and choose Select Data.
j) To add the 5-month MA data in Select Data Source dialog box, click on Add
under Legend Entries (Series).
k) In the Edit Series dialog box, select the Series name – which is the column header
for your 5-month MA (e.g. cell E20 in Figure 1.2). Then select your Series values –
which is the 5-month MA data (e.g. cell E21 until E32).
Click OK.
l) Click OK in the Select Data Source dialog box to generate a chart that include all
3 line charts.
(If you want, you can rectify the Horizontal (Category) Axis Labels for the 5-month
MA. But it won’t affect your chart.)
m) On your chart, manually change the chart title to appropriate title.
n) You can also change your chart style by clicking on the chart style icon and
selecting the style you want.
9
In Your Lab Report…
o) Add proper table headers to your calculated forecast and error table and add proper
chart title.
p) Copy and paste the whole table to your report that shows Month, Sales, 3-month
MA and Error, 5-month MA and Error.
q) Then paste your moving average chart that display all 3 line charts.
r) Then add a short discussion below the chart – comparing the 3-month and 5-month
moving averages.
a) Copy and paste the table in Table 1.1 to another Excel sheet. Rename this
sheet ‘SES’ – for simple exponential smoothing.
b) You will generate 2 exponential smoothing forecasts using Excel’s Data Analysis
with smoothing constants α = 0.3 and α = 0.7.
The technique is the same as in Problem 1.2 above.
10
h) Similarly as in problem 1.2, click on Data Analysis and choose Exponential
Smoothing in the dialog box.
i) Enter your input range, new output range and click on Standard Errors.
j) Set the appropriate damping factor for α = 0.7.
k) Click OK to generate the forecast.
Creating a Chart
l) Similarly as in problem 1.2, create one proper chart that display sales, forecast for α =
0.3 and α = 0.7.
11
4. APPENDIX
12