Time Series Analysis Lecture 4 PDF
Document Details
Uploaded by FrugalGyrolite3397
Universiti Malaya
Tags
Summary
This document covers time series decomposition, including additive and multiplicative models, and their graphical representations, for use in forecasting. It features real-world examples, such as international airline passengers and monthly milk production as well as applying the concepts to unemployment data. It details methods like moving averages, centred moving averages, and weighted moving averages for smoothing and decomposition.
Full Transcript
EIE3002/EII3002 Time Series Analysis Lecture 4 Time series decomposition. Decomposition Models Decomposition assumes that data is made up as follows: data = pattern + error = f(trend-cycle, seasonality, error) The error is assumed to be the difference betwee...
EIE3002/EII3002 Time Series Analysis Lecture 4 Time series decomposition. Decomposition Models Decomposition assumes that data is made up as follows: data = pattern + error = f(trend-cycle, seasonality, error) The error is assumed to be the difference between the combined effect of the two sub- patterns of the series and the actual data. The error is often referred to as the irregular or random (or remainder) component. 2 Decomposition Models Recall that the general mathematical form of the decomposition approach is: Yt = f(St , Tt , Et) Yt : time series value at period t. Tt : trend component at time t. St : seasonal component at time t. Et : error (irregular or random) component at time t. 3 Decomposition Models The exact functional form depends on the decomposition method used. – Additive form: Yt = St + Tt + Et Appropriate if the magnitude of the seasonal fluctuations does not vary with the level of the series Monthly milk production per cow 1000 900 800 700 pounds 600 500 400 90 90 91 91 92 92 93 93 94 94 95 95 96 96 97 97 98 98 99 99 00 00 01 01 02 02 03 03 an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- an- ul- 4 J J J J J J J J J J J J J J J J J J J J J J J J J J J J Decomposition Models – Multiplicative form: Yt = St x Tt x Et Appropriate if the seasonal fluctuations increase and decrease proportionally with increases and decreases in the level of the series More prevalent with economic series, e.g. International airline passengers: International airline passengers 450 400 350 300 250 200 150 100 50 49 49 49 50 50 50 51 51 51 52 52 52 53 53 53 54 54 54 55 55 55 56 56 56 an- ay- ep- an- ay- ep- an- ay- ep- an- ay- ep- an- ay- ep- an- ay- ep- an- ay- ep- an- ay- ep- 5 J M S J M S J M S J M S J M S J M S J M S J M S Decomposition Models Very often, when the original series is not additive, it can be transformed and then can be modelled additively. If Yt = St x Tt x Et then log Yt = log St + log Tt + log Et. Hence we can fit a multiplicative relationship by fitting an additive relationship to the logarithms of the data. International airline passengers (in natural log) 6.50 6.00 5.50 5.00 4.50 4.00 9 9 9 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 n-4 y-4 p-4 n-5 y-5 p-5 n-5 y-5 p-5 n-5 y-5 p-5 n-5 y-5 p-5 n-5 y-5 p-5 n-5 y-5 p-5 n-5 y-5 p-5 Ja Ma Se Ja Ma Se Ja Ma Se Ja Ma Se Ja Ma Se Ja Ma Se Ja Ma Se Ja Ma Se 6 Decomposition Graphics Decomposition plot – Helpful in visualising the decomposition procedure Example: additive decomposition of monthly sales (in thousands) of new one-family houses sold in the USA since 1973 – Series shows both cyclical and seasonal behaviour. – Cyclical behaviour is related to the economic health and confidence of the nation. – Other panels show estimates of cyclical, seasonal, and irregular behaviour. – When the three component are added together, the original series is obtained. 7 Decomposition Graphics Decomposition of additive time series 90 observed 70 50 30 60 trend 50 40 30 10 seasonal 5 0 -10 -5 10 random 0 -10 1975 1980 1985 1990 1995 8 Time Seasonal Adjustments A seasonal adjusted time series is one in which the seasonal variation has been removed. Decomposition of times series makes it easy to calculate seasonally adjusted data. For additive decomposition the seasonally adjusted data are obtained by Yt - St = Tt + Et For multiplication decomposition the seasonally adjusted data are obtained by Yt/St = Tt x Et 9 Seasonal Adjustments E.g. for monthly unemployment series – Does the increase from one month to the next imply a worsening in the economy? If the increase is due to a large number of school leavers seeking work (seasonal variation) – We would not want to conclude that the economy has weakened – Hence seasonally adjusting such unemployment data is useful in giving us a clearer picture with regard to the economic condition. 10 Moving Averages Moving averages are fundamental building blocks in all decomposition methods. Moving averages provide a simple method for smoothing the “past history” data. The idea behind moving averages is that observations that are nearby in time are also likely to be close in value – So taking an average of points near an observation will provide a reasonable estimate of the trend-cycle of the observation. – The average eliminates some of randomness in the data, leaving a smooth trend-cycle component. 11 Moving Averages Types of moving averages – Simple moving averages – Centred moving averages – Double moving averages – Weighted moving averages 12 Simple moving averages We need to decide how many data points to include in each average. Suppose we use averages of three points, namely the observation at which we are calculating trend-cycle and the points on either side. This is called a moving average of order 3 or 3 MA smoother. Simple moving averages can be defined for any odd order. A moving average of order k (or k MA) where k is an odd integer is defined as the average consisting of an observation and m=(k-1)/2 points on either side so that 1 m Tt k Y j m t j 13 Example: monthly sales of shampoo 3 MA: Tt = 1/3(Yt-1 + Yt + Yt+1), 5 MA: Tt = 1/5(Yt-2 +Yt-1 + Yt + Yt+1 + Yt+2), Month Time Observed Three- Five-month period values month moving (liters) moving average average 5 MA 3 MA Jan 1 266.00 - - Feb 2 145.90 198.33 - Mar 3 183.10 149.43 178.92 Apr 4 119.30 160.90 159.42 May 5 180.30 156.03 176.60 Jun 6 168.50 193.53 184.88 Jul 7 231.80 208.27 199.58 Aug 8 224.50 216.37 188.10 Sep 9 192.80 180.07 221.70 Oct 10 122.90 217.40 212.52 Nov 11 336.50 215.10 206.48 Dec 12 185.90 238.90 197.82 Jan 13 194.30 : : 14 Feb 14 149.50 : : : : : : : Yt 3 MA 5MA 700.00 600.00 500.00 400.00 300.00 200.00 100.00 n b ar pr y n ul g p ct v c n b ar pr y n ul g p ct v c n b ar pr y n ul g p ct v c Ja Fe M A Ma Ju J Au Se O No De Ja Fe M A Ma Ju J Au Se O No De Ja Fe M A Ma Ju J Au Se O No De 15 Centred moving averages The simple moving average required an odd number of observations to be included in each average. This was to ensure that the average was centred at the middle of the data values being averaged. But suppose we wish to calculate a moving average with an even number of observations. For example, to calculate a 4-term average or 4 MA, the trend-cycle at time 3 could be calculated by taking average of T2.5 and T3.5; T2.5 = (Y1 + Y2 + Y3 + Y4)/4, T3.5 = (Y2 + Y3 + Y4 + Y5)/4, 16 The center of the first moving average is at 2.5, while the center of the second moving average is at 3.5. However, the average of the moving averages is centred at 3 [i.e., (2.5+3.5)/2=3]. This centred moving average is denoted as 2 X 4 MA. In this case, T”3 = (T2.5 + T3.5)/2 17 Quarter Period Data 4 MA Average 2 x 4 MA Average Position Position Q1 1 266.00 - - - - Q2 2 145.90 178.58 2.50 - - Q3 3 183.10 157.15 3.50 167.86 3 Q4 4 119.30 162.80 4.50 159.98 4 Q1 5 180.30 174.98 5.50 168.89 5 Q2 6 168.50 201.28 6.50 188.13 6 Q3 7 231.80 204.40 7.50 202.84 7 Q4 8 224.50 193.00 8.50 198.70 8 Q1 9 192.80 219.18 9.50 206.09 9 Q2 10 122.90 209.53 10.50 214.35 10 Q3 11 336.50 209.90 11.50 209.71 11 Q4 12 185.90 216.55 12.50 213.23 12 Q1 13 194.30 : : : : Q2 14 149.50 : : : : : : : : : : : : : : : : : : 18 Double moving averages The centred moving averages are an example of how a moving average can itself be smoothed by another moving average. Any combination of moving averages can be used together to form a double moving average. For example a 3 X 3 moving average is a 3 MA X 3 MA. Example: T2 = (Y1 + Y2 + Y3 )/3, T3 = (Y2 + Y3 + Y4 )/3, T4 = (Y3 + Y4 + Y5 )/3, ---------------------------- T”3 = (T2 + T3 + T4 )/3, 19 Weighted moving averages In general, a weighted k-point moving average can be written as; m Tt a jYt j j m where m=(k-1)/2 is the half-width and the weights are denoted by aj. Example: 3 MA: Tt = (0.25Yt-1 + 0.5Yt + 0.25Yt+1), 20 Classical Decomposition Additive Decomposition Yt = S t + T t + Et Multiplicative Decomposition Y t = S t x T t x Et 21 Additive Decomposition Model: Yt = St + Tt + Et Classical decomposition is carried out in 4 steps Example : New housing sales – data has a seasonal period of 12 – Since the seasonal variation is fairly constant over time, use the additive decomposition method 100 90 80 70 60 50 Sales 40 30 20 10 0 75 75 76 77 78 78 79 80 81 81 82 83 84 84 85 86 87 87 88 89 90 90 91 92 93 93 94 95 96 96 97 an- ct- ul- pr- an- ct- ul- pr- an- ct- ul- pr- an- ct- ul- pr- an- ct- ul- pr- an- ct- ul- pr- an- ct- ul- pr- an- ct- ul- 22 J O J A J O J A J O J A J O J A J O J A J O J A J O J A J O J Additive Decomposition Step 1 – Compute trend cycle using centred 12 MA Step 2 – Remove the trend-cycle component, i.e. de-trend the series : Yt – Tt = St + Et Step 3 – Estimate the seasonal component Gather all the de-trended values for a given period and take the average. The seasonal index for January is the average of all the de-trended values for January and so on. The set of 12 values are repeated to make up the seasonal component Step 4 – Compute the irregular component Et =Yt – Tt – St 23 Additive Decomposition Decomposition of additive time series 90 observed 70 50 30 60 trend 50 40 30 10 seasonal 5 0 -10 -5 10 random 0 -10 1975 1980 1985 1990 1995 Time 24 Multiplicative Decomposition Similar to the additive procedure except ratios are taken instead of differences The method is often called the “ratio-to- moving average” method 25 Multiplicative Decomposition Example: International airline passenger data; – Because the seasonal variation increases as the level of the series increases, use the multiplicative decomposition method International airline passengers 450 400 350 300 250 200 150 100 50 49 49 49 49 50 50 50 50 51 51 51 51 52 52 52 52 53 53 53 53 54 54 54 54 55 55 55 55 56 56 56 56 an- pr- ul- ct- an- pr- ul- ct- an- pr- ul- ct- an- pr- ul- ct- an- pr- ul- ct- an- pr- ul- ct- an- pr- ul- ct- an- pr- ul- ct- J A J O J A J O J A J O J A J O J A J O J A J O J A J O J A J O 26 Multiplicative Decomposition Step 1 – Compute trend cycle using centred 12 MA Step 2 – Remove the trend-cycle component, i.e. de-trend the series Yt St Et Tt This is the ratio of actual to moving averages 27 Multiplicative Decomposition Step 3 – Estimate the seasonal component Gather all the de-trended values for a given period and take the average. The seasonal index for January is the average of all the de-trended values for January and so on. The set of 12 values are repeated to make up the seasonal component The seasonal component is assumed to be constant from year to year Step 4 – Compute the irregular component Yt Et ( St Tt ) 28 Multiplicative Decomposition Decomposition of multiplicative time series 400 observed 300 200 100 250 trend 0.90 0.95 1.00 1.050.8 0.9 1.0 1.1 1.2 150 seasonal random 1950 1952 1954 1956 Time 29 Forecasting and Decomposition Individual components are projected into the future and recombined to form a forecast of the underlying series Rarely works well since it is difficult to obtain adequate forecasts of the components Trend-cycle component is sometimes modelled as some parametric trend model such as a linear or quadratic model – However for many time series, the trend-cycle component do not follow any parametric trend model 30 Forecasting and Decomposition Seasonal component for future years can be based on the seasonal component from the last full period of data – However if the seasonal pattern is changing over time, this will not be adequate The irregular component may be forecast as – Zero for additive decomposition – One for multiplicative decomposition 31 Forecasting using Decomposition 1. Perform classical decomposition. 2. Compute deseasonalized series, () 3. Estimate regression model, for instance a linear regression model , with t represents a time trend variable. 4. Compute out-of-sample forecasts for deseasonalized series, 5. Compute forecasts of depending on the type of classical decomposition used: Additive: Multiplicative: 32 Multiplicative Decomposition Example Consider quarterly soft drink sales in millions of dollars of a large US corporation from 1991 to 2001. This time series is given in the file softdrink.xls. Use multiplicative decomposition to forecast soft drink sales for the 4 quarters of 2002. 6000 5000 4000 3000 2000 1000 0 Quarter 33 Multiplicative Decomposition – Example 4QMA refers to 4 quarter moving average 4QCMA refers to 4 quarter centred moving average For example 4QMA for Q2-91: (1734.83 + 2244.96 + 2533.80 + 2154.96)/4 2167.14 4QCMA for Q3-91: (2167.14 + 2120.39)/2 2143.76 Yt/4QCMA for Q3-91: 2533.80/2143.76 1.1819 St for Q1 of each year: Average of 1st quarter de-trended sales for 1991 to 2001 (0.7661 +... + 0.8817 + 0.8882)/8 0.8804 This implies that that 1st quarter soft drink sales is (100 – 88.04)% = 11.96% below the quarterly average. 34 Multiplicative Decomposition – Example St for Q3 of each year: Average of 3rd quarter de- trended sales for 1991 to 2001 (1.1819 + 1.0305 +... + 1.0765)/8 1.0651 This implies that that 3rd quarter soft drink sales is (106.51-100) = 6.51% above the quarterly average. Et for Q3-91: 1.1819/1.0651 = 1.1097 Des Yt for Q1-91: 1734.83/0.88 1970.51 Note that the sign is used because of approximations due to rounding errors. 35 Multiplicative Decomposition - Example 6000 5000 4000 Soft drink Sales 3000 2000 1000 0 Quarter 6000 Trend Cycle 5000 4000 3000 2000 1000 0 Quarter 1.30 1.20 De-trended Sales 1.10 1.00 0.90 0.80 0.70 0.60 Quarter 1.15 Irregular 1.10 1.05 Component 1.00 0.95 0.90 0.85 0.80 Quarter 36 Multiplicative Decomposition - Example The regression-based linear trend model fitted to the de- seasonalized sales is SUMMARY OUTPUT Regression Statistics Multiple R 0.9618 R Square 0.9251 Adjusted R Square 0.9233 Standard Error 280.7160 Observations 44 ANOVA df SS MS F Significance F Regression 1 40856212.85 40856212.85 518.47 2.96812E-25 Residual 42 3309661.75 78801.47 Total 43 44165874.60 Coefficients Standard Error t Stat P-value Lower 95% Upper 95% Intercept 1380.3410 86.1027 16.0313 0.0000 1206.5788 1554.1032 X Variable 1 75.8845 3.3327 22.7699 0.0000 69.1589 82.6100 Des Yˆt 1380.3410 75.8845 t The linear fit is very good (R2 = 0.9251) and is valid (t-Stat = 22.77; p-value = 0) 37 Multiplicative Decomposition Example For example for Q1 - 91: t=1 Des Des F1 Y=ˆ 1380.341 75.88451 1456.23 1 Q4 - 02: t = 48 Des Des F48Yˆ= 1380.341 75.884548 5022.8 48 Multiplying the de-seasonalized sales forecast by the corresponding seasonal index gives the forecast of the original soft drink series For example for Q1 – 91: t = 1 S1 = 0.8804; F1 = S1 x Des F1 = 0.8804 x 1456.23 1282.06 Q4 - 02: t = 48 S4 = 0.9614; F48 = S4 x Des F48 = 0.9614 x 5022.8 4828.92 38 Multiplicative Decomposition - Example 6000 5000 4000 3000 2000 Deseasonalized Sales DesYt 1000 Deseasonalized Sales Forecast Des Ft 0 Quarter Soft Drink Sales and Decomposition Forecasts 6000 5000 4000 3000 Sales Yt 2000 Sales Forecast Ft 1000 0 Quarter 39