BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
sasalex2024
Fluorite | Level 6

Hi All,

 

I have a question about obtaining a sample autocorrelation function (SACF) for the noise part of the regression with ARMA errors. There is an example in SAS documentation of a regression with input series with ARMA model for the errors, where the error follows an ARMA(1,1) process:

 

proc arima data=a;
identify var=sales crosscorr=(price income);
estimate p=1 q=1 input=(price income);
run;

After the above code is run, it produces the estimates for the constant, and price and income coefficients. If we ignore the entire noise part (the ARMA(1,1) process), and want to compute Nt as "sales - constant - coeff1*price - coeff2*income", so that to build a SACF of the generated Nt series, can you please tell how this can be done? Or, perhaps there is an easier way to do it? I've read about the "plot" option, but that one produces ACF for the residuals obtained before the full regression with ARMA disturbance is run. Thank you very much.  

1 ACCEPTED SOLUTION

Accepted Solutions
SASCom1
SAS Employee

Hello @sasalex2024 

I assume the example you are looking at is from this section of the PROC ARIMA documentation:

SAS Help Center: Input Variables and Regression with ARMA Errors

 

which illustrates the steps usually taken to identify a regression model with ARMA errors. You usually first run the regression with inputs but without ARMA specification:

proc arima data=a;

   identify var=sales crosscorr=(price income) noprint;

   estimate input=(price income) plot;

run;

 

You obtain the ACF, PACF, IACF plots for the residuals in this regression model, i.e., y - mu - beta*input, which help you identify proper ARMA specifications. If you decide an ARMA(1,1) process, then you can specify the regression with ARMA error by:

 

estimate p=1 q=1 input=(price income);

run;

 

The ACF, PACF, IACF plots for the residuals in this second step with ARMA specifications are the residuals obtained in the model with ARMA error already taken into account, i.e., residual = actual - forecast, where the ARMA parameters played a role in computing the forecast, so the ACF, PACF, IACF plots in this step will give you indication of whether the ARMA process are properly specified. In this second step, ACF, PACF, and IACF plots for y-mu - beta*input are usually not of interest, since you already get the ACF plots of the residuals in the simple regression model in step one and know that the residuals from the simple regression model show some ARMA patterns and is not white noise. 

 

If by saying "If we ignore the entire noise part (the ARMA(1,1) process), and want to compute Nt as "sales - constant - coeff1*price - coeff2*income", so that to build a SACF of the generated Nt series, can you please tell how this can be done? Or, perhaps there is an easier way to do it? I've read about the "plot" option, but that one produces ACF for the residuals obtained before the full regression with ARMA disturbance is run.",  you mean that although you have already identified an ARMA(1,1) process in the first step regression residual ACF plots, and have estimated the model with ARMA specification in the second step, but you still wanted to get ACF's of y - mu - beta*x only, but using the estimates of mu and beta's in the second step estimation(the model with ARMA specification), rather than ACF's of y - mu - beta*x using parameters in the first step regression model, if that is indeed what you intended to obtain, then you may do that by using OUTEST = option in the ESTIMATE statement to save the parameters estimates for mu and beta obtained in the second step ARMA model estimation, then run a subsequent PROC ARIMA step of a simple regression model(without ARMA specification) but by specifying initial values for mu and beta's to be equal to the saved parameter estimates from the second step(ARMA model), with INITVAL=(initializer-spec variable …) option and MU = option, together with NOEST option in the ESTIMATE statement

 

SAS Help Center: ESTIMATE Statement

 

so that the final estimates for both mu and beta's are fixed at the initial values supplied.

 

For example, suppose in your second step ARMA model estimation, estimated mu = 1, parameter estimate for price = 2, parameter estimate for income = 3, then you can specify a subsequent PROC ARIMA step to specify a simple regression model only, and fix the mu and price, income variable parameters as:

 

 

proc arima data=a;
identify var=sales crosscorr=(price income);
estimate input=(price income) mu = 1 initval = (2 price 3 income) noest ;
run;

 

then the ACF, PACF, IACF's produced in the above step are obtained for residual = y - mu - beta*input, while the mu and beta's are fixed at the parameters values obtained from the previous step regression with ARMA error specification.

 

I hope this helps. If I misunderstood what you intended to get, then please clarify what you want and I will further look into it.

 

Thanks,

 

Wen

View solution in original post

3 REPLIES 3
SASCom1
SAS Employee

Hello @sasalex2024 

I assume the example you are looking at is from this section of the PROC ARIMA documentation:

SAS Help Center: Input Variables and Regression with ARMA Errors

 

which illustrates the steps usually taken to identify a regression model with ARMA errors. You usually first run the regression with inputs but without ARMA specification:

proc arima data=a;

   identify var=sales crosscorr=(price income) noprint;

   estimate input=(price income) plot;

run;

 

You obtain the ACF, PACF, IACF plots for the residuals in this regression model, i.e., y - mu - beta*input, which help you identify proper ARMA specifications. If you decide an ARMA(1,1) process, then you can specify the regression with ARMA error by:

 

estimate p=1 q=1 input=(price income);

run;

 

The ACF, PACF, IACF plots for the residuals in this second step with ARMA specifications are the residuals obtained in the model with ARMA error already taken into account, i.e., residual = actual - forecast, where the ARMA parameters played a role in computing the forecast, so the ACF, PACF, IACF plots in this step will give you indication of whether the ARMA process are properly specified. In this second step, ACF, PACF, and IACF plots for y-mu - beta*input are usually not of interest, since you already get the ACF plots of the residuals in the simple regression model in step one and know that the residuals from the simple regression model show some ARMA patterns and is not white noise. 

 

If by saying "If we ignore the entire noise part (the ARMA(1,1) process), and want to compute Nt as "sales - constant - coeff1*price - coeff2*income", so that to build a SACF of the generated Nt series, can you please tell how this can be done? Or, perhaps there is an easier way to do it? I've read about the "plot" option, but that one produces ACF for the residuals obtained before the full regression with ARMA disturbance is run.",  you mean that although you have already identified an ARMA(1,1) process in the first step regression residual ACF plots, and have estimated the model with ARMA specification in the second step, but you still wanted to get ACF's of y - mu - beta*x only, but using the estimates of mu and beta's in the second step estimation(the model with ARMA specification), rather than ACF's of y - mu - beta*x using parameters in the first step regression model, if that is indeed what you intended to obtain, then you may do that by using OUTEST = option in the ESTIMATE statement to save the parameters estimates for mu and beta obtained in the second step ARMA model estimation, then run a subsequent PROC ARIMA step of a simple regression model(without ARMA specification) but by specifying initial values for mu and beta's to be equal to the saved parameter estimates from the second step(ARMA model), with INITVAL=(initializer-spec variable …) option and MU = option, together with NOEST option in the ESTIMATE statement

 

SAS Help Center: ESTIMATE Statement

 

so that the final estimates for both mu and beta's are fixed at the initial values supplied.

 

For example, suppose in your second step ARMA model estimation, estimated mu = 1, parameter estimate for price = 2, parameter estimate for income = 3, then you can specify a subsequent PROC ARIMA step to specify a simple regression model only, and fix the mu and price, income variable parameters as:

 

 

proc arima data=a;
identify var=sales crosscorr=(price income);
estimate input=(price income) mu = 1 initval = (2 price 3 income) noest ;
run;

 

then the ACF, PACF, IACF's produced in the above step are obtained for residual = y - mu - beta*input, while the mu and beta's are fixed at the parameters values obtained from the previous step regression with ARMA error specification.

 

I hope this helps. If I misunderstood what you intended to get, then please clarify what you want and I will further look into it.

 

Thanks,

 

Wen

sasalex2024
Fluorite | Level 6

Dear Wen,

Thank you very much for your detailed and helpful reply. Yes, you understood my question correctly, and I appreciate your hints. I was able to write a code (though probably not very efficient as I am not good at coding) that accomplishes the estimation of the entire noise part and involves saving the parameter estimates. Unfortunately, it is convoluted because in my other work, the right-hand side of the model includes more than a dozen lagged values of X, resulting in many estimates to track. My approach is similar to yours, but I had to use some form of loop to extract these parameters.

I was hoping that SAS has an inbuilt procedure to simplify this process. For instance, STATA does this with the following command: "arima Yt L(0/15) Xt, ar(1)" — this command regresses Yt on Xt and 15 additional lagged values of Xt, assuming the noise term (Nt) follows an ar(1) process. (any seasonal and non-seasonal model can be specified instead of ar(1)). The subsequent command, "predict Nthat, residuals structural," estimates Ythat minus the estimated right-hand side without the noise part (i.e., which we referred to as "sales - constant - coeff1*price - coeff2*income"). If one wishes to estimate only the Gaussian error term, they simply remove the word "structural" and type: "predict Nthat, residuals".

This automation led me to believe SAS might have a similar functionality, but it seems I'll need to follow your method instead.

Many thanks again.

SASCom1
SAS Employee

Hi @sasalex2024 ,

You are welcome. If you do not have MA terms, only have AR terms, i.e., a regression with AR errors, then you can also use PROC AUTOREG to fit regression with AR errors, which provides PM = option to output structural predicted values and RM = option to output structural residuals (in addition to P = and R = option to output predicted values and residuals formed by both structural part and AR part of the model) using the OUTPUT statement:

 

SAS Help Center: OUTPUT Statement

 

then scroll down to PM = option and RM = option.

 

 

 

This example below shows syntax to specify regression with AR errors using PROC AUTOREG:

 

SAS Help Center: Regression with Autocorrelated Errors

 

PROC AUTOREG is designed for regression with AR errors, it does not support moving average specifications. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 849 views
  • 1 like
  • 2 in conversation