When you estimate the model for the input series and save the parameters, you do not take extra step to center the input series. The model is estimated exactly as what is specified ; The estimated ARMA parameters are those used in the prewhitening filter later. You save the ARMA parameter estimates from this step, not the residuals.
Centering is done only when the prewhitening filter is applied to the response and to the input, i.e., the prewhitening filter is applied to the centered response series and centered input series(or centered differenced series if differencing order is specified). You obtain residuals after applying the prewhiteneing filter to both the centered response and centered input.
To avoid confusions in the text, I will use this following example in the documentation to illustrate the steps to recompute cross correlations with prewhitening in PROC ARIMA. Note that the example specifies no differencing for either y or x in any of the statements, but if differencing orders are specified, the prewhitening steps are the same except the series need to be differenced before applying the prewhitening filter(you can create the differenced series and then treat the differenced series the same way as in the no differencing case).
SAS Help Center: Model for Series J Data from Box and Jenkins
The relevant code used in PROC ARIMA documentation example are the following:
proc arima data=seriesj;
/*--- Look at the input process ----------------------------*/
identify var=x;
/*--- Fit a model for the input ----------------------------*/
estimate p=3 plot;
/*--- Cross-correlation of prewhitened series ---------------*/
identify var=y crosscorr=(x) nlag=12;
run;
(1). When PROC ARIMA process the first IDENTIFY statement and ESTIMATE statement for the input x, the AR(3) model is fit to the x series directly. This is a standard IDENTIFY-ESTIMATE statement processing. The estimated parameters from this model will be used in the prewhitening filter later, the prewhitening filter used is shown in output 8.3.5:
Output 8.3.5: Prewhitening Filter
Autoregressive Factors
Factor 1:
1 - 1.97607 B**(1) + 1.37499 B**(2) - 0.34336 B**(3)
So to reproduce the above step, you just specify the same IDENTIFY and ESTIMATE statement as above, and use OUTEST = option in the ESTIMATE statement to save the estimated AR parameters.
(2). Then in the next IDENTIFY statement, to compute the cross correlations, the series will be prewhitened using the prewhitening filter above. But before applying the filter, the series y and x will be centered, i.e., centered y = y - mean(y), and centered x = x - mean(x). Then the above prewhitening AR filter is applied to centered y and centered x, and resulting prewhitened series-- residuals are obtained.
To reproduce the above steps results yourself, you can fit AR(3) model with NOCONSTANT option to the centered y and centered x, but fix the AR parameters at the estimated AR parameters above using AR = option and NOEST option in the ESTIMATE statement, i.e., say you have created the centered x as cx, and centered y as cy in the data set,
proc arima data = ;
identify var = cx ;
estimate p=3 noconstant ar = 1.97607 -1.37499 0.34336 noest ;
then use FORECAST statement to save the residuals(prewhitened x):
forecast out = outx(keep =x residual) lead = 0 ;
Do the same to the centered y, and save residuals(prewhitened y) into data set.
Now you have prewhitened y and prewhitened x, i.e., the two residual series saved above.
Then finally the cross correlations are computed using the resulting two prewhitened series. You can use the following step with IDENTIFY statement:
proc arima ;
identify var=residualy crosscorr=residualx ;
The cross correlations from the above step would be the same as those obtained in the PROC ARIMA steps in the documentation example.
*Note: In the case you specify differencing for x and y, for example, if you specify the following instead:
proc arima data=;
identify var=x(1); estimate p = 3;
identify var=y(12) crosscorr=(x(1)) ;
then the only change you need to make in the above reproducing steps is, instead of creating the centered x and centered y shown above, you first create the difx = x(1), and dif12y =y(12), then center the difx and dif12y to obtain the two centered differenced series. All other steps follow the same logic as in the above example.
I hope this helps. Please let me know if you have further questions.
... View more