Thursday, August 1, 2024

Seasonal Adjustment in EViews 14 – Comparing X-13 and JDemetra+

Seasonal Adjustment is a mainstay of modern macro-economic analysis. Many economic time series exhibit seasonal fluctuations that need to be removed from the underlying patterns of the data before econometric analysis can be performed. In this two-part series we'll use EViews 14 to compare JDemetra+ to X13 in Part 1 and look at how to use JDemetra+ with the Lunar New Year in Part 2.

Table of Contents

  1. Introduction
  2. JDemetra+: X-11
  3. JDemetra+: RSA3
  4. Concluding Remarks
  5. Files

Introduction

EViews has always provided access to a number of seasonal adjustment routines, including the popular X-11, X-12 and X-13 routines from the US Census, and the TRAMO/SEATS routines. JDemetra+ is an open source alternative to these packages that is provided by Eurostat.

Although JDemetra+ can perform both X-13 style and TRAMO/SEATS style seasonal adjustment, currently EViews only support its X-13 style adjustment. Let us know if you’d like us to expand to TRAMO/SEATS too!



JDemetra+: X-11

The calculations performed by JDemetra are nearly identical to those provided by the existing X-13 interface in EViews, but are more robust to mis-specified data, and introduce a considerable speed boost, particularly when analyzing multiple series. In this first blog post, we’ll demonstrate how to use JDemetra, and show how the results are near identical to the existing X-13 package.

We have a workfile with monthly housing starts data between 1990 and 2023. There is a single series, HOUSTNSA, which is the non-seasonally adjusted data, fetched from FRED.


Figure 1: Housing starts workfile

Opening the series as a graph, we can see there are strong seasonal patterns:


Figure 2: Housing starts series

We can adjust these data to remove the seasonal patterns using JDemetra+ by clicking on Proc->Seasonal Adjustment->JDemetra+, which will then bring up the JDemetra+ dialog:


Figure 3: JDemetra+ X-11 Dialog

JDemetra+ has built-in specifications that allow you to quickly specify a type of model to use, without having to set lots of different options. These built-in specifications are accessed via the X-13 spec: dropdown.

The most basic form of adjustment is the simple X-11 spec:


Figure 4: X-11 dropdown

This method decomposes the original series into Trend, Seasonal and remainder components via an iterative moving averages procedure, without doing any pre-adjustment of the data through ARIMAX regression.

Clicking OK on the dialog, having set that specification, produces the output:


Figure 5: JDemetra+ X-11 Output

The last panel of the chart shows the seasonally adjusted data produced by JDemetra+, which has also been added to our workfile as a new series called HOUSTNSA_D11 (D11 is an old US Census code for the seasonally adjusted values). We can see the adjusted series is much smoother without the pronounced seasonal patterns.

This basic form of X-11 seasonal adjustment is the default form of adjustment performed by the X-13 interface in EViews. We can obtain the same results by clicking on Proc->Seasonal Adjustment->Census X-13, and then clicking OK to produce the default results. (Note that X-13 will also produce an output called HOUSTNSA_D11 – so be careful to rename your previous JDemetra output series first!).

Opening the series produced by JDemetra+ and by X-13 together as a group, we can see they are numerically identical.


Figure 6: JDemetra+ X-11 Comparison

This video shows the steps we have taken so far:


Video 1: JDemetra+ X-11 Workflow


JDemetra+: RSA3

Instead of the basic X-11 adjustment, researchers often prefer to perform a more sophisticated seasonal adjustment that involves running an ARIMAX model on the data, with calendar based exogenous regressors, prior to performing the trend, season, remainder decomposition.

These pre-adjustment routines are useful for removing non-cyclical irregularities and patterns (such as non-static holidays, differences in the number of days per month/quarter, or exponential trends) prior to performing the seasonal adjustment. Without this step the seasonal adjustment routine may produce less accurate results.

In JDemetra+ the RSA3 default specification performs this type of routine. Specifically, it automatically detects whether to log the underlying data, performs outlier detection, and includes an automatic ARIMA model. Note it does not perform calendar effects (the RSA4c specification adds these – see our second blog post for more details).

We can compute this form of seasonal adjustment by simply using the JDemetra+ specification dropdown to select RSA3:


Figure 7: JDemetra+ RSA3 Dialog

The output of this adjustment looks very similar to the previous X11 adjustment:


Figure 8: JDemetra+ RSA3 Output

Comparing the output series with that of the previous adjustment, we can see that they are nearly identical, but the RSA3 version has reduced some of the peaks:


Figure 9: X-11 vs RSA3 Adjusted Series (zoomed in to the early 2000s)

We can perform this style of adjustment using the X-13 interface by setting some options on the X-13 dialog, namely changing the Transform to Auto/None, selecting Additive, Level Shift and Temporary Change automatic outlier detection, and changing the ARIMA model to X-11 Auto. As with the X-11 adjustment, the two packages give identical results:


Figure 10: JDemetra+ RSA3 Comparison

The following video demonstrates the RSA3 adjustment in the two packages:


Video 2: JDemetra+ RSA3 Workflow




Concluding Remarks

If you’d rather follow along via command, every thing we’ve done in this blog post can be replicated with the following EViews program:


        close @wf
        wfcreate m 1990 2023

        dbopen(type=fred)
        fetch houstnsa
        
        
                             'simple X-11 style adjustment
        'JDemetra+
        
        houstnsa.jdemetra(spec=x11)
        rename houstnsa_d11 houst_d11_x11jdm
        
        'X-13
        houstnsa.x13 
        rename houstnsa_d11 houst_d11_x11x13
        
        
        
                             'RSA3 style adjustment with ARIMA and outliers
        'JDemetra+
        
        houstnsa.jdemetra(spec=rsa3)
        rename houstnsa_d11 houst_d11_rsa3jdm
        
        'X-13
        houstnsa.x13(tf=auto, outtype="tc ao ls") @x11arima() @x11() 
        rename houstnsa_d11 houst_d11_rsa3x13        
    
Part 2 of this blog post will examine calendar effects, and using your own custom holiday variables, including those aimed at compensating for the Lunar New Year.



No comments:

Post a Comment