I'm trying to forecast using ARIMAX with two exogenous (input) variables. I'm using PROC ARIMA, but I can't figure out from the SAS documentation whether my code is producing the parameterization I want.

I want to extend an ARI(12,1) model so that it also includes the last 12 terms of each of the two exogenous variables in my forecast. So, using VariableX with the two exogenous variables VariableY and VariableZ, my best attempt at the code is:

proc arima;
  identify var=VariableY(1) nlag=24;
  estimate p=12;
  identify var=VariableZ(1) nlag=24;
  estimate p=12;
  identify var=VariableX(1) nlag=24 crosscorr=( VariableY(1) VariableZ(1) );
  estimate p=12 input=( VariableY VariableZ );
  forecast id=MonthNumber interval=month alpha=.05 lead=24;

The documentation leads me to believe the first four lines of the procedure are required for setting up the forecast at the end. But when I run the procedure, the output appears to show a forecast using only the last term of each of the two exogenous variables.

In summary, I'd like to be sure where each of the following are controlled:

  • The $p$ of $AR(p)$, and similarly for each of the exogenous variables
  • The $d$ of $I(d)$, and similarly for each of the exogenous variables
  • The $q$ of $MA(q)$, and similarly for each of the exogenous variables
  • $\begingroup$ This is a continuation of a problem I asked a question about; which question is, "What is the term for a time series regression having more than one predictor?" $\endgroup$ May 10 '11 at 17:09
  • $\begingroup$ if you want to post the SAS output or email it to me I might be able to decipher the output to discover what exactly they are doing with your specification. $\endgroup$
    – IrishStat
    May 10 '11 at 18:03
  • $\begingroup$ In a comment I've since removed, I had provided the output as IrishStat requested, in hopes it could help him answer my question. However, this resulted in attention to the specific application of the question instead of the question itself. Also, the pastebin postings have since expired. These two reasons are why I have removed the comment. $\endgroup$ Jun 2 '11 at 21:36

Specifying the Input Variables' ARIMA Models

The ARIMA Procedure uses the results of the first pair(s) of identify and estimate statements (i.e., the identify and estimate statements for the input variables) to create models to forecast the values of the input variable(s) (also called exogenous variable(s)) after the last point in time that each of those input variables are observed. In other words, those statements specify the models that are used whenever values for the input variables are needed for periods not yet observed.

Thus, the model for VariableY is specified as

identify var=VariableY(PeriodsOfDifferencing);
estimate p=OrderOfAutoregression q=OrderOfMovingAverage;

where VariableY is modeled as $ARIMA(p,d,q)$ with $p$ = OrderOfAutoregression, $d$ = the order of differencing (determined from PeriodsOfDifferencing), and $q$ = OrderOfMovingAverage.

Specifying Differencing for the Main and Input Series in the ARIMAX Model

The order(s) of differencing to apply to the input variables are specified in the crosscorr option; for modeling VariableX with inputs VariableY and VariableZ, the SAS code is:

identify var=VariableX(DifferencingX) crosscorr=( VariableY(DifferencingY) VariableZ(DifferencingZ) );

where DifferencingX, DifferencingY, and DifferencingZ are the period(s) of differencing for VariableX, VariableY, and VariableZ, respectively.

Specifying the Order of Autoregression and the Order of Moving Average for the Main and Input Series in the ARIMAX Model

The number of input variable lags to include in the model is specified in the transfer function (in the input option). The beginning of the estimate line sets the orders of autoregression and moving average for the main series (i.e., the series for which a model or forecasts are ultimately being sought):

estimate p=AutoregressionX q=MovingAverageX

where VariableX is modeled as $ARIMAX(p,d,q,b)$ with $p$ = AutoregressionX and $q$ = MovingAverageX.

The input option in the same estimate statement sets the orders of autoregression and moving average for the ARIMAX model. The numerator factors for a transfer function for an input series are like the MA part of the ARMA model for the noise series. The denominator factors for a transfer function for an input series are like the AR part of the ARMA model for the noise series. (All examples below will simplify the example down to a single input series VariableY instead of showing both VariableY and VariableZ.)

When specified without any numerator or denominator terms, the input variable is treated as a pure regression term (i.e., the value of the input variable in the current period is used without any lags, whether it is forecast by the input variable's ARIMA model or already present as an observed value in the input series): estimate...input=( VariableY );.

Numerator terms are represented in parentheses before the input variable. estimate...input=( (1 2 3) VariableY ); produces a regression on VariableY, LAG(VariableY), LAG2(VariableY), and LAG3(VariableY).

Denominator terms are represented in parenetheses after a slash and before the input variable. estimate...input=( \ (1) VariableY ); estimates the effect of VariableY as an infinite distributed lag model with exponentially declining weights.

Initial shift is represented before a dollar sign; estimate...input=( k $ ( $\omega$-lags ) / ( $\delta$-lags ) VariableY ); represents the form $B^k \cdot \left(\frac{\omega (B)}{\delta (B)}\right) \cdot \text{VariableY}_t$. The value of k will be added to the exponent of $B$ for all numerator and denominator terms. To use an AR-like shift in the input variable without including the un-shifted (i.e., un-lagged or pure regression) term, use this operator instead of numerator terms in parentheses. For example, to set a 6, 12, and 18 month shift in the input series VariableY without the un-shifted term, the statement would be estimate...input=( 6 $ (6 12) VariableY ); (this results in shifts of 6, 6 + 6 (i.e., 12), and 6 + 12 (i.e., 18)).


The first pair(s) of identify and estimate statements are used to prepare any necessary forecasted values for the input variable(s).

The last pair of identify and estimate statements run the actual ARIMAX model, and use forecasted values for the input variable(s) (generated from the first pair(s) of identify and estimate statements) when necessary.

The relationship between the main variable and the input variable(s) is specified in the crosscorr option of the identify statement and the input option of the estimate statement. The relationship between the main variable and the input variable(s) can be defined as a run-of-the-mill regression relationship; or it can be defined with differencing, AR term(s), and/or MA term(s).


Although this answer is my own, I was able to come up with the answer based on substantial help (and some quotations) from the official SAS documentation ("The ARIMA Procedure: Rational Transfer Functions and Distributed Lag Models", "The ARIMA Procedure: Specifying Inputs and Transfer Functions", "The ARIMA Procedure: Input Variables and Regression with ARMA Errors", and "The ARIMA Procedure: Differencing"), and from direction found in this answer and comments by IrishStat.

  • $\begingroup$ Since you can't vote your answer as the "answer" , why don't you vote my "answer/comments" as the selected "answer" since they were the most help to you $\endgroup$
    – IrishStat
    Jun 3 '11 at 0:00
  • $\begingroup$ ok I will vote for you $\endgroup$
    – IrishStat
    Jun 3 '11 at 0:59

I have reviewed the output and the forecast refelects an AR(12) in the error term which translates to a 12 period weighted forecast using the last 12 values of both your predictor series as the AR polynomial acts a multiplier across all series ( X,Y,Z ). Without getting into it in great detail , your model specification or rather lack of specification is in my opinion "found wanting". Unfortunately the SAS procedure assumes that the differencing operators required to make the original series stationary is the same as the differencing operators in the Transfer Function. Furthermore the ARIMA component in the Transfer Function is the same as the ARIMA component for the Univariate Analysis of the dependent series. This structure should be identified form the residuals of a suitably formed Transfer Function that does not have an ARIMA structure. Finally your specification ( by default ) of the ARIMA component in the Transfer Function is a "common factor". What you need to do is to identify the forms of differencing ( if any ) for all three series and the nature of the response (PDL/ADL/LAG STRUCTURE) for EACH of the two inputs. After estimating such a tentative model verify that there are no Level Shifts/Local Time Trends/Seasonal or 1 time Pulses in the tentative set of model errors via Interevention Detection schemes. Furthermore one must ensure the model errors have constant variance and that the parameters of the model haven't proved to have changed over time and that the acf of the model errors is free of any significant structure AND that these errors are uncorrelated with either of the two pre-whitened input series.

In summary you are getting what you want but you might not want what you are getting !You might consider posting the original data for the three series and have the list members ( including myself ) aid you in constructing a minimally sufficient model.

EDIT: I found some material on the web that might be of help to you.

For illustration, say the non-zero lags are 2 and 4. The process y might be estimated as follows using an x as an input.

estimate input=( 2$(2) x )

The input is of the form cB*2+ dB*4 = B*2( c + dB*2). It is this latter form that gives the form of the input statement

  • $\begingroup$ Thank you! Your answer is very helpful for solving my overall problem. However, my question isn't fully answered; I'm seeking to learn where the p, d, and q values of ARIMA(p, d, q) are controlled for the dependent and input variables. If I'm interpreting your answer right, the AR component is set for all three variables at once by the p=12 portion of the estimate statement. Also, it appears that you are saying that the I component has been assumed to be the same for all three variables (but you haven't said where this is set). $\endgroup$ May 12 '11 at 18:47
  • $\begingroup$ I'm confused when you say that the SAS procedure assumes the differencing operators are the same for the transfer function and the original series. I'm not sure, but my best guess from reading the SAS documentation is that the differencing operators are set by changing the value in each instance of (1) in identify var=VariableX(1) nlag=24 crosscorr=( VariableY(1) VariableZ(1) );. Is that not the case? $\endgroup$ May 12 '11 at 18:52
  • $\begingroup$ @Firefeather It appears to me that the default is to use a Numerator Polynomial with 1 coefficient and with no delay. Since I am not a SAS expert but am reasonably comfortable with time series input and output I can't precisely tell you where to specify that explicitely. $\endgroup$
    – IrishStat
    May 12 '11 at 19:33
  • 1
    $\begingroup$ @IrishStat Unfortunately, the data is not mine to post, and I have several other (similar) datasets to do this type of forecasting with. I appreciate the offer for posting the data for help in analysis, but I can't accept. Thank you, though. $\endgroup$ May 17 '11 at 18:18
  • 2
    $\begingroup$ @IrishStat It may help to know the downvote was not mine. I'm sorry the reason was not explained. As for me, I'm coming closer to an answer through your help and some face-to-face discussion with a colleague. Thank you for the update you added to the answer: that is quite helpful. I've also found issues in the model that I know how to fix, so I'm working on that. $\endgroup$ May 17 '11 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.