Vous êtes sur la page 1sur 24

Modeling Time Series Data

y T *S
Module 5
A Composite Model

We can fit a composite model of the form:


Sales = (Trend) * (Seasonality) * (Cyclicality) * (Error)
Trend

Trend is the long term level and the pattern of change in the dependent
variable. It is estimated as a simple function of the period number (time).
Linear regression or method of least squares is used to estimate the trend.

A linear model captures the general upward (or downward) trend


with steady growth.
Seasonality

Seasonality is a cycle with a period of exactly one year. We


estimate it as a proportion of trend for each season. Data must
be available on seasonal basis.
Time series decomposition is a method to estimate seasonal
component.

Seasonality captures regular, predictable deviations from the


trend. Typical seasons are quarters, weeks, or days.
Cyclicality

Cyclicality captures the effects of long-term macroeconomic boom-


bust cycles. It is often difficult to get enough data to measure
accurately.
Composite Model

Any residual deviations are attributed to random error.


Time Series Decomposition

Start with raw data (y)


Estimate Seasonal Indices
Compute base trend using centered moving averages (t)
Estimate seasonal ratios (y/t)
Average seasonal ratios to get raw seasonal indices
Normalize seasonal indices (s)
De-seasonalize the raw data (y/s)
Estimate the trend equation using de-seasonalized data
(t)
Forecast y = t * s
Calculate error = y (t*s)
Example: Modeling Trend and Seasonality

Per Year Qtr Revenue


1 1992 1 1026.00
Toys R Us Revenue
2 1992 2 1056.00
3 1992 3 1182.00 (millions $)
4 1992 4 2861.00
5 1993 1 1172.00
6 1993 2 1249.00
7 1993 3 1346.00
8 1993 4 3402.00
9 1994 1 1286.00
10 1994 2 1317.00
11 1994 3 1449.00
12 1994 4 3893.00
13 1995 1 1462.00
14 1995 2 1452.00
15 1995 3 1631.00
16 1995 4 4200.00
17 1996 1 1776.25
18 1996 2 1808.25
19 1996 3 1941.75
20 1996 4 4128.75
Example: Computing Moving Averages

Per Year Qtr Revenue Moving Avg


1 1992 1 1026.00
2 1992 2 1056.00
3 1992 3 1182.00 1531.3
4 1992 4 2861.00 1567.8
Calculate Moving Average with
5 1993 1 1172.00 1616.0
span of 4
6 1993 2 1249.00 1657.0
7 1993 3 1346.00 1792.3
8 1993 4 3402.00 1820.8
9 1994 1 1286.00 1837.8
10 1994 2 1317.00 1863.5
(1026 + 1056 + 1182 + 2861)
11 1994 3 1449.00 1986.3
4 = 1531.3
12 1994 4 3893.00 2030.3
13 1995 1 1462.00 2064.0
14 1995 2 1452.00 2109.5
15 1995 3 1631.00 2186.3
16 1995 4 4200.00 2264.8
17 1996 1 1776.25 2353.9
18 1996 2 1808.25 2431.6
19 1996 3 1941.75 2413.8
20 1996 4 4128.75
Example: Using centered moving averages to estimate base demand

Per Year Qtr Revenue Moving Avg Centered MA


1 1992 1 1026.00
2 1992 2 1056.00
3 1992 3 1182.00 1531.3 1549.5
Center Moving Average if
4 1992 4 2861.00 1567.8 1591.9 using even number of data
5 1993 1 1172.00 1616.0 1636.5 points
6 1993 2 1249.00 1657.0 1724.6
7 1993 3 1346.00 1792.3 1806.5
8 1993 4 3402.00 1820.8 1829.3
9 1994 1 1286.00 1837.8 1850.6
(1531.3 + 1567.8)
10 1994 2 1317.00 1863.5 1924.9 = 1549.5
11 1994 3 1449.00 1986.3 2008.3
2
12 1994 4 3893.00 2030.3 2047.1
13 1995 1 1462.00 2064.0 2086.8
14 1995 2 1452.00 2109.5 2147.9
15 1995 3 1631.00 2186.3 2225.5
16 1995 4 4200.00 2264.8 2309.3
17 1996 1 1776.25 2353.9 2392.7
18 1996 2 1808.25 2431.6 2422.7
19 1996 3 1941.75 2413.8
20 1996 4 4128.75
Example: Computing Seasonal Ratios

Moving Centered
Per Year Qtr Revenue Avg MA Ratio
1 1992 1 1026.00
2 1992 2 1056.00 Calculate the ratio of
3 1992 3 1182.00 1531.3 1549.5 0.7628 the revenue to the
4 1992 4 2861.00 1567.8 1591.9 1.7973 centered moving
5 1993 1 1172.00 1616.0 1636.5 0.7162 average
6 1993 2 1249.00 1657.0 1724.6 0.7242
7 1993 3 1346.00 1792.3 1806.5 0.7451
8 1993 4 3402.00 1820.8 1829.3 1.8598
9 1994 1 1286.00 1837.8 1850.6 0.6949
10 1994 2 1317.00 1863.5 1924.9 0.6842
11 1994 3 1449.00 1986.3 2008.3 0.7215 1182
12 1994 4 3893.00 2030.3 2047.1 1.9017
1549.5 = .7628
13 1995 1 1462.00 2064.0 2086.8 0.7006
14 1995 2 1452.00 2109.5 2147.9 0.6760
15 1995 3 1631.00 2186.3 2225.5 0.7329
16 1995 4 4200.00 2264.8 2309.3 1.8187
17 1996 1 1776.25 2353.9 2392.7 0.7424
18 1996 2 1808.25 2431.6 2422.7 0.7464
19 1996 3 1941.75 2413.8
20 1996 4 4128.75
Example: Calculating raw Seasonal Indices

Moving Centered Avg


Per Year Qtr Revenue Avg MA Ratio Ratio
1 1992 1 1026.00 Calculate the
2 1992 2 1056.00
average ratio for
3 1992 3 1182.00 1531.3 1549.5 0.7628
each season
4 1992 4 2861.00 1567.8 1591.9 1.7973
(quarter).
5 1993 1 1172.00 1616.0 1636.5 0.7162 0.7135
6 1993 2 1249.00 1657.0 1724.6 0.7242 0.7077
7 1993 3 1346.00 1792.3 1806.5 0.7451 0.7406
8 1993 4 3402.00 1820.8 1829.3 1.8598 1.8444 .7162 + .6949 + .7006 + .7424
9 1994 1 1286.00 1837.8 1850.6 0.6949 4
10 1994 2 1317.00 1863.5 1924.9 0.6842
11 1994 3 1449.00 1986.3 2008.3 0.7215
12 1994 4 3893.00 2030.3 2047.1 1.9017
Raw Seasonal
13 1995 1 1462.00 2064.0 2086.8 0.7006
Index = .7135
14 1995 2 1452.00 2109.5 2147.9 0.6760
15 1995 3 1631.00 2186.3 2225.5 0.7329
16 1995 4 4200.00 2264.8 2309.3 1.8187
17 1996 1 1776.25 2353.9 2392.7 0.7424
18 1996 2 1808.25 2431.6 2422.7 0.7464
19 1996 3 1941.75 2413.8
20 1996 4 4128.75
Example: Normalizing Seasonal Indices

Moving Centered Avg


Per Year Qtr Revenue Avg MA Ratio Ratio SI
1 1992 1 1026.00 0.7124
2 1992 2 1056.00 0.7066
3 1992 3 1182.00 1531.3 1549.5 0.7628 0.7394 Normalize to
4 1992 4 2861.00 1567.8 1591.9 1.7973 1.8415 make sure
5 1993 1 1172.00 1616.0 1636.5 0.7162 0.7135 0.7124 Seasonal Indices
6 1993 2 1249.00 1657.0 1724.6 0.7242 0.7077 0.7066
average to 1.0
7 1993 3 1346.00 1792.3 1806.5 0.7451 0.7406 0.7394
(or add up to 4 in
8 1993 4 3402.00 1820.8 1829.3 1.8598 1.8444 1.8415
this case)
9 1994 1 1286.00 1837.8 1850.6 0.6949 0.7124
10 1994 2 1317.00 1863.5 1924.9 0.6842 0.7066
11 1994 3 1449.00 1986.3 2008.3 0.7215 0.7394
.7135 .
12 1994 4 3893.00 2030.3 2047.1 1.9017 1.8415
.7135+.7077+.7406+1.844
13 1995 1 1462.00 2064.0 2086.8 0.7006 0.7124
14 1995 2 1452.00 2109.5 2147.9 0.6760 0.7066
15 1995 3 1631.00 2186.3 2225.5 0.7329 0.7394
= .7124
16 1995 4 4200.00 2264.8 2309.3 1.8187 1.8415
17 1996 1 1776.25 2353.9 2392.7 0.7424 0.7124
18 1996 2 1808.25 2431.6 2422.7 0.7464 0.7066
19 1996 3 1941.75 2413.8 0.7394
20 1996 4 4128.75 1.8415
Example: De-Seasonalizing raw data

P Qt Movin Centered Avg


er Year r Revenue g Avg MA Ratio Ratio SI DeS
1 1992 1 1026.00 0.7124 1440.2
2 1992 2 1056.00 0.7066 1494.4
3 1992 3 1182.00 1531.3 1549.5 0.7628 0.7394 1598.5
4 1992 4 2861.00 1567.8 1591.9 1.7973 1.8415 1553.6
5 1993 1 1172.00 1616.0 1636.5 0.7162 0.7135 0.7124 1645.1
Deseasonalize
6 1993 2 1249.00 1657.0 1724.6 0.7242 0.7077 0.7066 1767.6
observations.
7 1993 3 1346.00 1792.3 1806.5 0.7451 0.7406 0.7394 1820.3
8 1993 4 3402.00 1820.8 1829.3 1.8598 1.8444 1.8415 1847.4
9 1994 1 1286.00 1837.8 1850.6 0.6949 0.7124 1805.1
10 1994 2 1317.00 1863.5 1924.9 0.6842 0.7066 1863.8 1026
= 1440.2
11 1994 3 1449.00 1986.3 2008.3 0.7215 0.7394 1959.6 .7124
12 1994 4 3893.00 2030.3 2047.1 1.9017 1.8415 2114.0
13 1995 1 1462.00 2064.0 2086.8 0.7006 0.7124 2052.2
14 1995 2 1452.00 2109.5 2147.9 0.6760 0.7066 2054.9
15 1995 3 1631.00 2186.3 2225.5 0.7329 0.7394 2205.7
16 1995 4 4200.00 2264.8 2309.3 1.8187 1.8415 2280.7 y = y/s
17 1996 1 1776.25 2353.9 2392.7 0.7424 0.7124 2493.3
18 1996 2 1808.25 2431.6 2422.7 0.7464 0.7066 2559.0
19 1996 3 1941.75 2413.8 0.7394 2626.0
20 1996 4 4128.75 1.8415 2242.0
Example: De-Seasonalizing

Fit a regression line to the deseasonalized observations y


(using time as the independent variable).
Example: De-Seasonalizing

Q Moving Centered
Per Year tr Revenue Avg MA Ratio Avg Ratio SI DeS Forecast
1 1992 1 1026.00 0.7124 1440.2 1430.3
2 1992 2 1056.00 0.7066 1494.4 1487.3
3 1992 3 1182.00 1531.3 1549.5 0.7628 0.7394 1598.5 1544.2

56.93 * (1) + 1373.4 = 1430.3


4 1992 4 2861.00 1567.8 1591.9 1.7973 1.8415 1553.6 1601.1
5 1993 1 1172.00 1616.0 1636.5 0.7162 0.7135 0.7124 1645.1 1658.0
6 1993 2 1249.00 1657.0 1724.6 0.7242 0.7077 0.7066 1767.6 1715.0
7 1993 3 1346.00 1792.3 1806.5 0.7451 0.7406 0.7394 1820.3 1771.9
8 1993 4 3402.00 1820.8 1829.3 1.8598 1.8444 1.8415 1847.4 1828.8
9 1994 1 1286.00 1837.8 1850.6 0.6949 0.7124 1805.1 1885.8
10 1994 2 1317.00 1863.5 1924.9 0.6842 0.7066 1863.8 1942.7
11 1994 3 1449.00 1986.3 2008.3 0.7215 0.7394 1959.6 1999.6
12 1994 4 3893.00 2030.3 2047.1 1.9017 1.8415 2114.0 2056.6
13 1995 1 1462.00 2064.0 2086.8 0.7006 0.7124 2052.2 2113.5
14 1995 2 1452.00 2109.5 2147.9 0.6760 0.7066 2054.9 2170.4
15 1995 3 1631.00 2186.3 2225.5 0.7329 0.7394 2205.7 2227.4
16 1995 4 4200.00 2264.8 2309.3 1.8187 1.8415 2280.7 2284.3
17 1996 1 1776.25 2353.9 2392.7 0.7424 0.7124 2493.3 2341.2
18 1996 2 1808.25 2431.6 2422.7 0.7464 0.7066 2559.0 2398.2
19 1996 3 1941.75 2413.8 0.7394 2626.0 2455.1
20 1996 4 4128.75 1.8415 2242.0 2512.0

Use trend to make deseasonalized predictions - T


Example: De-Seasonalizing

Q Moving Centered Avg Foreca


Per Year tr Revenue Avg MA Ratio Ratio SI DeS st ReS
1 1992 1 1026.00 0.7124 1440.2 1430.3 1019.0
2 1992 2 1056.00 0.7066 1494.4 1487.3 1050.9
3 1992 3 1182.00 1531.3 1615.5 0.7317 0.7394 1598.5 1544.2 1141.8
4 1992 4 2861.00 1699.7 1699.7 1.6833 1.8415 1553.6 1601.1 2948.5
- - - - - - - - - - - -
13 1995 1 1462.00 1457.0 1486.0 0.9838 0.7124 2052.2 2113.5 1505.7
14 1995 2 1452.00 1515.0 1850.6 0.7846 0.7066 2054.9 2170.4 1533.7
15 1995 3 1631.00 2186.3 2225.5 0.7329 0.7394 2205.7 2227.4 1647.0
16 1995 4 4200.00 2264.8 2309.3 1.8187 1.8415 2280.7 2284.3 4206.6
17 1996 1 1776.25 2353.9 2392.7 0.7424 0.7124 2493.3 2341.2 1667.9
18 1996 2 1808.25 2431.6 2422.7 0.7464 0.7066 2559.0 2398.2 1694.6
19 1996 3 1941.75 2413.8 0.7394 2626.0 2455.1 1815.4
20 1996 4 4128.75 1.8415 2242.0 2512.0 4625.9
21 0.71241 2568.9 1830.2
22 0.70662 2625.9 1855.5
23 2568.9 * .71241 = 1830.2 0.73944 2682.8 1983.8
24 1.84153 2739.7 5045.3

Reseasonalize predictions (T*S) to make forecasts into the


future.
Example: De-Seasonalizing

Plot the forecasts T*S


Example: De-Seasonalizing

Reseason-
alized
Per Year Qtr Revenue forecast Square Error
1 1992 1 1026 1018.983 97.00468
(1026 1018.98) 2 = 97.0
2 1992 2 1056 1050.927 51.54981
3 1992 3 1182 1141.832 2950.947
4 1992 4 2861 2948.503 2257.815
5 1993 1 1172 1181.217 167.3762 As an alternative goodness of
6 1993 2 1249 1211.841 2765.401 fit measure, calculate Root
7 1993 3 1346 1310.219 2341.483
Mean Square Error.
8 1993 4 3402 3367.862 343.6507
9 1994 1 1286 1343.45 6503.07
10 1994 2 1317 1372.755 6225.828
11 1994 3 1449 1478.607 1603.193
12 1994 4 3893 3787.221 3299.437
13 1995 1 1462 1505.684 3759.864 RMSE = 9865.2 = 99.3
14 1995 2 1452 1533.669 13358.15
15 1995 3 1631 1646.995 467.8932
16 1995 4 4200 4206.581 12.7695
17 1996 1 1776.25 1667.917 23123.7
18 1996 2 1808.25 1694.584 25875.59
19 1996 3 1941.75 1815.382 29205.72
20 1996 4 4128.75 4625.94 72893.41
Average square error
9865.2
Example: De-Seasonalizing with Statpro

http://www.indiana.edu/~mgtsci/StatPro.html

Statpro can be used to calculate seasonal indices. Click on


Statpro -> Forecast.
Example: De-Seasonalizing with Statpro

Select the dependent variable.


Example: De-Seasonalizing with Statpro

Select quarterly data.


Example: De-Seasonalizing with Statpro

Select a span of 4 and a moving average method of


deseasonalizing.
Example: De-Seasonalizing with Statpro

Statpro generates the same


values that we calculated
manually.

(Statpro output)

Vous aimerez peut-être aussi