BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
somebody
Lapis Lazuli | Level 10

Hi all, 

I would like to run some Vector Autoregression with parameters restrictions. That is, I dont want to regress the dependent variable (Yt) on its lag but other independent variables are still regressed on their lags. Please see attached file for a matrix illustration. I only want 1 lag

 

I also would like to obtain the variance-covariance matrix of the error terms. My code so far:

proc varmax data=input_data;
   model Y = A B C/ P=1;
  * restrict AR(1, Y, {A B C}) = 0,
            XL(0, CPI, {FFR CP}) = 0; *not sure what this restrict option does as why do we set it to equal 0;
run;

 

VAR with parameter restriction.PNG


VAR with parameter restriction.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
dw_sas
SAS Employee

Hi,

 

Based on the description of your model, you can obtain your desired result using the following PROC VARMAX specification:

 

proc varmax data=input_data;
   model y a b c / p=1 print=(estimates) ;
   restrict ar(1,1,1)=0, ar(1,2,1)=0, ar(1,3,1)=0, ar(1,4,1)=0;
run;

 

Since you want the variables, A, B and C, to also be regressed on their lags, they must appear on the left-hand-side of the equation.  

 

The output generated by PROC VARMAX includes a table labeled "Covariances of Innovations".  This is the variance-covariance matrix of the error terms, which you indicated that you also needed.  If you want to save this variance-covariance matrix as a SAS data set, then you can use an ODS OUTPUT statement to do so. 

 

Following, please find a modification of the above code, which illustrates the ODS OUTPUT statement and also provides a modified version of the RESTRICT statement.  The modified RESTRICT statement imposes the same restriction, but uses a more concise matrix expression.  A PROC PRINT step is added to print the ERROR_COV data set created from the ODS OUTPUT statement.

 

proc varmax data=input_data;
   ods output CovInnovation=error_cov;
   model y a b c / p=1 print=(estimates) ;
   restrict ar(1,{1,2,3,4},1)=0;
run;

proc print data=error_cov;
run;

 

I hope this helps!

DW

View solution in original post

2 REPLIES 2
dw_sas
SAS Employee

Hi,

 

Based on the description of your model, you can obtain your desired result using the following PROC VARMAX specification:

 

proc varmax data=input_data;
   model y a b c / p=1 print=(estimates) ;
   restrict ar(1,1,1)=0, ar(1,2,1)=0, ar(1,3,1)=0, ar(1,4,1)=0;
run;

 

Since you want the variables, A, B and C, to also be regressed on their lags, they must appear on the left-hand-side of the equation.  

 

The output generated by PROC VARMAX includes a table labeled "Covariances of Innovations".  This is the variance-covariance matrix of the error terms, which you indicated that you also needed.  If you want to save this variance-covariance matrix as a SAS data set, then you can use an ODS OUTPUT statement to do so. 

 

Following, please find a modification of the above code, which illustrates the ODS OUTPUT statement and also provides a modified version of the RESTRICT statement.  The modified RESTRICT statement imposes the same restriction, but uses a more concise matrix expression.  A PROC PRINT step is added to print the ERROR_COV data set created from the ODS OUTPUT statement.

 

proc varmax data=input_data;
   ods output CovInnovation=error_cov;
   model y a b c / p=1 print=(estimates) ;
   restrict ar(1,{1,2,3,4},1)=0;
run;

proc print data=error_cov;
run;

 

I hope this helps!

DW

somebody
Lapis Lazuli | Level 10

Thanks, this works fine.

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
  • 2 replies
  • 1085 views
  • 1 like
  • 2 in conversation