| The HPFDIAGNOSE Procedure |
This section outlines the use of the HPFDIAGNOSE procedure and shows examples of how to create ARIMA, ESM, and UCM model specifications.
The following example prints the diagnostic tests of an ARIMA model. In the HPFDIAGNOSE statement, the SEASONALITY=12 option specifies the length of the seasonal cycle of the time series, and the PRINT=SHORT option prints the chosen model specification. The FORECAST statement specifies the dependent variable (AIR). The ARIMAX statement specifies that an ARIMA model is to be diagnosed.
proc hpfdiagnose data=sashelp.air
seasonality=12
print=short;
forecast air;
transform;
arimax;
run;
Figure 4.1 shows the ARIMAX model specification. The log transformation test and trend test are conducted by default. The log transformation was applied to the dependent series and the seasonal ARIMA
model was selected. The default model selection criterion (RMSE) was used. The STATUS column explains warnings or errors during diagnostic tests. STATUS=OK indicates that the model was successfully diagnosed.
| ARIMA Model Specification | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Variable | Functional Transform |
Constant | p | d | q | P | D | Q | Seasonality | Model Criterion |
Statistic | Status |
| AIR | LOG | NO | 1 | 1 | 0 | 0 | 1 | 1 | 12 | RMSE | 10.8353 | OK |
The following example prints the diagnostic tests of an ESM for airline data. The ID statement INTERVAL=MONTH option specifies an implied seasonality of 12. The ESM statement specifies that an exponential smoothing model is to be diagnosed.
proc hpfdiag data=sashelp.air print=short;
id date interval=month;
forecast air;
transform;
esm;
run;
Figure 4.2 shows the ESM specification. The chosen model specification applied the log transformation and selected a multiplicative seasonal model with a trend component (WINTERS).
| Exponential Smoothing Model Specification | |||||
|---|---|---|---|---|---|
| Variable | Functional Transform |
Selected Model |
Component | Model Criterion |
Statistic |
| AIR | LOG | WINTERS | LEVEL | RMSE | 10.6521 |
| TREND | |||||
| SEASONAL | |||||
The following example prints the diagnostic tests of a UCM for airline data. The UCM statement specifies that an unobserved component model is to be diagnosed.
proc hpfdiag data=sashelp.air print=short;
id date interval=month;
forecast air;
transform;
ucm;
run;
When the column SELECTED=YES, as shown in Figure 4.3, the component is significant. When the column SELECTED=NO, the component is insignificant.
When SELECTED=YES, the STOCHASTIC column has either YES or NO. STOCHASTIC=YES indicates that a component has a statistically significant variance, indicating the component is changing over time; STOCHASTIC=NO indicates that the variance of a component is not statistically significant, but the component itself is still significant.
Figure 4.3 shows that the irregular, level, slope, and seasonal components are selected. The irregular, level, and seasonal components have statistically significant variances. The slope component is constant over the time.
| Unobserved Components Model(UCM) Specification | ||||||||
|---|---|---|---|---|---|---|---|---|
| Variable | Functional Transform |
Component | Selected | Stochastic | Seasonality | Model Criterion |
Statistic | Status |
| AIR | LOG | IRREGULAR | YES | YES | RMSE | 10.9801 | OK | |
| LEVEL | YES | YES | ||||||
| SLOPE | YES | NO | ||||||
| SEASON | YES | YES | 12 | |||||
The following example shows how to pass a model specification created by the HPFDIAGNOSE procedure to the HPFENGINE procedure.
An ARIMAX model specification file, a model selection list, and a model repository SASUSER.MYCAT are created by the HPFDIAGNOSE procedure. The ARIMAX model specification file and the model selection list are contained in the SASUSER.MYCAT repository.
The OUTEST= data set is used to transmit the diagnostic results to the HPFENGINE procedure by the INEST= option. The WORK.EST_ONE data set contains the information about the data set variable and the model selection list.
proc datasets lib=sasuser mt=catalog nolist;
delete hpfscor mycat;
run;
proc hpfdiag data=sashelp.air outest=est_one
modelrepository=sasuser.mycat criterion=MAPE;
id date interval=month;
forecast air;
transform;
arimax;
run;
proc hpfengine data=sashelp.air print=(select)
modelrepository=sasuser.mycat inest=est_one;
forecast air;
id date interval=month;
run;
Figure 4.4 shows the DIAG0 model specification created by the HPFDIAGNOSE procedure in the previous example. The model specification is labeled DIAG0 because the HPFDIAGNOSE procedure uses BASENAME=DIAG by default.
| Model Selection Criterion = MAPE | |||
|---|---|---|---|
| Model | Statistic | Selected | Label |
| diag0 | 2.9422734 | Yes | ARIMA: Log( AIR ) ~ P = 1 D = (1,12) Q = (12) NOINT |
The following example shows how the HPFDIAGNOSE and HPFENGINE procedures can be used to select a single model specification from among multiple candidate model specifications.
In this example the HPFDIAGNOSE procedure creates three model specifications and adds them to the model repository SASUSER.MYCAT created in the previous example.
proc hpfdiag data=sashelp.air outest=est_three
modelrepository=sasuser.mycat;
id date interval=month;
forecast air;
transform;
arimax;
esm;
ucm;
run;
proc hpfengine data=sashelp.air print=(select)
modelrepository=sasuser.mycat inest=est_three;
forecast air;
id date interval=month;
run;
If new model specification files are added to a model repository that already exists, then the suffixed number of the model specification file name and the model selection list file name are sequential.
This example adds three model specification files (DIAG2, DIAG3, and DIAG4) to the model repository SASUSER.MYCAT which already contains DIAG0 and DIAG1.
Figure 4.5 shows the three model specifications (DIAG2, DIAG3, DIAG4) found by the HPFDIAGNOSE procedure.
| Model Selection Criterion = RMSE | |||
|---|---|---|---|
| Model | Statistic | Selected | Label |
| diag2 | 10.835333 | No | ARIMA: Log( AIR ) ~ P = 1 D = (1,12) Q = (12) NOINT |
| diag3 | 10.652082 | Yes | Log Winters Method (Multiplicative) |
| diag4 | 10.980119 | No | UCM: Log( AIR ) = TREND + SEASON + ERROR |
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.