time series basics

Upload: twelvemiracles

Post on 08-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Time Series Basics

    1/36

    September 2005 Created by Polly Stuart 1

    Analysis of Time Series Data

    For AS90641

    Part 1

    Basics for Beginners

  • 8/6/2019 Time Series Basics

    2/36

    2

    Contents This resource is designed to suggestsome ways students could meet therequirements of AS 90641.

    It shows some common practices inNew Zealand schools and suggestsother simplified statistical methods.

    The suggested methods do notnecessarily reflect practices of StatisticsNew Zealand.

  • 8/6/2019 Time Series Basics

    3/36

    3

    Aims

    This presentation takes you through theprocess of analysing the data in an Excel

    spreadsheet, drawing the graphs andidentifying the trend. It also shows you how todo a forecast.

    You will need to open the spreadsheet:Example sales.xls

    Choose the worksheet labelled Hardware.

  • 8/6/2019 Time Series Basics

    4/36

    4

    Time series data

    Shows what happens as time passes.

    Each data point is made up of3

    components: Trend

    Seasonal

    Irregular.

    For an additive series:

    Data value = Trend + Seasonal +Irregular

  • 8/6/2019 Time Series Basics

    5/36

    5

    Beginnings

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

    Draw a graph.

    Look for the different components.

    Think about what might be the best wayof analysing it.

  • 8/6/2019 Time Series Basics

    6/36

    6

    Look at: the trend

    the seasonal component

    the irregular

    Ret il S les of e

    100

    150

    200

    250

    00

    Mar

    1991

    Mar

    1992

    Mar

    199

    Mar

    1994

    Mar

    1995

    Mar

    1996

    Mar

    1997

    Mar

    1998

    Mar

    1999

    Mar

    2000

    Mar

    2001

    Mar

    2002

    Mar

    200

    Quarter

    $ illion

    0

  • 8/6/2019 Time Series Basics

    7/36

    7

    Table

    Use this to separate out all the

    components of the series.

  • 8/6/2019 Time Series Basics

    8/36

    8

    Set up the column titles in the spreadsheet

  • 8/6/2019 Time Series Basics

    9/36

    9

    Step 1 is to identify the trend: Use a moving average to estimate a

    trend.

    Because it is quarterly data, use anorder 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).

  • 8/6/2019 Time Series Basics

    10/36

    10

    Click into the column next to the third datavalue (C9)

    Click the button to open the function box

    Choose AVERAGE or MEDIAN.

    xf

    Fill in the boxes by highlighting cells on your

    spreadsheet.

  • 8/6/2019 Time Series Basics

    11/36

    11

    Rounding: Rounded to 3sf (why?).

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

    Filldown

    thecolumn.

  • 8/6/2019 Time Series Basics

    12/36

    12

    Delete the last 2 trend values. You dont haveenough information for those moving averages.

    Colouring the cells helps to remind you not to use

    them.

  • 8/6/2019 Time Series Basics

    13/36

    13

    Step 2 is to estimate the seasonalcomponent:

    Subtract out the trend to leave theestimated seasonal and irregularcomponents.

    Use a moving average to estimate the

    seasonal component value.

  • 8/6/2019 Time Series Basics

    14/36

    14

    Calculate the seasonal and irregular values bysubtracting the trend estimate from the raw data

    values, as shown below. You areremoving thetrend leavingthese two

    components.This is calleddetrending!

    Fill downthecolumn.

  • 8/6/2019 Time Series Basics

    15/36

    15

    Other methods for finding seasonalcomponents 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 forthis data

  • 8/6/2019 Time Series Basics

    16/36

    16

    Calculate a moving

    average over3 values ofthe seasonal and irregularcolumn for the quarter youwant. (September in thiscase as it is the firstquarter with a value in.)

    [clickonthe firstthen hold

    down Ctrltochoosetheothers]

  • 8/6/2019 Time Series Basics

    17/36

    17

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

    We are usingthe closestvalues as thebest estimate

    of the missingones.

    Do the samefor the bottom4 values.

  • 8/6/2019 Time Series Basics

    18/36

    18

    Calculate the seasonally adjusted values.

    The seasonallyadjusted 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

  • 8/6/2019 Time Series Basics

    19/36

    19

    Graphs

  • 8/6/2019 Time Series Basics

    20/36

    20

    Step 3 is to find a linear model for the

    trend:

    Be aware that the linear trend line givesa simplified estimation of the trend.

    Fitting a straight line to the whole lengthof your moving average trend gives youa model to estimate its slope.

    We look at other possible models in thePowerPoint Extra for Experts.

  • 8/6/2019 Time Series Basics

    21/36

    21

    Insert a new column at the start andput a count in it.

    Filldown

    pasttheend ofyour

    table

  • 8/6/2019 Time Series Basics

    22/36

    22

    Highlight the next 3columns and click on

    the graph icon to

    draw the line graph .

  • 8/6/2019 Time Series Basics

    23/36

    23

    You can adjust itto look better ifyou want.

    Re a Sa es ar are

    100

    150

    200

    250

    3

    M ar

    1991

    M ar

    1992

    M ar

    199 3

    M ar

    1994

    M ar

    1995

    M ar

    1996

    M ar

    199 7

    M ar

    199 8

    M ar

    1999

    M ar

    2000

    M ar

    2001

    M ar

    2002

    M ar

    20 03

    $

    Hardw are

    sales

    rend

    esti ate

    0

  • 8/6/2019 Time Series Basics

    24/36

    24

    Estimating trend

    This can be done in two ways

    By looking at the moving average line atvarious points

    By fitting a regression line. The first way gives a more accurate

    estimate of the most recent trend.

  • 8/6/2019 Time Series Basics

    25/36

    25

    Method 1

    Notice that from September 1998 the movingaverage rises steadily.

    From the spreadsheet you can see that it rose $42million over the 4 years to September 2002.

    So from September 1998 hardware sales rose byapproximately $10.5 million per year.

    Retail Sales of Hardware

    100

    150

    200

    250

    300

    M ar

    1991

    M ar

    1992

    M ar

    1993

    M ar

    1994

    M ar

    1995

    M a r

    199

    M ar

    1997

    M ar

    199 8

    M ar

    1999

    M ar

    2 0 0 0

    M ar

    2 0 0 1

    M ar

    2 0 0 2

    M ar

    2 0 0 3

    $ million

    ardw are

    sales

    rend

    estimate

    0

  • 8/6/2019 Time Series Basics

    26/36

    26

    Method 2

    Get excel to put a linear regression lineon the data

    This should be based on the moving

    average line.

    This will give an estimate for the wholeperiod of the series.

    It may not be very accurate for the mostrecent values

  • 8/6/2019 Time Series Basics

    27/36

    27

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

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

    Choose the option to display the equation.

  • 8/6/2019 Time Series Basics

    28/36

    28

    The formula can be moved to be easier to see

    Is the line a good model for forecasting termsin the series?

    How could you do a better one?

    R t il S l of H dw y 2

    2

    2

    ar

    ar

    2

    ar

    ar

    ar

    ar

    ar

    ar

    8

    Mar

    Mar

    2

    Mar

    2

    Mar

    2

    2

    Mar

    2

    t

    (m illion)

    Hardware

    sales

    Trend

    estimate

    inear

    Trendestimate

    0

  • 8/6/2019 Time Series Basics

    29/36

    29

    Retail Sales of Hardware2

    2

    2

    9 9

    9 9 2

    9 9

    9 9

    9 9!

    9 9"

    9 9#

    9 9 8

    9 9 9

    2$ $ $

    2$ $

    2$ $

    2

    2$ $

    Q u a r t e r

    $ million

    0

    Identify the trend in context

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

  • 8/6/2019 Time Series Basics

    30/36

    30

    Step 4 is to calculate your forecast:

    Use the formula from your model of thetrend line.

    This gives an estimate of the trendcomponent.

    Add back the seasonal component.

    We will do an estimate for March 2004.

  • 8/6/2019 Time Series Basics

    31/36

    31

    To forecast forMarch 2004

    Makesure thecountgoesdown tothequarteryou want

    toforecastfor.

  • 8/6/2019 Time Series Basics

    32/36

    32

    Use the formulafrom your trendline to calculatethe estimatedtrend value for

    March.

  • 8/6/2019 Time Series Basics

    33/36

    33

    Add back the seasonal effects for March using

    the most recent March value.

  • 8/6/2019 Time Series Basics

    34/36

    34

    Forecast

    In March 2004 the forecasted value for Retail Hardwaresales using this model is $219 million (3s.f). This is

    calculated by substituting the number of periods sinceMarch 1991 into the formula for the trend. Then theseasonal adjustment for March is added back in.

    Forecast = 1.0125 x 53 + 167.51 -2.47

    BUT: youneed to be aware that your line did not followthe trend estimates very closely at the end.

    The next presentation looks at some ways of makingbetter models.

    50 Jun 2003

    51 Sep 2003

    52 Dec 2003

    53 Mar 2004 218.71 221.1725

  • 8/6/2019 Time Series Basics

    35/36

    35

    A worked example of the report you

    could produce for ales of RetailHardware is available for you tocheck

    your results.

  • 8/6/2019 Time Series Basics

    36/36

    36

    The EndBut see Extra for Experts!