BookmarkSubscribeRSS Feed
eemrun
Obsidian | Level 7

i am trying to simulate multiple scenarios from a VAR model using proc varmax. The idea is that proc varmax provides a forecast series and then multiple scenarios are generated around that series. I am currently running the following model:

 

 

ods graphics on;
proc varmax data=in(firstobs = 2) covout Outest = estin Outstat = s  plot = (residual model forecast);
   id ReportingDate interval=quarter align = end ;
   model cpi ump gdp hpi / 
   				 nseason = 4
/*				 cointtest=(johansen)*/
				 Dif = (cpi(1) ump(1) gdp(1) hpi(1)) 
				 p=4
				 	
   				 dftest
				 
                 print=(estimates diagnose);
			     output out=in_fct lead=12;
run;

This gives me a 12 period forecast.

 

I wanted to know if it is possible using Proc Varmax to generate multiple paths? My understanding is that you can create paths by generating a normally distributed residual distribution and then adding it back to the model estimates. But I am unclear as to how that works out in the procedure or how we can do this in SAS altogether.

 

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Yes, this is covered in Chapter 11 (pp. 204-207) of Simulating Data with SAS. (Code available from the web site.) Briefly, you estimate the parameters for the model, including the magnitude of the error terms.

The example in the book uses a simple one-variable regression with independent normal errrors. An OLS regression for the Sashelp.Class data is Weight = -143 + 3.9*Height + eps, where eps ~ N(0, 11.23). The following simulation is from p. 205. It simulates 100 data sets, each with different observed errors.

/* duplicate data by using sequential access followed by a sort     */
%let NumSamples = 100;              /* number of samples            */
data StudentSim(drop= b0 b1 rmse);
b0 = -143; b1 = 3.9; rmse = 11.23;  /* parameter estimates          */
call streaminit(1);
set Sashelp.Class;                  /* implicit loop over obs       */
i = _N_;
eta = b0 + b1*Height;               /* linear predictor for student */
do SampleID = 1 to &NumSamples;
   Weight = eta + rand("Normal", 0, rmse);
   output;
end;
run;

proc sort data=StudentSim;
   by SampleID i;
run;

You can then use BY-group analysis to get 100 "new" simulated analyses, each with its own predictions. The book does not have a VARMAX example, but hopefully you can generalize the main ideas of this example.

eemrun
Obsidian | Level 7
This is very useful. Thanks Rick. I will try it out with Varmax

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!

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
  • 2 replies
  • 939 views
  • 3 likes
  • 2 in conversation