You are on page 1of 36

# Analysis of Time Series Data For AS90641 Part 1 Basics for Beginners

September 2005

Created by Polly Stuart

1

Contents
 This resource is designed to suggest some ways students could meet the requirements of AS 90641.  It shows some common practices in New Zealand schools and suggests other simplified statistical methods.  The suggested methods do not necessarily reflect practices of Statistics New Zealand.
2

Aims
 This presentation takes you through the process of analysing the data in an Excel spreadsheet, drawing the graphs and identifying the trend. It also shows you how to do a forecast.  You will need to open the spreadsheet: Example sales.xls  Choose the worksheet labelled Hardware.
3

 Each data point is made up of 3 components: ± Trend ± Seasonal ± Irregular. For an additive series: Data value = Trend + Seasonal + Irregular 4 .Time series data  Shows what happens as time passes.

 Look for the different components.  Draw a graph.  Think about what might be the best way of analysing it.Beginnings  It is important to look at the series you are analysing before you start. 5 .

Look at: the trend the seasonal component the irregular Ret il S les of e 00 250 200 150 \$ illion 100 0 Mar Mar Mar Mar Mar Mar Mar Mar Mar Mar Mar Mar Mar 1991 1992 199 1994 1995 1996 1997 1998 1999 2000 2001 2002 200 Quarter 6 .

7 .Table Use this to separate out all the components of the series.

Set up the column titles in the spreadsheet 8 .

Step 1 is to identify the trend:  Use a moving average to estimate a trend.  In Excel you can do both columns in one go (see the next slide). use an order of 4 initially. 9 .  Because it is quarterly data.  Then centre the value by doing a moving average order 2.

Fill in the boxes by highlighting cells on your spreadsheet.Click into the column next to the third data value (C9) Click the fx button to open the function box Choose AVERAGE or MEDIAN. 10 .

Excel will use all the decimals in its calculations so rounding error is not a problem here. Rounding: Rounded to 3sf (why?).Fill down the column. 11 .

You don¶t have enough information for those moving averages. 12 . Colouring the cells helps to remind you not to use them.Delete the last 2 trend values.

Step 2 is to estimate the seasonal component:  Subtract out the trend to leave the estimated seasonal and irregular components.  Use a moving average to estimate the seasonal component value. 13 .

Calculate the seasonal and irregular values by subtracting the trend estimate from the raw data values. 14 . You are removing the trend leaving these two components. as shown below. This is called detrending! Fill down the column.

 The moving average method is better for longer series where the seasonal pattern may be changing over the time.Other methods for finding seasonal components  For short time series an average across all the values for a season may be used to find the seasonal effect.  That is why we will use this method for this data 15 .

[click on the first then hold down Ctrl to choose the others] Calculate a moving average over 3 values of the seasonal and irregular column for the quarter you want. (September in this case as it is the first quarter with a value in.) 16 .

Fill down. We are using the closest values as the best estimate of the missing ones. Do the same for the bottom 4 values. then copy and paste (values only) the nearest 4 values into the spaces. 17 .

Calculate the seasonally adjusted values. The seasonally adjusted column gives the values of the trend and irregular without the seasons. It is useful to compare the current value with values from previous seasons 18 .

Graphs 19 .

 We look at other possible models in the PowerPoint Extra for Experts.Step 3 is to find a linear model for the trend:  Be aware that the linear trend line gives a simplified estimation of the trend.  Fitting a straight line to the whole length of your moving average trend gives you a model to estimate its slope. 20 .

Insert a new column at the start and put a count in it. Fill down past the end of your table 21 .

22 .Highlight the next 3 columns and click on the graph icon to draw the line graph .

You can adjust it to look better if you want. Re a Sa es \$ ar are 3 250 200 150 1000 M ar 19 9 1 M ar 19 9 2 M ar 19 9 3 M ar 19 9 4 M ar 19 9 5 M ar 19 9 6 M ar 19 9 7 M ar 19 9 8 M ar 19 9 9 M ar 2000 M ar 2001 M ar 2002 M ar 2003 Hardw are sales rend esti ate 23 .

24 .Estimating trend  This can be done in two ways ± By looking at the moving average line at various points ± By fitting a regression line.  The first way gives a more accurate estimate of the most recent trend.

From the spreadsheet you can see that it rose \$42 million over the 4 years to September 2002. So from September 1998 hardware sales rose by approximately \$10. 25   .5 million per year.Method 1 Retail Sales of Hardware \$ m illion 300 250 200 150 1000 rend estimate ardw are sales M ar 19 9 1 M ar 19 9 2 M ar 19 9 3 M ar 19 9 4 M ar 19 9 5 M ar 19 9 M ar 19 9 7 M ar 19 9 8 M ar 19 9 9 M ar 2000 M ar 2001 M ar 2002 M ar 2003 Notice that from September 1998 the moving average rises steadily.

 It may not be very accurate for the most recent values 26 .Method 2  Get excel to put a linear regression line on the data  This should be based on the moving average line.  This will give an estimate for the whole period of the series.

Choose the option to display the equation. Click on options. 27 . Make sure that Trend Estimate is highlighted in the lower box. right click on a trend estimate data value and select Add trendline.On the graph.

Is the line a good model for forecasting terms in the series? How could you do a better one? R t il S l (m illion) Hardw are sales Trend estimate inear Trend estimate of H dw y 2 2 2 ar ar 2 ar ar ¥ ar ar ar The formula can be moved to be easier to see 28  t ¤©© ©© ¢©© ©©© £ £ £¢ £ £¢ ¡  ¨ £ £¢  ¡    § £ £¢ ¡ ¦ £ £¢ ¡ £ £¢ ¡ ¤ £ £¢ ¡ £ £¢ ¡ ¢ £ £¢ ¡ 0 ar 8 M ar M ar 2 M ar 2 M ar 2 2 M ar 2 .

This is approximately \$4 million per year. 29                            .Identify the trend in context Retail Sales of Hardware \$ m illion 2 2 2 0 Quart er \$\$ \$\$  \$\$ \$\$\$   #  "  !       99 992 99 99 99 99 99 998 999 2 2 2 2 2 The linear model for the trend line shows an increase in hardware sales of \$1.01 million per quarter.

30 .  Add back the seasonal component.Step 4 is to calculate your forecast:  Use the formula from your model of the trend line.  This gives an estimate of the trend component.  We will do an estimate for March 2004.

To forecast for March 2004 Make sure the count goes down to the quarter you want to forecast for. 31 .

Use the formula from your trend line to calculate the estimated trend value for March. 32 .

33 .Add back the seasonal effects for March using the most recent March value.

1725 In March 2004 the forecasted value for Retail Hardware sales using this model is \$219 million (3s. Forecast = 1. The next presentation looks at some ways of making better models.f).51 -2.71 221. Then the seasonal adjustment for March is added back in.Forecast 50 51 52 53 Jun 2003 Sep 2003 Dec 2003 Mar 2004 218.47 BUT: you need to be aware that your line did not follow the trend estimates very closely at the end. 34 . This is calculated by substituting the number of periods since March 1991 into the formula for the trend.0125 x 53 + 167.

35 .A worked example of the report you could produce for ales of Retail Hardware is available for you to check your results.

The End But see Extra for Experts! 36 .