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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

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;
dsriggs
Fluorite | Level 6

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2408 views
  • 0 likes
  • 2 in conversation