analysis of time series data

36
September 2005 Created by Polly Stuart 1 Analysis of Time Series Data For AS90641 Part 1 Basics for Beginners

Upload: glora

Post on 16-Jan-2016

37 views

Category:

Documents


1 download

DESCRIPTION

Analysis of Time Series Data. For AS90641 Part 1 Basics for Beginners. 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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Analysis of Time Series Data

September 2005 Created by Polly Stuart 1

Analysis of Time Series Data

For AS90641

Part 1

Basics for Beginners

Page 2: Analysis of Time Series Data

2

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.

Page 3: Analysis of Time Series Data

3

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.

Page 4: Analysis of Time Series Data

4

Time series data

• Shows what happens as time passes.• Each data point is made up of 3 components:

– Trend– Seasonal– Irregular.

For an additive series:

Data value = Trend + Seasonal + Irregular

Page 5: Analysis of Time Series Data

5

Beginnings

• It is important to look at the series you are analysing before you start.

• Draw a graph.

• Look for the different components.

• Think about what might be the best way of analysing it.

Page 6: Analysis of Time Series Data

6

Look at: the trend

the seasonal component

the irregular

Retail Sales of Hardware

100

150

200

250

300

Mar 1991

Mar1992

Mar1993

Mar1994

Mar1995

Mar1996

Mar1997

Mar1998

Mar1999

Mar2000

Mar2001

Mar2002

Mar2003

Quarter

$ million

0

Page 7: Analysis of Time Series Data

7

Table

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

Page 8: Analysis of Time Series Data

8

Set up the column titles in the spreadsheet

Page 9: Analysis of Time Series Data

9

Step 1 is to identify the trend:

• Use a moving average to estimate a trend.

• Because it is quarterly data, use an order of 4 initially.

• Then centre the value by doing a moving average order 2.

• In Excel you can do both columns in one go (see the next slide).

Page 10: Analysis of Time Series Data

10

Click into the column next to the third data value (C9)

Click the button to open the function box

Choose AVERAGE or MEDIAN.

xf

Fill in the boxes by highlighting cells on your spreadsheet.

Page 11: Analysis of Time Series Data

11

Rounding: Rounded to 3sf (why?).

Excel will use all the decimals in its calculations so rounding error is not a problem here.

Fill down the column.

Page 12: Analysis of Time Series Data

12

Delete the last 2 trend values. You don’t have enough information for those moving averages.

Colouring the cells helps to remind you not to use them.

Page 13: Analysis of Time Series Data

13

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.

Page 14: Analysis of Time Series Data

14

Calculate the seasonal and irregular values by subtracting the trend estimate from the raw data values, as shown below.

You are removing the trend leaving these two components. This is called detrending!

Fill down the column.

Page 15: Analysis of Time Series Data

15

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.

• The moving average method is better for longer series where the seasonal pattern may be changing over the time.

• That is why we will use this method for this data

Page 16: Analysis of Time Series Data

16

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.)

[click on the first then hold down Ctrl to choose the others]

Page 17: Analysis of Time Series Data

17

Fill down, then copy and paste (values only) the nearest 4 values into the spaces.

We are using the closest values as the best estimate of the missing ones.

Do the same for the bottom 4 values.

Page 18: Analysis of Time Series Data

18

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

Page 19: Analysis of Time Series Data

19

Graphs

Page 20: Analysis of Time Series Data

20

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.

• We look at other possible models in the PowerPoint Extra for Experts.

Page 21: Analysis of Time Series Data

21

Insert a new column at the start and put a count in it.

Fill down past the end of your table

Page 22: Analysis of Time Series Data

22

Highlight the next 3 columns and click on

the graph icon to draw the line graph .

Page 23: Analysis of Time Series Data

23

You can adjust it to look better if you want.

Retail Sales of Hardware

100

150

200

250

300

Mar

1991

Mar

1992

Mar

1993

Mar

1994

Mar

1995

Mar

1996

Mar

1997

Mar

1998

Mar

1999

Mar

2000

Mar

2001

Mar

2002

Mar

2003

$ million

Hardw aresales

Trend estimate

0

Page 24: Analysis of Time Series Data

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.

Page 25: Analysis of Time Series Data

25

Method 1

Notice that from September 1998 the moving average rises steadily.

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.5 million per year.

Retail Sales of Hardware

100

150

200

250

300

Mar

1991

Mar

1992

Mar

1993

Mar

1994

Mar

1995

Mar

1996

Mar

1997

Mar

1998

Mar

1999

Mar

2000

Mar

2001

Mar

2002

Mar

2003

$ million

Hardw aresales

Trend estimate

0

Page 26: Analysis of Time Series Data

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.

• It may not be very accurate for the most recent values

Page 27: Analysis of Time Series Data

27

On the graph, right click on a trend estimate data value and select Add trendline.

Make sure that Trend Estimate is highlighted in the lower box. Click on options.

Choose the option to display the equation.

Page 28: Analysis of Time Series Data

28

The formula can be moved to be easier to see

Is the line a good model for forecasting terms in the series?

How could you do a better one?

Retail Sales of Hardware y = 1.0125x + 167.51

100

150

200

250

300

Mar

1991

Mar

1992

Mar

1993

Mar

1994

Mar

1995

Mar

1996

Mar

1997

Mar

1998

Mar

1999

Mar

2000

Mar

2001

Mar

2002

Mar

2003

Quarter

$ (million)

Hardw aresales

Trend estimate

Linear(Trend estimate)

0

Page 29: Analysis of Time Series Data

29

Retail Sales of Hardware y = 1.0125x + 167.51

100

150

200

250

300

Mar

1991

Mar

1992

Mar

1993

Mar

1994

Mar

1995

Mar

1996

Mar

1997

Mar

1998

Mar

1999

Mar

2000

Mar

2001

Mar

2002

Mar

2003

Quarter

$ million

Hardw aresales

Trend estimate

Linear(Trend estimate)

0

Identify the trend in context

The linear model for the trend line shows an increase in hardware sales of $1.01 million per quarter. This is approximately $4 million per year.

Page 30: Analysis of Time Series Data

30

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.

• Add back the seasonal component.

• We will do an estimate for March 2004.

Page 31: Analysis of Time Series Data

31

To forecast for March 2004

Make sure the count goes down to the quarter you want to forecast for.

Page 32: Analysis of Time Series Data

32

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

Page 33: Analysis of Time Series Data

33

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

Page 34: Analysis of Time Series Data

34

Forecast

In March 2004 the forecasted value for Retail Hardware sales using this model is $219 million (3s.f). This is calculated by substituting the number of periods since March 1991 into the formula for the trend. Then the seasonal adjustment for March is added back in.

Forecast = 1.0125 x 53 + 167.51 -2.47

BUT: you need to be aware that your line did not follow the trend estimates very closely at the end.

The next presentation looks at some ways of making better models.

50 Jun 2003      

51 Sep 2003      

52 Dec 2003      

53 Mar 2004 218.71 221.1725  

Page 35: Analysis of Time Series Data

35

A worked example of the report you could produce for Sales of Retail

Hardware is available for you to check your results.

Page 36: Analysis of Time Series Data

36

The EndBut see Extra for Experts!