Presentation is loading. Please wait.

Presentation is loading. Please wait.

SADC Course in Statistics Trends in time series (Session 02)

Similar presentations


Presentation on theme: "SADC Course in Statistics Trends in time series (Session 02)"— Presentation transcript:

1 SADC Course in Statistics Trends in time series (Session 02)

2 To put your footer here go to View > Header and Footer 2 Learning Objectives By the end of this session, you will be able to explain the main components of a time series use graphical procedures to examine a time series for possible trends describe the trend in the series –using a moving average –by fitting a line to the trend use the trend to do simple forms of forecasting

3 To put your footer here go to View > Header and Footer 3 General approach to analysis Step 1: Plot the data with time on x-axis Step 2: Study the pattern over time –Is there a trend? –Is there a seasonality effect? –Are there any long term cycles? –Are there any sharp changes in behaviour? –Can such changes be explained? –Are there any outliers, i.e. observations that differ greatly from the general pattern

4 To put your footer here go to View > Header and Footer 4 General approach to analysis Step 3: State clearly your objectives for study of the time series Step 4: Paying attention to the objectives, analyse the data, using descriptive analyses first, and moving later to other forms of analyses Step 5: Write a report giving the key results and the main findings and conclusions

5 To put your footer here go to View > Header and Footer 5 Main components of a time series Trend: the general direction in which the series is running during a long period Seasonal effects: Short-term fluctuations that occur regularly – often associated with months or quarters Cyclical effects: Long-term fluctuations that occur regularly in the series Residual: Whatever remains after the above have been taken into account, i.e. the unexplained (random) components of variation

6 To put your footer here go to View > Header and Footer 6 Examining trends Following slides include: Identifying if there appears to be a trend Describing and examining the trend using –Moving averages –Fitting a straight line to the data Simple approaches to forecasts, and likely dangers Note: Cyclical effects will not be covered since they are usually difficult to identify and need long series

7 To put your footer here go to View > Header and Footer 7 An Example Data below show the number of unemployed school leavers in the UK (in 000) Source: Employment Gazette YearJan-MarApr-JunJul-SepOct-Dec 1979221211031 1980212615070 19815036146110 Graphing the data is needed, but first need to put data in list format

8 To put your footer here go to View > Header and Footer 8 Putting the data in list format YearQuarterLeavers 11979.0022 11979.2512 11979.50110 11979.7531 21980.0021 21980.2526 21980.50150 21980.7570 31981.0050 31981.2536 31981.50146 31981.75110 The decimals for the quarters are only intended to give a rough approximation of the time point

9 To put your footer here go to View > Header and Footer 9 Clear seasonal and trend effects:

10 To put your footer here go to View > Header and Footer 10 Estimating trend - moving average We will ignore the seasonal pattern for now, and concentrate on estimating the trend… Purpose: to smooth out the local variation and possibly seasonal effects Method: Replace each observation by a weighted average of observations around (and including) the particular observation. Results will depend on –number of observations used –weights used

11 To put your footer here go to View > Header and Footer 11 An example Suppose we have the series Y 1, Y 2, ……….., Y n Then a moving average with weights 1 / 8, ¼, ¼, ¼, 1 / 8 Would have the i th value equal to Y i * = ( 1 / 8 )Y i-2 + ( ¼) Y i-1 + ( ¼) Y i + ( ¼) Y i+1 + ( 1 / 8 )Y i+2

12 To put your footer here go to View > Header and Footer 12 Points to note… Weights should always add to 1. To find a moving average, need to decide what order to use, i.e. how many to average. For data in quarters, sensible to use order=4 Where order=r, and r is odd, moving average (m.a.) values cannot be defined for the first (r-1)/2 and last (r-1)/2 obs ns in the series If r is even, m.a. values will lie midway between times of observation - nicer to have it coinciding with the time points of observed data

13 To put your footer here go to View > Header and Footer 13 Possible action when r is even If data are in quarters (say) could use a 4-point moving average first with equal weights, i.e. ¼, ¼, ¼, ¼ Then use a further moving average of order 2 on the first computed moving average, again with equal weights, i.e. ½, ½ This is equivalent to using weights 1 / 8, ¼, ¼, ¼, 1 / 8 on the original data series! i.e. it is equivalent to a 5-point m.a. See next slide last column for an example…

14 To put your footer here go to View > Header and Footer 14 Calculating the moving average YearQuarterLeaversThree-point mean Five-point moving average 11979.0022 11979.251248.00 11979.5011051.0043.63 11979.753154.0045.25 21980.002126.0052.00 21980.252665.761.88 21980.5015082.070.38 21980.757090.075.25 31981.005052.076.00 31981.253677.380.50 31981.5014697.3 31981.75110 Verify a few of the values in the last 2 columns…

15 To put your footer here go to View > Header and Footer 15 Time Series & the fitted trend The increasing trend is now clearly visible

16 To put your footer here go to View > Header and Footer 16 Estimating trend – fitting a line A second method for estimating trend is to find an equation giving the best fit to the trend. The simplest is a straight line, i.e. Y =a + bX Here a is called an intercept and b is called the slope of the line. Formulae for a and b, which minimise the squared distances of each data point from the line, are given on the final slide.

17 To put your footer here go to View > Header and Footer 17 Interpreting the line p q a The intercept a is shown on the graph. The slope b is given by b = p/q

18 To put your footer here go to View > Header and Footer 18 Equation of the line Equation of line is y = 19.4 + 7.07x

19 To put your footer here go to View > Header and Footer 19 Forecasting – simple approach Return to the equation of the line of best fit to the data, i.e. y = 19.4 + 7.07x For a future value of x, say at quarter 13, we may find y as y = 19.4 + 7.07 (13) = 111.3 However, there are many dangers involved with doing this – and it is not advisable to do without recognising these

20 To put your footer here go to View > Header and Footer 20 Some dangers in predictions Fitting a straight line as done here is part of a larger topic called Regression Analysis (contents of Module H8) One basic assumption is that repeat observations taken in time are assumed to be independent. This is rarely the case. Another is that the validity of the prediction becomes poorer as the value of x used (in the prediction) moves away from the time values used in finding the equation. DO NOT MAKE FORECASTS without further knowledge of many statistical and other practical issues involved in doing so.

21 To put your footer here go to View > Header and Footer 21 Practical work Use data on temperature records, to find a moving average, study its pattern, and write a short report of the results and conclusions Go through parts of Section 2 of CAST for SADC : Higher Level for improving your knowledge of the basic ideas of this session. Details of both exercises are given in the handout entitled Estimating Trend in a Time Series (Practical 02).

22 To put your footer here go to View > Header and Footer 22 Calculations for best fit line Let the equation of line be: Y = a + b*i, where i refers to the time points, incrementing by 1. Then and

23 To put your footer here go to View > Header and Footer 23 Some practical work follows…


Download ppt "SADC Course in Statistics Trends in time series (Session 02)"

Similar presentations


Ads by Google