9/28/2023
Chapter 5. Basic Forecasting Methods
Nguyen VP Nguyen, Ph.D.
Department of Industrial & Systems Engineering, HCMUT
Email:
[email protected] Last Period Demand (Naïve Model)
• The forecast for the next period is simply the actual
demand observed in the current period.
Yˆt 1 Yt
where 𝑌t+1 = forecast made at time t for time/period t+1
𝑌 = actual demand in the period t
• This model is particularly useful when demand is stable,
and there is no trend or seasonality. Its forecasts can be
very inaccurate for more complex, non-stationary time
series.
• It’s also helpful as a benchmark to evaluate the
performance of more complex forecasting models.
2
1
9/28/2023
The naïve drift method
• The method incorporates the overall trend (drift) in the
data series from the first observation to the last and
extrapolates the trend observed in the historical data.
• not be suitable when the time
series has seasonality,
Y Y cyclical patterns, the trend is
Y T h YT T 1 h nonlinear.
T 1 • the trend between the first
and the last observed value
where: is representative of the
overall trend in the series,
Y1 is the first observed value
which might not include
YT is the last observed value series with structural breaks.
T is the total number of observations
h is the number of periods ahead you are forecasting
3
The naïve drift method
• This method is used for a quick, interpretable, and
trend-adjusted forecast without developing a more
complex model.
• Example: Alphabet Inc. (GOOG), Historical Prices,
Close* (Close price adjusted for splits)
2
9/28/2023
Dataset
• https://finance.yahoo.com/lookup
• https://www.nasdaq.com/market-
activity/stocks/goog/historical
Costco Wholesale Corporation COST
Amazon.com, Inc. AMZN
Target Corporation TGT
Micron Technology, Inc. MU
Modified Naive Model
• Forecast value is equal to the previous observed
value plus a proportion of the most recently observed
rate of change in the variable.
• Use (Yt-1-Yt-2) to consider the direction from which we
arrived at the most recent observation.
Yt Yt 1 p Yt 1 Yt 2
where
Y1 is the first observed value.
p is the proportion of the change between
periods t-2 and t-1 that we choose to include in
the forecast
6
3
9/28/2023
Forecast Accuracy of Naïve Model vs. Modified
Naive Model
• Example 1: The quarterly sales of saws from 2000 to
2006 for the Acme Tool Company.
Naïve Modified Naïve
p 0.6
MAD 152.308 MAD 151.852
MSE 39907.692 MSE 29074.074
RMSE 199.769 RMSE 170.511
MAPE 0.357 MAPE 0.368
MPE -0.005 MPE -0.072
ME 14.615 ME 7.407
7
Forecast Accuracy Interpretation
• a forecast error is considered small or large? Consider
all sets of Forecast Accuracy MAD, MSE, RMSE,
MAPE
Every forecast value is deviated an average value
of_MAD_____
If the percentage error MAPE is low, close to zero, the every
forecast value is not biased by a percentage of ___
• A smaller Accuracy Measures indicates a better fit of
the model to the data
4
9/28/2023
Regression Analysis
• Regression analysis established a temporal
relationship for the forecast variable.
The variable to be predicted (demand) is referred to as the
dependent variable
The variable of time-stamp (dấu thời gian) used in predicting
is called the independent variable.
• The simplest of relationship is a linear regression.
• The basic equation for the straight line that express
demand (Y) as a function of time (t) is
Yt 0 1t t
Yt b0 b1t
Yt 0 1 X t t
9
Regression Analysis: Trend Models
• Three three trend model types are especially useful in forecasting:
Yt b0 b1t for t 1, 2, , n linear trend
All three models can be
Yt b0 eb1t for t 1, 2, , n exponential trend fitted by Excel,
Y b b t b t 2 for t 1, 2, , n quadratic trend InputAnalyzer, MINITAB,
t 0 1 2
Matlab
𝑌 : dependent variable at time t
b0: constant term
b1: linear coefficient (quad) / Growth rate (expo)
b2: quadratic coefficient
• Trend model types are the simplest model and may suffice for short-run
forecasting or as a baseline model (the first simple attempt at modelling
which provides a baseline metric as a reference point)
• Linear model:
a straight-line relationship between the independent variable (often time) and
the dependent variable.
Use when the data shows a constant rate of change over time.
10
5
9/28/2023
Regression Analysis: Trend Models
• Quadratic Trend Model:
a type of polynomial trend model where the relationship between
the independent and dependent variable is represented by a
second-degree polynomial.
Use when the data shows a curve, with the rate of change in the
dependent variable increasing or decreasing over time.
• Exponential Trend Model:
The exponential trend model represents a relationship where the
dependent variable grows or declines at a constant percentage
rate over time.
Use when the data shows exponential growth or decay, such as
population growth or compound interest
• Any trend model’s forecasts become less reliable as they
are extrapolated farther into the future.
11
Regression Analysis: Assessing Fit
• Several methods and metrics used for assessing the fit of a
regression model:
Coefficient of Determination (R2):
͟ R2 represents the proportion of the variance in the dependent variable that is
predictable from the independent variable(s).
͟ Values of R2 range from 0 to 1; a higher indicates a better fit. However, R2 can be
artificially high if overfitting occurs.
Adjusted *R2:
͟ Similar to R2 but adjusts for the number of predictors in the model.
MAD, MSE, RMSE, MAPE:
͟ These metrics provide a measure of the average error in the model predictions.
͟ Lower values indicate better fit,
͟ especially useful when comparing different models.
Residual Plots:
͟ Plotting residuals (the differences between observed and predicted values) can help
assess the fit.
Normality of Residuals:
͟ For inference purposes, the residuals should ideally follow a normal distribution.
͟ Histograms, Q-Q plots, or statistical tests like the Shapiro-Wilk test can be used to
assess the normality of residuals.
F-Test in ANOVA, T-Tests for Individual Coefficients, Durbin-Watson
12
Test, AIC and BIC
6
9/28/2023
Simple Averages
• A simple average or simple moving average (SMA) uses the
mean of all relevant historical observations to compute the
initialization part of the data and to forecast the next period
t
Initialization Y Y ... Yt Y i
part: Yˆt 1 1 2 i 1
t t
where: 𝑌 = forecast made at for period t for time/period t+1 ,
Yi = actual demand in periods i,
t = number of time periods which we count
• SMA is used when the forces generating the series to be
forecast have stabilized and the environment in which the
series exists is generally unchanging.
13
Moving Averages (MAs)
• Simple moving averages (SMA) uses the mean of all the data to
forecast while moving averages (MAs) is more concerned with
recent observations, that means a new mean is computed by
adding the newest value and dropping the oldest.
• By definition,
MAs - moving averages are a series of averages calculated using sequential
segments of data points over a series of values.
Segments have a moving length, which defines the number of data points to
include in each average.
• Moving averages can
smooth time series data,
remove seasonal patterns and reveal underlying trends
• Smoothing
is the process of removing random variations that appear as coarseness in a
plot of raw time series data.
reduces the noise to emphasize the series that can contain trends and
cycles.
14
7
9/28/2023
Moving Averages (MA) or Trailing Moving Average (TMA)
• A moving average of order k, MA(k), is the mean value of
k consecutive observations.is computed kby
Y Y Y ... Yt k 1 Y t i 1
Yˆt 1 t t 1 t 2 i 1
k k
where: 𝑌 = forecast demand for period t+1
Yt-i = actual demand in periods t-i
k = number of terms in the moving average
• The moving average for time period t is the arithmetic
mean of the k most recent observations.
• The moving average model does not handle trend or
seasonality very well, although it does better than the
simple average method.
• The choice of the value of k should be determined by
experimentation and often lies within the ranges of 3 to 8.
15
Moving Averages (MA) or Trailing Moving Average (TMA)
• The number of points k used for the average increases,
the curve becomes smoother and smoother. Choosing a
value for k is a balance between eliminating noise while
still capturing the data’s true structure.
A small number k is most desirable
A small number k places heavy weight on recent historical
observations, that might catch up more rapidly to the current level
A large number k is desirable when there are wide, infrequent
fluctuations in the series
For smoothing out: MA(4) yields an average of the four quarters,
MA(12), eliminates or averages out the seasonal effects
• Minitab can be used to compute a k moving average
• Check the autocorrelation function for the residuals from
the k moving average method
16
8
9/28/2023
Double Moving Averages (DMA)
• If time series has a linear trend we use Double Moving
Averages DMA which averages of moving averages, that
means
One set of moving averages is computed, and
then a second set is computed as a moving average of the first set
• First, compute the moving average of order k Count an amount of k, use
the subscript k= 0…1…2…k-1
• Second, compute the second moving average
One set of moving averages is computed, and then a second set is
computed as a moving average of the first set
17
Double Moving Averages (DMA)
• Third, calculate a forecast by DMA, compute the
coefficient of the “linear trend line” by adding to the single
moving average Mt the difference between the single and
the second moving averages (Mt-M’t), we get
• Fourth, compute an additional adjustment factor, which is
similar to a slope measure that can change over the series
where
k = the number of periods in the
moving average
• Last, make the forecast p periods into the future Y t p at bt p
where
p = the number of periods ahead to be forecast
18
9
9/28/2023
Centered Moving Average (CMA)
• The Centered Moving Average smoothing method
looks forward and backward in time to express the
current “forecast” as a mean of the current
observation and observations on either side of the
current data.
• Therefore, when calculating a simple moving average,
it is beneficial to use an odd number of points (k) so
that the calculation is symmetric
• For example, using k = 3 periods, the CMA is:
a 5 point moving average
19
Centered Moving Average (CMA)
• When k is odd (k = 3, 5, etc.), the simple moving average is
easy to calculate.
• When k is even, the mean of an even number of data points
would lie between two data points and would not be correctly
centered.
In this case, we would take a double moving average to get the
resulting CMA centered properly.
• Centered moving averages (CMA) are computed by
averaging across data both in the past and future of a given
time point.
• Therefore, they cannot be used for forecasting because at
the time of forecasting (because the future is typically
unknown)
• For purposes of forecasting, trailing moving averages are
used, where k periods is placed over the most recent
available k values of the series.
20
10
9/28/2023
Centered Moving Average (CMA)
Time Period Data Value
2022 Quarter I 818
2022 Quarter II 861
2022 Quarter III 844
2022 Quarter IV 906 𝑌 𝑌
2023 Quarter I 867
2023, Quarter II 899
• k=3, 3-Quarter Centered Moving Average for 2022, Quarter IV:
𝑌 844 906 867 872.3
3
• k=4, 4-Quarter Centered Moving Average for 2022, Quarter IV:
𝑌 0.5861 844 906 867 0.5844 906 867 899 874.25
4 4
21
Assignment
22
11