turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- SAS Proc Autoreg

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-14-2016 08:21 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to dsriggs

06-14-2016 09:31 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to dsriggs

06-14-2016 09:31 AM

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;
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

06-14-2016 09:42 AM

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.