## SAS Proc Autoreg

Solved
Occasional Contributor
Posts: 19

# SAS Proc Autoreg

I am confused by the SAS parameter estimates using Proc Autoreg. I specified a model of the form y=x /nlag=(1); My understanding is that this is a model with an independent variable "x" and a lag of the dependent "y". But the parameter estimates are different if I used data step in SAS to compute the lag of y, for example ly=lag1(y); and then specified a model y=ly x. Is there an explanation as to why the coefficients would be different?

Accepted Solutions
Solution
‎06-28-2016 03:28 PM
SAS Super FREQ
Posts: 3,842

## Re: SAS Proc Autoreg

I don't think that your interpretation is correct.  I'm not a time series expert, but the documentation of PROC AUTOREG for the AR model seems to say that the coefficient of the AR1 term is computed from the lag of the residuals, not from the lag of the responses.

I could be wrong, but you can test my interpretation by calling PROC REG twice. First compute the residuals. Then take the lag of the residuals. Then recompute the regression by using the lagged residuals. Try something like the following on your data and see if you get better agreement.

``````ods graphics off;;
proc autoreg data=sashelp.air;
model air = date / nlag=1 method=ML;
run;

/* reproduce with PROC REG. First get residuals */
proc reg data=sashelp.air noprint;
model air = date;
output out=Residuals R=Res;
run;

data B;
merge sashelp.air Residuals(keep=Res);
lag = lag(Res);
run;

/* model using lag of residuals */
proc reg data=B;
model air = date lag;
ods select ParameterEstimates;
run;
``````

All Replies
Solution
‎06-28-2016 03:28 PM
SAS Super FREQ
Posts: 3,842

## Re: SAS Proc Autoreg

I don't think that your interpretation is correct.  I'm not a time series expert, but the documentation of PROC AUTOREG for the AR model seems to say that the coefficient of the AR1 term is computed from the lag of the residuals, not from the lag of the responses.

I could be wrong, but you can test my interpretation by calling PROC REG twice. First compute the residuals. Then take the lag of the residuals. Then recompute the regression by using the lagged residuals. Try something like the following on your data and see if you get better agreement.

``````ods graphics off;;
proc autoreg data=sashelp.air;
model air = date / nlag=1 method=ML;
run;

/* reproduce with PROC REG. First get residuals */
proc reg data=sashelp.air noprint;
model air = date;
output out=Residuals R=Res;
run;

data B;
merge sashelp.air Residuals(keep=Res);
lag = lag(Res);
run;

/* model using lag of residuals */
proc reg data=B;
model air = date lag;
ods select ParameterEstimates;
run;
``````
Occasional Contributor
Posts: 19

## Re: SAS Proc Autoreg

Thank your for the response. Yes I think you are correct, when I looked into it more the nlag option is specifying an autoregressive error option not lags of the dependent variable.  I can't figure out how to forecast ahead using lags of the dependent variable in proc autoreg.  The documentation meantions a lagdep option, but it seems you have to first create the lag of the dependent, and then specify it in the option which I could just as easily do in proc reg.  I am going to try and specify my model again with Proc Arima.

☑ This topic is solved.