Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Forecasting and conclusions

Operations Research
Matteo Brunelli
Forecasting in 1900
Few questions
Domanda min max
Population of Germany 80 mil 90 mil
Martin Luther’s King’s age at death
Length of the Nile River
Number of member countries in the OPEC
Number of books in the Christian Old Testament
Diameter of the moon
Weight of an empty Boeing 747
Year of birth of Wolfgang Amadeus Mozart
Gestation period of an Asian Elephant
Air distance between London and Tokyo
Deepest known point in the oceans
Answers
Domanda Val min
Martin Luther’s King’s age at death 39
Length of the Nile River 6650 kms
Number of member countries in the OPEC 14
Number of books in the Christian Old 46
Testament
Diameter of the moon 3475 kms
Weight of an empty Boeing 747 179000 kgs
Year of birth of Wolfgang Amadeus Mozart 1756
Gestation period of an Asian Elephant 21 mesi
Air distance between London and Tokyo 9585 kms
Deepest known point in the oceans 10971 m
Overconfidence bias (da Wiki)
“The overconfidence effect is a well-established bias in which a person's
subjective confidence in his or her judgements is reliably greater than the
objective accuracy of those judgements, especially when confidence is relatively
high.”

• Overprecision
“the excessive confidence that one knows the truth”
• Illusion of control
“the tendency for people to behave as if they might have some control when in fact
they have none”
• Better-than-average effects
“93% of American drivers rate themselves as better than the median”
• Comparative optimism
“Some researchers have claimed that people think good things are more likely
to happen to them than to others, whereas bad events were less likely to
happen to them than to others”
Data and models

«Data is the new oil: you need to find it,


extract it, refine it, distribute it and monetize
it»
David Buckingham

«All models are wrong, but some are useful»


George E.P. Box
Forecasting from time series
Question: How many pizzas will pizzeria «Da Aldo» serve in 2018?
Mathematical model

Problem:
I know 𝑥𝑡−5 , … , 𝑥𝑡 and I want to forecast 𝐹𝑡+1

Solution:
Find a function 𝑓which can express

𝐹𝑡+1 = 𝑓(𝑥𝑡 , 𝑥𝑡−1 , … )


Some distinctions

Tr e n d

Random
fluctuations

Seasonality
Simple methods
Naïve method

You only consider the


last observation Average
𝐹𝑡+1 = 𝑥𝑡 Average all the past
periods. Supping we
have date from the last
n periods

𝑥𝑡 + ⋯ + 𝑥𝑡−𝑛 Moving average


𝐹𝑡+1 =
𝑛
Take the average of the last m periods,
with m < n

𝑡
𝑥𝑡 + ⋯ + 𝑥𝑡−𝑚 1
𝐹𝑡+1 = = ෍ 𝑥𝑖
𝑚 𝑚
𝑖=𝑡−𝑚+1
Exponential smoothing

Define 𝛼 ∈]0,1[

𝐹𝑡+1 = 𝛼𝑥𝑡 + 1 − 𝛼 𝐹𝑡
= 𝛼𝑥𝑡 + (1 − 𝛼)(𝛼𝑥𝑡−1 +(1 − 𝛼)𝐹𝑡−1 )
= 𝛼𝑥𝑡 + 1 − 𝛼 𝛼𝑥𝑡−1 + 1 − 𝛼 2 𝐹𝑡−1
= 𝛼𝑥𝑡 + 1 − 𝛼 𝛼𝑥𝑡−1 + 1 − 𝛼 2 (𝛼𝑥𝑡−2 +(1 − 𝛼)𝐹𝑡−2 )
= 𝛼𝑥𝑡 + 1 − 𝛼 𝛼𝑥𝑡−1 + 1 − 𝛼 2 𝛼𝑥𝑡−2 + (1 − 𝛼)3 𝐹𝑡−2
= 𝛼𝑥𝑡 + 1 − 𝛼 𝛼𝑥𝑡−1 + 1 − 𝛼 2 𝛼𝑥𝑡−2 + (1 − 𝛼)3 (𝛼𝑥𝑡−3 +(1 − 𝛼)𝐹𝑡−3 )
=⋯

IF we continue,

𝐹𝑡+1 = 𝜶𝑥𝑡 + 𝟏 − 𝜶 𝜶𝑥𝑡−1 + 𝟏 − 𝜶 𝟐 𝜶𝑥𝑡−2 + (𝟏 − 𝜶)𝟑 𝜶𝑥𝑡−3 + ⋯


Mathematical note
Rememeber:

𝐹𝑡+1 = 𝜶𝑥𝑡 + 𝟏 − 𝜶 𝜶𝑥𝑡−1 + 𝟏 − 𝜶 𝟐 𝜶𝑥𝑡−2 + (𝟏 − 𝜶)𝟑 𝜶𝑥𝑡−3 + ⋯

The sum of the weights should be equal to 1. Is it?


𝜶 + 𝟏 − 𝜶 𝜶 + 𝟏 − 𝜶 𝟐 𝜶 + 𝟏 − 𝜶 𝟑 𝜶 + ⋯ = ෍(1 − 𝛼)𝑖 𝛼
𝑖=0
Proof:
∞ ∞
1 𝛼
෍(1 − 𝛼)𝑖 𝛼 = 𝛼 ෍(1 − 𝛼)𝑖 = 𝛼 = = 1
1 − (1 − 𝛼) 𝛼
𝑖=0 𝑖=0

Given 𝑟 ∈ ℝ with 𝑟 < 1, then



1
෍ 𝑟𝑖 =
1−𝑟
𝑖=0
Seasonality
Consider an ice cream producer. The following table shows the demand of ice
cream for the past years and past trimesters. How can we forecast the demand
for season I in 2018?

2015 2016 2017 2018


I II III IV I II III IV I II III IV I
104 123 168 142 103 123 171 136 105 121 167 141 ?
2015 2016 2017 2018
I II III IV I II III IV I II III IV I
54 73 107 92 59 73 121 86 48 71 117 91 ?

We could average the observations for the season I

(54 + 59 + 48) / 3

However, we would “waste” data

Alternative:

1. Calculate the average of all observations

(54 + 73 + 107 + … + 71 + 117 + 91) / 12 = 82,6667


2. Calculate season averages: (54 + 59 + 48) / 3 = 53,6667
(73 + 73 + 71) / 3 = 72,3333
(107 + 121 + 117) / 3 = 115
(92 + 86 + 91) / 3 = 89.6667

3. Calculate seasonality indices:


53,6667 / 82,6667 = 0,649194
72,3333 / 82,6667 = 0.875
115 / 82,6667 = 1,39113
89.6667 / 82,6667 = 1,08468

4. Divide each observation by its seasonality index

I II III IV I II III IV I II III IV


54 73 107 92 59 73 121 86 48 71 117 91
0,649 0,875 1,391 1,085 0,649 0,875 1,391 1,085 0,649 0,875 1,391 1,085
83,18 83,43 76,92 84,82 90,88 83,43 86,98 79,29 73,94 81,14 84,10 83,90
I II III IV I II III IV I II III IV
54 73 107 92 59 73 121 86 48 71 117 91
0,649 0,875 1,391 1,085 0,649 0,875 1,391 1,085 0,649 0,875 1,391 1,085
83,18 83,43 76,92 84,82 90,88 83,43 86,98 79,29 73,94 81,14 84,10 83,90

5. Take the average of the


observations without
seasonality and multiply it
times its seasonality factor,
(0.649).

Risultato: 53,65
Trend


Double exponential smoothing
We consider the expontial smoothing
𝐹𝑡+1 = 𝛼𝑥𝑡 + 1 − 𝛼 𝐹𝑡
I add a quantity to account for the trend
𝐹𝑡+1 = 𝛼𝑥𝑡 + 1 − 𝛼 𝐹𝑡 + 𝑇𝑡+1
In the last period the trend was
𝐿𝑡+1 = 𝛼(𝑥𝑡 − 𝑥𝑡−1 ) + 1 − 𝛼 (𝐹𝑡 −𝐹𝑡−1 )
Now we combine the observed trend with the estimated trend for the last period
with 𝛽 ∈]0,1[
𝑇𝑡+1 = 𝛽𝐿𝑡+1 + 1 − 𝛽 𝑇𝑡

𝐹𝑡+1 = 𝛼𝑥𝑡 + 1 − 𝛼 𝐹𝑡 + 𝛽𝐿𝑡+1 + 1 − 𝛽 𝑇𝑡


Other techniques
Regressione

Reti neurali artificiali


Box-Jenkins methods
More optimization
Nonlinear programming:
𝑚𝑎𝑥𝑖𝑚𝑖𝑧𝑒 2𝑥12 + 𝑥12
𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜 𝑥2 ≤ 10
𝑥1 + 𝑥2 ≤ 12
3𝑥1 + 𝑥2 ≤ 24
𝑥1 , 𝑥2 ≥ 0

Specialized algorithms:
The Simplex works fine, but there are specialized algorithms:
• Dijkstra’s algorithm (shortest path)
• Hungarian algorithm (assignment problem)
• Ford-Fulkerson (maximum flow)
• ……

Algorithms for integer optimization

Metaheuristics
Decision theory

You’re an engineer in an oil company and your job is to decide whether to drill or
not. All you have is this table

Oil Dry
Drill 700 € - 100 €
Sell 90 € 90 €
Probability 0.25 0.75

• Would you drill or sell?


• Would you pay 100€ to a survey company which can tell you with certainty if
there is oil in the field?
Multi-criteria decision making

Which job would you choose?

A B C D
Salary 2600 € 1850 € 2800 € 2100 €
Working hours 7.5 9 8.5 8
Job
2 3 1 2
atmosphere
Commuting
60 min 45 min 30 min 35 min
time
Flexibility 1 3 1 2
Game theory

In Game Theory the outcome of a player’s decision depends on the other


players’ decisions

One example is the prisoner’s dilemma

B does not confess B confesses


A does not confess (-1,-1) (-3,0)
A confesses (0,-3) (-2,-2)
Last slide

You might also like