Skip to content

Preprocessing

Jean Palate edited this page Dec 8, 2015 · 3 revisions

Pre-processing model

In JD+, Tramo-Seats and X12-ARIMA share the same RegArima pre-processing model. The routines for producing it are different but the output has exactly the same form. It is implemented in the class PreprocessingModel of the package ec.tstoolkit.modelling.arima.

A pre-processing model consists in two main parts: the description of the model and its estimation. The class also provides numerous methods for retrieving the different regression effects, for producing forecasts/backcasts...

All information that makes up a "RegArima" model is put together in a ModelDescription object (in the package "ec.tstoolkit.modelling.arima"). Such an object contains:

  • The explained series
  • Its preliminary transformations (log, correction for the length of periods...)
  • The variables of the regression
  • The Arima model that describes the residuals (structure and - if available - parameters) (Box-Jenkins seasonal Arima model, described in ec.tstoolkit.sarima.SarimaModel)

The main task of that object is to generate the low-level data of the RegArima model (ec.tstoolkit.arima.estimation.RegArimaModel) for estimation.

The estimated model takes the form of a ModelEstimation object. That object contains the actual RegArima model (endogeneous data, matrix of the regression variables and estimated Arima model). It also provides the concentrated likelihood of the model, with the estimated coefficients and their covariance matrix.

It has to be noted that the model description part of the pre-processing model is necessary to interpret correctly the estimation part. The code below presents a typical use of the pre-processing model object

TsData input = Data.P;
// Using a pre-defined specification
TramoSeatsSpecification rsafull = TramoSeatsSpecification.RSAfull;
// Process
CompositeResults rslts = TramoSeatsProcessingFactory.process(input, rsafull);
// Retrieving the pre-processing model
PreprocessingModel model = rslts.get("preprocessing", PreprocessingModel.class);

// Find the Tradingdays/Leap year in the list of the used variables
TsVariableSelection<ICalendarVariable> sel = model.description.buildRegressionVariables().select(ICalendarVariable.class);   if (!sel.isEmpty()) {
    // Find the position of the variables
    int[] pos = sel.getPositions();
    // Create a joint F-test at the 1% level
    JointRegressionTest test = new JointRegressionTest(.01);
    // Test, using the concentrated likelihhod and correcting for the number of parameters of the model
    if (test.accept(model.estimation.getLikelihood(), model.description.getArimaComponent().getFreeParametersCount(), pos, null))
         System.out.println(test.getTest().getPValue());
}

// Also...
TsData forecasts = model.forecast(60, false);
TsData backcasts = model.backcast(60, false);
Clone this wiki locally