Using Demetra Using Demetra+ as a tool for time series ... · tool for time series analysis ......

Post on 31-Jan-2020

12 views 0 download

transcript

Using Using Using Using DemetraDemetraDemetraDemetra+ as a + as a + as a + as a tool for time series tool for time series tool for time series tool for time series analysisanalysisanalysisanalysisJ. MURO

UNIVERSIDAD DE ALCALÁ

IntroductionIntroductionIntroductionIntroduction�Demetra+ is a family of modules on seasonal adjustment.

�It uses leading algorithms in the field: TRAMO-SEATS (Bank of Spain) and X-12-ARIMA (US Bureau of the Census).

�Two main stages: pre-adjustment and decomposition.

4/19/2016 J.MURO

An overview of An overview of An overview of An overview of DemetraDemetraDemetraDemetra++++�Loading series from Excel

�Graph and descriptive statistics

�Seasonal adjustment

◦TRAMO-SEATS

◦X-12-ARIMA

4/19/2016 J.MURO

Layout of Layout of Layout of Layout of DemetraDemetraDemetraDemetra++++

Browsers panel

Time series

properties

Workspace panel

Logs

Actual analysis

4/19/2016 J.MURO

Loading series from ExcelLoading series from ExcelLoading series from ExcelLoading series from Excel

�Rules:

◦A1 cell must be empty and the A column must contain the reference dates of the observations.

◦First row cells must contain the names (or titles) of the series.

◦Columns (or rows in horizontal presentation) contain the data

◦Missing data: empty cell.

4/19/2016 J.MURO

Loading series from ExcelLoading series from ExcelLoading series from ExcelLoading series from Excel

�Procedure:

◦ Go to browsers panel.

◦ Click on the Excel tab.

◦ Click on the add button.

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data

�Use option Tools in the main menu.

�Container and Tool windows (submenus) allows to do pre-analysis procedures.

�Examples (always drag and drop):

◦ Grid

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data◦Chart and Growth chart

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data◦Spectral analysis : periodogram; autorregresivespectrum

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data◦Differencing (D: regular difference; BD: seasonal difference)

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data

�An example: Series of incoming tourism in Spain.

�Use the Excel file Tourism_2016.xls. It contains 4 incoming tourism series: United Kingdom, Germany, France and Italy. They are monthly series of the number of foreign tourists from that countries visiting Spain.

�When we load this file appears the following

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data

4/19/2016 J.MURO

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data

4/19/2016 J.MURO

Your series are now in DEMETRA + and you can use the options presented above. For example this is a multiple graph of the series

Have a look at your dataHave a look at your dataHave a look at your dataHave a look at your data

4/19/2016 J.MURO

Browse the different options in Tools tab. At this moment one of the more interesting options is Differencing.

Single series analysisSingle series analysisSingle series analysisSingle series analysis

•Two alternative (identical) options:

� Main menu: Seasonal adjustment/single analysis/wizard

� Double click in the browsers panel (series).

4/19/2016 J.MURO

Predefined specifications Predefined specifications Predefined specifications Predefined specifications ((((TramoTramoTramoTramo))))

Method Name Explanation

Tramo-Seats RSA0 level, airline model

Tramo-Seats RSA1 log/level, outliers detection, airline model

Tramo-Seats RSA2 log/level, working days, Easter , outliers detection,

airline model

Tramo-Seats RSA3 log/level, outliers detection, automatic model

identification

Tramo-Seats RSA4 log/level, working days, Easter , outliers detection,

automatic model identification

Tramo-Seats RSA5 log/level, trading days, Easter , outliers detection,

automatic model identification

4/19/2016 J.MURO

ResultsResultsResultsResults

�Output (TRAMO-SEATS) is organized in four sections:

◦Main results

◦Pre-processing (TRAMO)

◦Decomposition (SEATS)

◦Diagnostics

4/19/2016 J.MURO

Main resultsMain resultsMain resultsMain results

�The page contains a short description of the used model and of the quality of the seasonal adjustment.

�Items: selected model; outliers corrections; calendar effects (leap year, working days, Easter effect…); components variance; visual tests…….

4/19/2016 J.MURO

PrePrePrePre----processingprocessingprocessingprocessing

�Description and properties of pre-adjustment step.

�Items: ARIMA model selected; regression variables; residuals tests….

4/19/2016 J.MURO

DecompositionDecompositionDecompositionDecomposition

�It contains the ARIMA models which are defined by SEATS: seasonally adjusted (sa) series; trend-cycle component; seasonal component; irregular component.

4/19/2016 J.MURO

DiagnosticsDiagnosticsDiagnosticsDiagnostics

�Very detailed information on the seasonal adjustment procedures.

4/19/2016 J.MURO

Quality indicatorsQuality indicatorsQuality indicatorsQuality indicators

4/19/2016 J.MURO

For any processing DEMETRA offers a quality

indicator whose meaning is

Quality indicatorsQuality indicatorsQuality indicatorsQuality indicators

4/19/2016 J.MURO

Saving results to an external file Saving results to an external file Saving results to an external file Saving results to an external file (single series analysis)(single series analysis)(single series analysis)(single series analysis)

�In single analysis you can save your results to an external Excel file through

◦TramoSeatsdoc-j/copy/results

◦Where TramoSeatsdoc-j is the name of the single processing output.

◦For example, with Germany series and RSA5 the output is

4/19/2016 J.MURO

Saving results to an external fileSaving results to an external fileSaving results to an external fileSaving results to an external file

4/19/2016 J.MURO

Saving results to an external fileSaving results to an external fileSaving results to an external fileSaving results to an external file

And to export your results

4/19/2016 J.MURO

Saving results to an external Saving results to an external Saving results to an external Saving results to an external file file file file (single series analysis)(single series analysis)(single series analysis)(single series analysis)

�There is not a built-in procedure to save your results to a specific file.

�Then, previously you should create an excel file, for instance, results01.xls.

�Once you have copied your results in Demetra, open the results01.xls file and paste them.

4/19/2016 J.MURO

Saving results to an external Saving results to an external Saving results to an external Saving results to an external file file file file (single series analysis)(single series analysis)(single series analysis)(single series analysis)

�You can change the output content (number of series to be generated) through the options menu.

�For the Germany data, you get

4/19/2016 J.MURO

Saving results to an external fileSaving results to an external fileSaving results to an external fileSaving results to an external file

4/19/2016 J.MURO

Saving results to an external Saving results to an external Saving results to an external Saving results to an external file file file file (single series analysis)(single series analysis)(single series analysis)(single series analysis)

�All series with the option true are saved.

�Any series you do not want must have the option false.

4/19/2016 J.MURO

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

•The best option is:

�Main menu: Seasonal adjustment/multi-processing/wizard

�Remember that drag and drop procedure makes that a single series analysis amounts to a multiple series analysis with only one series.

4/19/2016 J.MURO

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

•Example: series in Tourim.xls.

4/19/2016 J.MURO

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

4/19/2016 J.MURO

Always drag

and drop

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

4/19/2016 J.MURO

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

4/19/2016 J.MURO

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

4/19/2016 J.MURO

ResultsResultsResultsResults

�For multi-processing results click on the desired series name and use the option matrix view. On the right-hand side (vertical position) you can use all the option tabs: main, calendar, outliers…….

4/19/2016 J.MURO

ResultsResultsResultsResults

4/19/2016 J.MURO

Saving results to an external fileSaving results to an external fileSaving results to an external fileSaving results to an external file

�In multiple series analysis you can save your results to an external Excel file through

◦SAprocessing-j/generate output

◦Where SAprocessing-j is the name of the multiple series processing output.

4/19/2016 J.MURO

Saving results to an external fileSaving results to an external fileSaving results to an external fileSaving results to an external file

4/19/2016 J.MURO

Saving results to an external fileSaving results to an external fileSaving results to an external fileSaving results to an external file

�In this case (professional analysis) there is a built-in procedure to save your results to a specific file whose name (and path) is in Folder option.

4/19/2016 J.MURO

Multiple series analysisMultiple series analysisMultiple series analysisMultiple series analysis

�All other facilities for multiple processing are fairly similar to the single series analysis.

4/19/2016 J.MURO

OutliersOutliersOutliersOutliers

�A final words on outliers detection.

4/19/2016 J.MURO

OutliersOutliersOutliersOutliers

�Modelling outliers is made by introducing a set of dummy regressors defined in a suitable way so as to capture this kind of abrupt changes in the series.

4/19/2016 J.MURO

Outliers definition (Outliers definition (Outliers definition (Outliers definition (TRAMOTRAMOTRAMOTRAMO----SEATS)SEATS)SEATS)SEATS)

4/19/2016 J.MURO

ReferencesReferencesReferencesReferencesN. A. KOÇAK (2010). An Analysis of German Industrial Production with DEMETRA+.

Demetra+ User Manual November 2012.

DURBIN J. and S.J. KOOPMAN (2001): Time Series Analysis by State Space Methods. Oxford University Press.

GOMEZ V. and A. MARAVALL (1994): "Estimation, Prediction, and Interpolation for Nonstationary Series With the Kalman Filter", Journal of the American Statistical Association, 89 (426), 611-624.

HARVEY, A.C. (1989): Forecasting, Structural Time Series Models and the KalmanFilter. Cambridge University Press.

LJUNG, G. M. and G. E. P. BOX (1979): "The likelihood function of stationary autoregressive-moving average models". Biometrika, 66, 265–270.

OTTO, M. C., W. R. BELL, and J. P. BURMAN (1987): "An iterative GLS approach to maximum likelihood estimation of regression models with ARIMA errors". Proceedings of the American Statistical Association, Business and Economic. Statistics Section, 632–637.

4/19/2016 J.MURO