Upcoming SlideShare
×

# Statistics lecture 13 (chapter 13)

1,842 views
1,638 views

Published on

Time Series Analysis

Published in: Education
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
1,842
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
131
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Statistics lecture 13 (chapter 13)

1. 1. 1
2. 2. • Sequence of observations of the same variable taken at equally spaced points in time.• Each observation records both the value of the variable and the time it was made.• Tell us where we are and suggest where we are going.• Time series data are used to predict future values for forecasting. 2
3. 3. Time plots• Can reveal the main features of a time series.• Look for the overall pattern and for deviations from the pattern.• Time on x-axis, measured variable on y-axis.• Plot the points and connect them with straight lines. 3
4. 4. Time plots – Example SA Fuel Price 800 700 600 Rand 500 400 300 200 100 0 J F M A M J J A S O N D J F M A M J J A S Months 2008 - 2009 4
5. 5. Components of a time series• Trend – (T)• Seasonal variations – (S)• Cyclical Variations – (C)• Irregular (random) variations – (I) 5
6. 6. Components of a time series• Trend – (T) – Overall smooth pattern and show long-term upward or downward movement. – Trend analysis isolate the long-term movement and is used to make long-term forecasting. 6
7. 7. Components of a time series• Seasonal variation – (S) – Rises and falls occurring in particular times of the year and repeated every year. • Period of times may be years, months, days, hours or quarters. – Seasonal effect can be taken into account to evaluate activity and can be incorporated into forecasts of future activity. 7
8. 8. Components of a time series• Cyclical variation – (C) – Patterns that repeat over time periods that exceed one year. – Time period for the cycle usually differ form each other. • Business cycles – recession, depression, recovery or boom. • Changes in governmental monetary and fiscal policy, etc. 8
9. 9. Components of a time series• Irregular variation – (I) – Variation left after the trend, seasonal and cyclical variations have been removed. – Have an irregular, saw-tooth pattern. – Cannot be predicted. – Unusual events. • Political events, war, riots, strikes, etc. – Cannot be analysed statistically or forecasted. 9
10. 10. CONCEPT QUESTIONS• Questions 1-5 ,p462, textbook 10
11. 11. Decomposition of a time series• Multiplicative time series model: – Original observed value Yt – Yt = TSCI• Decomposing a time series into four components.• Isolate the influence of each of the four components.• Statistical methods can isolate trend and seasonal variations.• To isolate cyclical and irregular variation is of less value. 11
12. 12. Decomposition – Trend analysis• Shows the general direction in which the series is moving. – Regression analysis – linear trend line – Moving average method – smooth curve 12
13. 13. Decomposition – Trend analysis – Linear trend• ŷt = a + bx – ŷt = estimated time series values – x = time• List the values of x and yt – Code x • 1st time period – x =1 • 2nd time period – x =2 ………. • nth time period – x = n – yt = original time series values 13
14. 14. Decomposition – Trend analysis – Linear trend• Determine the values of a and b:  2 x  1 n(n  1)  6 x 2  1 n(n  1)(2n  1) yt  1 n  yt x 1 nx S XX   x   x   xy    x   y  2 1 2 1 n S XY t n t S XY b S XX a  yt  bx 14
15. 15. Decomposition – Trend analysis – Linear trend• ŷt = a + bx• Substitute each value of xi into the trend equation to find the trend component.• Draw the trend line on the same graph as the original time series.• The trend line can now be used to estimate future values of the dependent variable (ŷt). 15
16. 16. Decomposition – Linear trend – Example• The table below lists the quarterly number of foreign visitors at a game ranch in Limpopo for the past 3 years. 2006 2007 2008 I II III IV I II III IV I II III IV 23 59 64 32 26 45 69 29 15 36 47 38 16
17. 17. Decomposition – Linear trend – Example Visitors at a game ranch 80 Number of visitors 70 60 50 40 30 20 10 0 I II III IV I II III IV I II III IV Quarters 2006 - 2008 17
18. 18. Decomposition – Linear trend – Example • Determine the values of a and b 2006 2007 2008 I II III IV I II III IV I II III IVyt 23 59 64 32 26 45 69 29 15 36 47 38x 1 2 3 4 5 6 7 8 9 10 11 12  x  n(n  1)  12(12  1)  78 1 2 1 2  x  n(n  1)(2n  1)  12(12  1)(2(12)  1)  650 2 1 6 1 6  y  483 t  xy  3044t yt  12 (483)  40, 25 1 x  12 (78)  6,5 1 18
19. 19. Decomposition – Linear trend – Example• Determine the values of a and b:S XX   x   x   650  12 (78) 2  143 2 1 2 1 nS XY   xyt  1   x   yt   650  12 (78)(483)  95,5 n 1 S XY 95,5b   0, 668 S XX 143a  yt  bx  40.25  (0, 668)(6,5)  44,592 yt  44,592  0,668 x ˆ 19
20. 20. Decomposition – Linear trend – Example• Determine the values of the isolated trend component If x = 1 then yt  44,592  0,668(1)  43,924 ˆ If x = 2 then yt  44,592  0,668(2)  43, 256 ˆ 20
21. 21. Decomposition – Linear trend – Example • Plot the trend line on the graph Visitors at a game ranch 80Number of visitors 70 60 yt  44,592  0,668x ˆ 50 40 30 20 10 0 I II III IV I II III IV I II III IV Quarters 2006 - 2008 21
22. 22. Decomposition – Linear trend – Example• Forecast the values for the next four quarters• Determine the x-values for the next four quarters.• Determine the estimated number of visitors for the next four quarters. If x = 13 then yt  44,592  0,668(13)  35,908 ˆ If x = 14 then yt  44,592  0,668(14)  35, 24 ˆ 22
23. 23. IMPORTANT• Forecasting in this way assumes the same linear trend holds true for future time periods• Remember:- 23
24. 24. ALSO IMPORTANT• Without seeing the trend line graphically it is still possible to determine whether the trend is increasing or decreasing over time• Slope of line is given by b. If b is +ve the slope is +ve and the trend is increasing over time. If b is –ve the slope is –ve and the trend is decreasing over time• The strength of the trend influence can be assessed by looking at b. A string upward/downward trend is shown by large +ve/-ve values of b. Values of b close to 0 indicate a wek trend 24
25. 25. EXAMPLEThe table below shows the annual expenditure of Exel Ltdon salaries (in R100,000), for each semester for a 4 yearperiod. Year Semester1 Semester 2 2002 140.3 160.6 2003 139.6 158.2 2004 141.4 163.8 2005 143.5 167.3A. What is the value of the slope of the linear trend line for this time series?B. What is the value of the intercept (line crosses Y axis) of the linear trend line for this time series?C. Forecast the expenditure on salaries (in rands) for the second semester in 2006 25
26. 26. EXAMPLE ANSWER A.  x = 36  x = 204 2 x = 4,5  y = 1 214,7 y = 151,8375  xy = 5 545,8 SXX = 42 SXY = 79,65 S b = XY SXX 79,65 = 42  = 1,8964 B.  a = y – b x = 151,8375 – 1,8964(4,5) = 143,3037  C.  ˆ y = 143,3037 + 1,8964(10) 26 = 162,2677
27. 27. Decomposition – Trend analysis – Moving average• Removes the short term fluctuations in a time series. – Smoothing a time series• Remove the effect of seasonal and irregular variations.• Reflect the trend and cyclical movements. – TC 27
28. 28. Decomposition – Trend analysis – Moving average • How to calculate a k-point moving average if k is odd 3-point moving 5-point movingTime (X) Price (yt) average average2008 - O 564.03 564.03  519.03  358.03 N 519.03 480.37 3 D 358.03 381.02 406.81  480.372009 - J 265.98 317.00 368.40 F 326.98 321.65 338.09 519.03  358.03  265.98 M 371.98 355.48 339.38 3 A 367.48 367.98 362.06  381.02 M 364.48 370.45 379.94 J 379.38 386.75 383.54 J 416.38 395.25 395.23 A 389.98 410.76 28 S 425.93
29. 29. Decomposition – Trend analysis – Moving average • How to calculate a k-point moving average if k is odd 3-point moving 5-point movingTime (X) Price (yt) average average2008 - O 564.03 N 519.03 480.37 D 358.03 381.02 406.812009 - J 265.98 317.00 368.40 F 326.98 321.65 338.09 M 371.98 355.48 339.38 A 367.48 367.98 362.06 M 364.48 370.45 379.94 J 379.38 386.75 383.54 J 416.38 395.25 395.23 A 389.98 410.76 29 S 425.93
30. 30. EXAMPLE Calculate a 3 point moving average and a 5 point moving average for the 2011 salaries of Rinto Ltd. The monthly salary data (in R10,000’s) is as follows:-Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov DecSal (y) 8 4 6 10 8 10 13 5 11 14 10 11 30
31. 31. Example answer• Example 13.3, p470, textbook 31
32. 32. Decomposition – Trend analysis – Moving average• How to calculate a k-point moving average if k is even. 32
33. 33. Decomposition – Trend analysis – Moving average• Plot the original time series data and moving average. Visitors at a game ranch 80 Number of visitors 70 60 yt 50 40 30 centred 20 moving 10 average 0 I II III IV I II III IV I II III IV Quarters 2006 - 2008 33
34. 34. EXAMPLE Calculate a 4 point moving average average for the 2011 salaries of Rinto Ltd. The monthly salary data (in R10,000’s) is as follows:-Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov DecSal (y) 8 4 6 10 8 10 13 5 11 14 10 11 34
35. 35. Example answer• Example 13.4, p471, textbook 35
36. 36. TERM OF MOVING AVERAGEGiven a set of time series data how do wechose an appropriate moving averageterm (k) for the series?Months 12Quarters 4Workdays 5 36
37. 37. Decomposition – Seasonal analysis• Isolates the seasonal components in a time series.• Dominates short-term movement.• Find seasonal index for each period. – Specific seasonal index • specific year • short term – Typical seasonal index • number of years • long term 37
38. 38. MOVING AVERAGES• Dampens short term fluctuations• Shorter terms still show some variations; longer terms produce a much smoother curve• Disadvantages of moving averages:-• Loss of information on both sides of the series• Not a specific mathematical equation therefore cannot be used in isolation to make objective forecasts 38
39. 39. SEASONAL ANALYSIS• Isolates the seasonal component in a time series• Most business and economic time series contain seasonal variations• To isolate the seasonal component we must find a seasonal index for each time period• Seasonal indices important because they are used to forecast future values 39
40. 40. SEASONAL INDICES• Two types:- – Specific seasonal index – measures seasonal change during a specific year – Typical seasonal index – measures seasonal changes over a number of years 40
41. 41. Decomposition – Seasonal analysis– Ratio-to-moving-average method• Use moving average to smooth time series: – Isolates trend and cyclical variations – Yt = TC – Y  TSCI 100  SI 100 - seasonal and irregular t TC• Find a typical seasonal index for each period.• Remember that sum of k mean seasonal indices must = k x 100.Calculate a series of seasonally adjusted values: – Y  TSCI 100  TCI 100 t S• Construct a trend line for the seasonally adjusted data.• Construct forecasts of the time series values. 41
42. 42. Decomposition– Seasonal analysis– Ratio-to-moving-averagemethod 42
43. 43. TSCI  SI TC 64  100  142.62 44.88TSCI  SI TC 36  100  109.51 32.88 43
44. 44. Yt = Yt = TCITCSI/TC=SI 42.81 Calculate the mean 53.52 index for each quarter: 142.62 40.10 73.56 20.05 I II III IV 61.36 48.39 2006 142.62 73.56 105.57 40.82 2007 61.36 105.57 168.81 75.57 168.81 43.23 2008 43.48 109.51 Total 75.57 37.94 Mean 52.42 107.54 155.715 74.565 390.24 43.48 27.92 Typical SI 53.73 110.23 159.61 76.43 400 109.51 32.66 29.45 49.72 44
45. 45. Yt = Yt = TCITCSI/TC=SI Sum of mean indices = 390,24 42.81 53.52 Must be adjusted to 400 142.62 40.10 73.56 20.05 I II III IV 61.36 48.39 2006 142.62 73.56 105.57 40.82 2007 61.36 105.57 168.81 75.57 168.81 43.23 2008 43.48 109.51 Total 75.57 37.94 Mean 52.42 107.54 155.715 74.565 390.24 43.48 27.92 Typical SI 53.73 110.23 159.61 76.43 400 109.51 32.66 k 100 400 adjustment factor =   1, 025 29.45  mean SI 390, 24 49.72  52, 42 1, 025  53, 73 45
46. 46. Time yt = Yt = Yt = TCI I II III IV (x) TCSI TCSI/TC=SI 2006 142.62 73.562006 - I 1 23 42.81 II 2 59 53.52 2007 61.36 105.57 168.81 75.57 III 3 64 142.62 40.10 2008 43.48 109.51 Total IV 4 32 73.56 20.05 Mean 52.42 107.54 155.715 74.565 390.242007 - I 5 26 61.36 48.39 Typical SI 53.73 110.23 159.61 76.43 400 II 6 45 105.57 40.82 III 7 69 168.81 43.23 Seasonal adjusted value = TCI IV 8 29 75.57 37.94 232008 - I 9 15 43.48 27.92 100  42,81 53, 73 II 10 36 109.51 32.66 III 11 47 29.45 IV 12 38 49.72 46
47. 47. Time yt = Yt = Yt = TCI I II III IV (x) TCSI TCSI/TC=SI 2006 142.62 73.562006 - I 1 23 42.81 II 2 59 53.52 2007 61.36 105.57 168.81 75.57 III 3 64 142.62 40.10 2008 43.48 109.51 Total IV 4 32 73.56 20.05 Mean 52.42 107.54 155.715 74.565 390.242007 - I 5 26 61.36 48.39 Typical SI 53.73 110.23 159.61 76.43 400 II 6 45 105.57 40.82 III 7 69 168.81 43.23 Seasonal adjusted value = TCI IV 8 29 75.57 37.94 292008 - I 9 15 43.48 27.92 100  37,94 76, 43 II 10 36 109.51 32.66 III 11 47 29.45 IV 12 38 49.72 47
48. 48. Decomposition – Seasonal analysis• Determine the trend line:  2 x  1 n(n  1)  1 12(12  1)  78 2  6 x 2  1 n(n  1)(2n  1)  1 12(12  1)(2(12)  1)  650 6  y  466, 61 t  xy  2941, 78 t yt  12 (466, 61)  38,88 1 x  12 (78)  6,5 1 48
49. 49. Decomposition – Seasonal analysis Seasonally• Determine the trend line: adj dataS XX   x    x   650  (78)  143 2 1 2 1 2 n 12S XY   xyt  1 n   x   y   2941, 78  (78)(466, 61)  91,185 t 1 12 S XY 91,185b   0, 638 S XX 143a  yt  bx  38,88  (0, 638)(6,5)  43, 027yt  43,027  0,638 xˆ 49
50. 50. Decomposition – Seasonal analysis• Determine the values of the isolated trend component: If x = 9 then yt  43, 027  0, 638(9)  37, 29 ˆ If x = 14 then yt  43, 027  0, 638(14)  34,10 ˆ 50
51. 51. Decomposition – Seasonal analysis• Determine the real predicted values: 34, 73  53, 73 33, 46 159, 61  18, 7  53, 401 100 100 51
52. 52. Decomposition – Seasonal analysis• Represent the real predicted values graphically: Visitors at a game ranch 60.00 Number of visitors 50.00 40.00 30.00 20.00 10.00 0.00 I II III IV I II III IV I II III IV I II III IV Quarters 2006 - 2009 52
53. 53. EXAMPLEMONTH PRICE Jan 355 Feb 326 Mar 371 Apr 375 May 389 Jun 365 Jul 362 Aug 351 Sep 346 Oct 364 Nov 399 Dec 338 53