BookmarkSubscribeRSS Feed
eric_sas_1
Obsidian | Level 7

I have built a simply dynamic model in PROC AUTOREG, such that y is a function of the previous month's (y_{t-1}), and some exogenous regressors. I see that PROC AUTOREG can handle forecasting of static models, but when a model with a lagged dependent variable is specified PROC AUTOREG cannot dynamically forecast that model. 

 

Are there other, simpler options for forecasting dynamic models aside from writing the model out and forecasting via a datastep or using PROC SIMLIN? It would be nice if PROC AUTOREG had the capability...Suggestions would be helpful.

 

Working with SAS 9.4.

 

4 REPLIES 4
dw_sas
SAS Employee

You might want to consider using PROC VARMAX to fit and forecast your dynamic regression model.  For example, let's assume you have a data set with Y, X1 and X2 and you want to fit a model where Y is a function of X1, X2 and a lag 1 of Y.  Let's also assume your input data set as 12 future values of your exogenous variables, X1 and X2.  You can fit and forecast your model using the following code:

 

proc varmax data=a;
  model y = x1 x2 / p=1;
  output out=out lead=12;
run;

For more information about the above model specification, please see the Vector Autoregressive Model with Exogenous Variables section of the PROC VARMAX documentation at the following link:

 

https://go.documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_varmax_gettingstarted07.htm&docs...  

 

I hope this helps!

DW

 

eric_sas_1
Obsidian | Level 7

Thanks for the response. One of the nice features if that if you build a model with an autoregressive error model for (v_t) in PROC AUTOREG using the nlag option, the forecasting engine will forecast the fully specified model including the model for the errors, with the aforementioned limitation that it cannot handle a dynamic forecast. From what I understand about PROC VARMAX, this isn't easily accomplished, but I may not be well versed enough in that PROC.

dw_sas
SAS Employee

Hi Eric_sas_1,

 

Thanks for your reply.  Would it be possible for you to provide the details of the mathematical model you are trying to fit, as well as information regarding your input data set, such as whether or not future values of the exogenous variables are provided?  Once we have this information, we will be better able to suggest a procedure to use.

 

Thanks!

DW

eric_sas_1
Obsidian | Level 7

Thanks. I'm trying to fit a model to time-series data such that y_t is a function of y_{t-1} and a series of contemporaneous exogenous factors x, with a model for autocorrelated disturbances, v_t.

 

Model detail:

  • y_t = x'B + v_t
  • v_t = e_t - B(v_{t-1}) - ... B(v_{t-n})

 

I'm using PROC AUTOREG with the following code:

PROC AUTOREG data=test;
model y = lagy x1 x2 x3 / lagdep=lagy nlag=12 backstep method=ml;
output out=out_test predicted=p residual=r;
run;

I would like to forecast this model using PROC AUTOREG. Future values of the exogenous variables are provided, except for the lagged dependent variable. I can easily estimate and forecast a static model with no lagged dependent variable. Is PROC AUTOREG capable of dynamic forecasting? What is the best alternative in SAS to do so? Currently, there are two options I have been using to forecast (see below), would be nice if AUTOREG had this capability.

 

  1. Manual calculation in data step, making use of the retain function
  2. PROC SIMLIN can forecast dynamic models

 

Sample dataset:

 

data input_data;
input y lagy x1 x2 x3
datalines;
212  204  0  18223  2.282
187  212  1  18121  2.212
180  187  0  18507  4.063
.    180  0  17660  3.011
.    .    0  17782  2.799
.    .    0  17887  2.399
.    .    1  17998  2.500
;

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 4 replies
  • 1555 views
  • 2 likes
  • 2 in conversation