Previous Page | Next Page

The HPFARIMASPEC Procedure

Example 3.2 How to Include ARIMA Models in a Model Selection List

One of the primary uses of the HPFARIMASPEC procedure is to add candidate ARIMA models to a model selection list that can be used by the HPFENGINE procedure (see Chapter 5, The HPFENGINE Procedure ). The HPFARIMASPEC procedure is used to create the ARIMA model specifications, and the HPFSELECT procedure is used to add the specifications to a model selection list (see Chapter 11, The HPFSELECT Procedure ). This example illustrates this scenario.

Here the Gas Furnace Data, "Series J" from Box and Jenkins (1976), is used. This data set contains two series, Input Gas Rate and Output CO2. The goal is to forecast the output CO2, using the input Gas Rate as a predictor if necessary.

The following DATA step statements read the data in a SAS data set.

      data seriesj;
         input GasRate CO2 @@;
         date = intnx( 'day', '01jan1950'd, _n_-1 );
         format date DATE.;
      datalines;
      -0.109  53.8  0.000  53.6  0.178  53.5  0.339  53.5
       0.373  53.4  0.441  53.1  0.461  52.7  0.348  52.4
   
   ... more lines ...   

Three candidate models are specified, m1, m2, and m3. Out of these three models, m1 is known to be a good fit to the data. It is a transfer function model that involves the input Gas Rate. The other two models are simplified versions of m1. The following syntax shows how to specify these models and how to create a selection list that combines them by using the HPFSELECT procedure. In the HPFSELECT procedure note the use of the INPUTMAP option in the SPEC statement. It ties the symbolic variable names used in the HPFARIMASPEC procedure with the actual variable names in the data set. If the symbolic names were appropriate to start with, then the INPUTMAP option is not necessary.

   * make spec1;
   proc hpfarimaspec repository=work.mycat
                     name=m1;
      forecast symbol=y p=2;
      input symbol=x delay=3 num=(1,2) den=1;
      estimate method=ml;
   run;
   
   * make spec2;
   proc hpfarimaspec repository=work.mycat name=m2;
      forecast symbol=y p=2;
      input symbol=x delay=3;
      estimate method=ml;
   run;
   
   * make spec3;
   proc hpfarimaspec repository=work.mycat
                     name=m3;
      forecast symbol=y p=2;
      estimate method=ml;
   run;
   * make a selection list that includes m1, m2 and m3;
   proc hpfselect repository=work.mycat
                  name=myselect;
   
      spec m1 / inputmap(symbol=y var=co2)
                inputmap(symbol=x var=gasrate);
   
      spec m2 / inputmap(symbol=y var=co2)
                inputmap(symbol=x var=gasrate);
   
      spec m3 / inputmap(symbol=y var=co2);
   run;

This selection list can now be used in the HPFENGINE procedure for various types of analyses. The following syntax shows how to compare these models based on the default comparison criterion, mean absolute percentage error (MAPE). As expected, model m1 turns out to be the best of the three compared (see Figure 3.2.1).

   proc hpfengine data=seriesj
                  repository=work.mycat
                  globalselection=myselect
                  lead=0
                  print=(select);
      forecast co2;
      input    gasrate;
   run;

Output 3.2.1 Model Selection Based on the MAPE Criterion
The HPFENGINE Procedure

Model Selection Criterion = MAPE
Model Statistic Selected Label
M1 0.31478457 Yes ARIMA: Y ~ P = 2 + INPUT: Lag(3) X NUM = 2 DEN = 1
M2 0.50671996 No ARIMA: Y ~ P = 2 + INPUT: Lag(3) X
M3 0.53295590 No ARIMA: Y ~ P = 2

Previous Page | Next Page | Top of Page