1. Demetra+ General presentation Demetra+ is a familiy of modules on seasonal adjustment, which are based on the two leading algorithms in that domain (TramoSeats / X12-X13). Those modules provide a number of peripheral and/or alternative services around the core engines. We consider briefly some of the key facets of the new software. Connection with the core engines The current version of Demetra+ uses the following Core engines: TramoSeats dlls, dated 8/2009 X12 dll, used in Demetra 2.2 The original code was changed as little as possible (without effect on the final results) For TramoSeats, the core engine was not modified at all; however, the C++ interface was completely rewritten, to fit better the .NET framework. For X12, the Demetra 2.2 dll was changed as follows: all the code for writing results in files (containing the "WRITE" instruction) was put in comment ("Cnbb" comment, to identify it easily). Code related to Demetra log file was removed (by means of pre-processor instructions); a few calls of the exporting functions built for Demetra ("TODEMETRAx", "LSDEMETRA") were added. All the Fortran dlls were recompiled with a newer Fortran compiler (Intel Fortran 10.0.25), which generates faster code. It should be noted that "fast code options" were used each time it was possible. The most important results (including the complete RegArima model) directly come from the core engines. All the diagnostics are computed outside the core engines (see below). Common analysis/presentation tools One of the strategic choices of Demetra+ is to provide common presentation/analysis tools for both algorithms. So, the results can be more easily compared. This implies that many diagnostics, statistics, auxiliary results... are computed outside the core engines. Demetra+ is of course highly influenced by the output of TramoSeats and of X12. Most analyses presented in Demetra+ are Document1 2. available in the core engines. However, the results may slightly differ for a lot of reasons (different statistical/algorithmic choices, possible bugs...). In any case the global messages on a seasonal adjustment are (nearly) always similar. Amongst the most important tools implemented in Demetra+, we must point out: Likelihood (X12-like) / RegArima model (T-stat as in Tramo): RegArima model was recomputed in Demetra+ (X12, Tramo and "Stamp-like" solutions available in the framework) Residuals analysis (Tramo-like, but based on another set of diagnostics Seasonality tests (X12-like) Spectral analysis (X12 definition), periodogram Sliding spans (X12) Revision history Wiener-Kolmogorov analysis (Seats-like) Benchmarking (new implementation, not yet in the graphical interface) Such a solution should lead to a more flexible solution: common tools could be added without modifying the core engines; they could be used to other methods (generalized airline models, structural models...) or to other problems. Family of applications Demetra+ should be considered more as a family of software based on a common framework than as a unique final application. The first official release of Demetra+ will contain the following applications: Demetra+ itself: main graphical interface SACruncher: console application for the processing of many series (quasi no limit) Excel add-ins o User-defined functions o Light Demetra, completely integrated in Excel API One of the key features of Demetra+ is the possibility to use the underlying algorithms through a rich application programming interface (API). This feature allows the integration of the routines in very different contexts as well as the making of new applications. The most important concepts (time series, seasonal adjustment...) developed to encapsulate the core engines are common to both algorithms; moreover, they can be used for other implementation of seasonal adjustment or even for solving other problems (benchmarking...) Document1 3. The code for making basic seasonal adjustment is straightforward. However, it is possible to use the API to solve very tricky problems. A minimalist example is provided in the appendix 1. Peripheral topics Amongst the peripheral services offered by Demetra+, we would like to stress the following ones: Dynamic access to various "time series providers": Demetra+ provides modules to handle time series coming from different sources: Excel, databases (through ODBC), WEB services, files (text, TSW, USCB, xml...); the access is dynamic in the sense that time series are automatically "refreshed" by the software, which consults the providers to download new information. The model allows asynchronous treatment. Common xml formatting: the seasonal adjustment processing can be saved in xml files, which could be used to generate, for instance, WEB services around seasonal adjustment. Open solution The software was designed to allow the adding of new modules without modifying the core application. The main features that can be enriched are listed below: Time series providers: external teams could add their own modules to download series coming from other databases... Diagnostics on seasonal adjustment Output of SA processing As mentioned above, the API could be used to generate completely independent applications, but also to create more easily extensions to the current application. Document1 4. Appendix 1 Code to generate simple seasonal adjustments (C#) (Some namespaces have been removed to simplify the reading) // creates a new time series // parameters: frequency/first year/first period (0-based)/array of doubles/copy data (uses the current array or creates a copy) TSData s = new TSData(12, 1967, 0, g_prodind, false); // basic processing // tramo-seats specification. RSA5 (full automatic) TramoSeats.Specification ts_spec = TramoSeats.Specification.RSA5; // launches tramo-seats core engine TramoSeats.Monitor ts_monitor=new TramoSeats.Monitor(); // executes the processing TramoSeats.TramoSeatsResults ts_rslts = ts_monitor.Process(s, ts_spec); // x12 specification. equivalent RSA5 (full automatic) X12.Specification x_spec = X12.Specification.RSA5; // launches tramo-seats core engine X12.Monitor x_monitor=new X12.Monitor(); // executes the processing X12.X12Results x_rslts = x_monitor.Process(s, x_spec); // seasonally adjusted series TSData ts_sa = ts_rslts.Series(SAComponentType.CSA); TSData x_sa = x_rslts.Series(SAComponentType.CSA); // computes diffrences between both results... TSData diff = ts_sa - x_sa; // computes statistics on the differences... DescriptiveStatistics stats = new DescriptiveStatistics(diff.Values); double max = stats.Max, min = stats.Min, rmse = Math.Sqrt(stats.SumSquare / diff.Length); // more advanced uses (computed "on the fly") Periodogram periodogram = new Periodogram(x_rslts.X11Results.DTables["D8"] .Values); // roots of the moving average polynomial of the arima model used by Seats Complex[] roots = ts_rslts.Seats.SArima.MA.Roots(); // and so on... Document1