820 likes | 1.03k Views
Seasonal Adjustment . Topics. Motivation and theoretical background (Øyvind Langsrud) Seasonal adjustment step-by-step (László Sajtos) (A few) issues on seasonal adjustment (László Sajtos). Presented by. Øyvind Langsrud Statistics Norway.
E N D
Topics • Motivation and theoretical background (Øyvind Langsrud) • Seasonal adjustment step-by-step (László Sajtos) • (A few) issues on seasonal adjustment (László Sajtos)
Presented by Øyvind Langsrud Statistics Norway
Monthly time series example Trend and seasonality can be seen How to find it by computation?
Quick and dirty calculation of trend by ordinary linear regression:y = a + b*time + e time = 2000.000, 2000.083, 2000.167, 2000.250, 2000.333, 2000.417, 2000.500, 2000.583, 2000.667, 2000.750, 2000.833, 2000.917, 2001.000, 2001.083, …... a = -6619.731 b = 3.351223
Including seasonality in "the dirty model"y = a+ b*time + cmonth+ e
Including seasonality in "the dirty model" y = a+ b*time + cmonth+ e Transforming to seasonal adjustment language a + b*time → Tt cmonth → St e → It a = -6468.505 b = 3.275956 c = mnd0 mnd2 mnd3 mnd4 mnd5 mnd6 -9.19620250 -16.59062737 -6.79790939 -8.51090569 -1.18890200 6.33881598 mnd7 mnd8 mnd9 mnd10 mnd11 mnd12 1.84439111 4.62139480 -2.56494236 -0.04409251 1.53598811 30.55299181 yt = Tt + St+ It
Trend from "the dirty model" yt = Tt + St + It
Seasonality from "the dirty model" yt = Tt + St+ It
Seasonal adjustment by "the dirty model" yt = Tt + St+ It
Question to the audience:What is wrong with this ordinary regression approach ?
Irregular component by "the dirty model" yt = Tt + St + It
In practise a multiplicative model is used:yt = Tt× St× It yt is not the original series but a series that is corrected for holiday and trading day effects (calendar adjusted) yt =Tt× St × It
yt = Tt× St× It Note that the seasonal factors vary slightly along time
yt = Tt× St×It This time the irregular component looks more as true noise Note that correlated neighbour values is allowed (autocorrelation)
yt = Tt×St× It This is seasonally adjusted data as published by Statistics Norway
Multiplicative model: yt = Tt× St× It Additive model: yt = Tt+ St+ ItHow to calculate Tt, St,and It from yt? • This is done by filtering techniques • One element of this methodology is how to calculate the trend from seasonally adjusted data • This is a question of smoothing a noisy series
Smoothing by averaging Pt = (Yt-1+ Yt +Yt+1)/3
Also called filtering Pt = (Yt-2+ Yt-1+ Yt +Yt+1 +Yt+2)/5 The filter is [1,1,1,1,1]/5
Filtering can be performed twice 3x3 filter 3-term moving average of a 3-term moving average The final filter is [1,2,3,2,1]/9 Pt = (Yt-2+ 2Yt-1+ 3Yt +2Yt+1 +Yt+2)/9 2x12 filter [1/2,1,1,1,1,1,1,1,1,1,1,1,1/2]/12 Also called a centred 12-term moving average Question to the audience: Why is this filter of special interest?
Henderson filters Finding filters with good properties is an interesting topic … Hederson (1916) introduces the so-called Henderson filters X-12-ARIMA uses this type of filter to calculate the trend The filter length determines the degree of smoothing
Question to the audience: Why does the filtered series stop in 2009?
Non-available observations at the end: Two solutions Asymmetric filters Asymmetric variant of Henderson [-0.034,0.116,0.383,0.534,0,0,0] Can be used at the last observation Forecasts in place of the unobserved values The “starting series” for the X12-ARIMA decompositions is a calendar adjusted series which is based on reg-ARIMA modelling The reg-ARIMA modelling can also be used to produced forecasts X12-ARIMA uses these forecasts in trend calculations
Finding the seasonal component by filtering From a series with the trend removed we make 12 series January-values, February-values, … Each of these series is smoothed by filtering Altogether these smoothed series are the seasonal component
The X12-ARIMA algorithm The decomposition is made by several iterative steps Seasonal component from series with trend removed Trend from series with seasonal component removed Initial estimate of trend using the 2x12 moving average One element is downweighting of observations with an extreme irregular component
X12-ARIMA or SEATS Both method can be viewed as filtering techniques X12-ARIMA A non-parametric method No model assumed SEATS The components are assumed to follow ARIMA models The filters are derived from modelling Possible to do inference and to make forecasts with confidence intervals • So why the name X12-ARIMA when this method is the one that is not based on ARIMA? • Answer on the next slide
Calendar adjustment by reg-ARIMA modelling Seasonal ARIMA model Correlated errors (autocorrelation) Differencing the series makes the model quite good without explicit parameters for trend and seasonality Need to decide the type of ARIMA model: ARIMA(p,d,q)(P,D,Q) Regression parameters in the model Calendar effects: Trading day, Moving holyday, … Outliers and level shifts Here y can be a log-transformed and leap-year adjusted variant of the original data "The dirty model" mentioned earlier:
This slide is “stolen” from https://www.scss.tcd.ie/Rozenn.Dahyot/ST7005/15SeasonalARIMA.pdf • Here B is the backshift operator: BYt =Yt-1 • ARIMA(0,1,1)(0,1,1) • Most common model • Airline model
Example of regression variables in reg-ARIMA modelling Easter 2000 and 2001: Easter in April 2008: Easter in March 2002: 4 of 5 Norwegian Easter days in March Trading day Six parameters needed to model seven days Mon: Number of Mondays minus Number of Sundays Easter Mon Tue Wed Thu Fri Sat Jan 2000 0.0000000 0 -1 -1 -1 -1 0 Feb 2000 0.0000000 0 1 0 0 0 0 Mar 2000 -0.2571429 0 0 1 1 1 0 Apr 2000 0.2571429 -1 -1 -1 -1 -1 0 May 2000 0.0000000 1 1 1 0 0 0 Jun 2000 0.0000000 0 0 0 1 1 0 Jul 2000 0.0000000 0 -1 -1 -1 -1 0 Aug 2000 0.0000000 0 1 1 1 0 0 Sep 2000 0.0000000 0 0 0 0 1 1 Oct 2000 0.0000000 0 0 -1 -1 -1 -1 Nov 2000 0.0000000 0 0 1 1 0 0 Dec 2000 0.0000000 -1 -1 -1 -1 0 0 Jan 2001 0.0000000 1 1 1 0 0 0 Feb 2001 0.0000000 0 0 0 0 0 0 Mar 2001 -0.2571429 0 0 0 1 1 1 Apr 2001 0.2571429 0 -1 -1 -1 -1 -1 May 2001 0.0000000 0 1 1 1 0 0 Jun 2001 0.0000000 0 0 0 0 1 1 Jul 2001 0.0000000 0 0 -1 -1 -1 -1 Aug 2001 0.0000000 0 0 1 1 1 0 Sep 2001 0.0000000 -1 -1 -1 -1 -1 0 Oct 2001 0.0000000 1 1 1 0 0 0 Nov 2001 0.0000000 0 0 0 1 1 0 Dec 2001 0.0000000 0 -1 -1 -1 -1 0 Jan 2002 0.0000000 0 1 1 1 0 0 Feb 2002 0.0000000 0 0 0 0 0 0 Mar 2002 0.5428571 -1 -1 -1 -1 0 0 Apr 2002 -0.5428571 1 1 0 0 0 0 May 2002 0.0000000 0 0 1 1 1 0 : : : Mar 2008 0.7428571 0 -1 -1 -1 -1 0 Apr 2008 -0.7428571 0 1 1 0 0 0 May 2008 0.0000000 0 0 0 1 1 1 Jun 2008 0.0000000 0 -1 -1 -1 -1 -1 Jul 2008 0.0000000 0 1 1 1 0 0 Aug 2008 0.0000000 -1 -1 -1 -1 0 0 Sep 2008 0.0000000 1 1 0 0 0 0 Oct 2008 0.0000000 0 0 1 1 1 0 Nov 2008 0.0000000 -1 -1 -1 -1 -1 0 Dec 2008 0.0000000 1 1 1 0 0 0
Trading day:Separate effect of each day or common effect of all weekdays? Question to the audience: Why exactly equal t-values? Regression Model -------------------------------------------------------------- Parameter Standard Variable Estimate Error t-value -------------------------------------------------------------- Trading Day Mon -0.0019 0.00193 -1.00 Tue 0.0064 0.00194 3.31 Wed 0.0018 0.00190 0.94 Thu -0.0016 0.00195 -0.81 Fri 0.0138 0.00188 7.37 Sat 0.0034 0.00193 1.73 *Sun (derived) -0.0219 0.00196 -11.16 Regression Model -------------------------------------------------------------- Parameter Standard Variable Estimate Error t-value -------------------------------------------------------------- Trading Day Weekday 0.0036 0.00053 6.87 **Sat/Sun (derived) -0.0090 0.00131 -6.87
Outliers An extreme observation caused by a special event can be problematic Can influence the modelling in a negative way Parameter estimates Forecasts Decomposition Solution Include the outlier as a dummy variable in the reg-ARIMA modelling ….0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0…. The outlier is included in the irregular component after modelling The observation is still included in seasonally adjusted data But has no effect on the trend • Question to the audience: Examples of special events?
Level shift is handled similar to outliers Regression variable: ….0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1…. Level shift is included in the trend
Presented by • László Sajtos • HungarianCentralStatistical Office
Topics • Seasonaladjustmentstep-by-step • (A few) issuesonseasonaladjustment
Seasonaladjustmentstep-by-step: structure Input data STEPS withcheckpoints Notacceptableresults Preliminaryresults Ifresultsareacceptable Output data
Time series analysis (STEP 0) • Basic conditions • Length of time series (enoughlongto be seasonallyadjusted?) • Monthlydatasets: atleast 3-year long • Quarterlydatasets: atleast 4-year long • Atleast 5-7-year longtime series is optimal! • Expertinformation • Collectingexpertdatafromthesectionsaboutdatasets (potentialoutliers, methodologicalchanges, changesinexteriorfactors (e.g. law), connectionstoothertime series and sectors)
Graphicalanalysis, test forseasonality (STEP 1) • Graphicalanalysisviabasic and sophisticatedgraphs Plottedrawdataset Spectralanalysis: autocorrelogram and auto-regressivespectrum • Identifying and explainingmissingobservationsandoutliers • Correction of datafaults • Test forseasonality
Graphicalanalysis, an example(2000-2013) Seasonality Seemsadditive Probablyoutliers Data:Hungarianmonthlyretailvolume index, food