Programming the statistical procedures from SAS

R-Square as in Hasbrouck's Review of Financial Studies 1991 paper

Posts: 1

R-Square as in Hasbrouck's Review of Financial Studies 1991 paper

HI All

I am having trouble in estimating R-Square according to Hasbrouck's RFS 1991 paper. I am trying to estimate the following equations:

VAR: [Equation:4]

r(t)= a1 r(t-1)+a2 r(t-2)+ ..... + b0 x(t)+ b1 x(t-1) +......+ v(1,t) ===> Eq 4 (a)
x(t)= c1 r(t-1)+c2 r(t-2)+ ..... + d1 x(t-1)+d2 x(t-2)+ ..... + v(2,t)

VMA: [Equation:5]

r(t) = v(1,t) + a*1 v(1,t-1) + a*2 v(1,t-2)+ .... ...+ b*0 v(2,t)+ b*1 V(2,t-1)+.....
x(t)= c*1 v (1,t-1)+ c*2 v (1,t-2)+ ... ..... + v(2,t)+ d*1 v (2,t-1) + d*2 v (2,t-2)+... ..

from equation 4 & 5 : I will estimate:

R-square (w)= Sigma-Square (w,x)/ sigma-square (w) --- eq(6)

Sigma-Square (w,x)= (sum of b*(i)) * Omega * (sum of b*(i))(transepose);
Sigma-Square (w)= Sigma-Square (w,x) + (1+ Sum of a*(i))^2 * sigma-square (1); --- equation (7)

to estimate these I came up with the following SAS code:

/*First I simulate y1 and y2 to estimate a VAR*/
proc iml;
sig = {1.0 0.5, 0.5 1.25};
phi = {1.2 -0.5, 0.6 0.3};
call varmasim(y,phi) sigma = sig n = 100 seed = 46859;
cn = {'y1' 'y2'};
create a from y[colname=cn];
append from y;

/*I estimate VAR(4) model. */
/*The variance of error term for y1 and y2 are used in estimating R square*/

/* 1) The above sas code does not estimate Eq 4(a) since my sas code does not include the contemporenous y2 terms */
/*2) I dont know how to modify the VARMAX to include the contemporaneous y2 term.*/

/*Please help me to solve this part*/

proc varmax data=a;
model y1 y2 / p=4 noint ;
ods output covInnovation=covInnovation;

/*I then estimate the VMA process and saves the parameter estimates in PPP file*/


/* 1)There are convergence issue for one element of gradient. I dont know whether it can cause any problem*/ /*I dont know how to solve the convergence issue*/

/* 2)Is there any other way to estimate the coefficients b*(i) and a*(i) without doing the VMA */

proc varmax data=a;
model y1 y2 / q=4 noint ;
ods output ParameterEstimates=ppp;

/*Please help me on this*/

/*This section I have used the parameters from the Original paper to estimate R-Square*/
/*I can replicate the result reported in the original paper. That means this code works.*/


/*How can I use the above two files to come up wit the following four parameter values : sumofcoeff_1, sumofcoeff_2, y1,y2*/

/*I want to write a sas code that will take these values from the saved files and use it to estimate R-Square*/

data test;
sumofcoeff_1=-0.272 ;
one_sumofcoeff_1= (1+sumofcoeff_1);
Sq_one_sumofcoeff_1= (one_sumofcoeff_1)*(one_sumofcoeff_1) ;
Sq_sumofcoeff_2= (sumofcoeff_2) * (sumofcoeff_2);
sigma_wx= (Sq_sumofcoeff_2)* y2;
sigma_w= sigma_wx+ (Sq_one_sumofcoeff_1) * y1;
rsquare= sigma_wx/sigma_w;

/*Please Help me */


I have looked at Prof Hasbrouck’s Web site.. He has whole bunch of sas codes but I couldn't figure out which one I could use to get the RFS 1991 result.

If anyone has any clue please help me. I am struggling with this for long time.

I am not sure how Prof Hasbrouck’s Codes work.. How he manages to get b* and a* without doing any VMA. Is there any easy way round to find these coefficients.

Any help is highly appreciated

Thanks for the time

Abu S AMin
University of Houston
Frequent Contributor
Posts: 77

Re: R-Square as in Hasbrouck's Review of Financial Studies 1991 paper

Hi Abu,

From what you wrote I understand you have calculated sumofcoeff_1, sumofcoeff_2 in one data step and would like to use their values in another data step. If this is the case, then CALL SYMPUT routine maybe of use as follows (an example):

call symput("sumofcoeff_1",sumofcoeff_1);
call symput("sumofcoeff_2",sumofcoeff_2);

one_sumofcoeff_1= (1+&sumofcoeff_1);
Sq_one_sumofcoeff_1= (one_sumofcoeff_1)*(one_sumofcoeff_1) ;
Sq_sumofcoeff_2= (&sumofcoeff_2) * (&sumofcoeff_2);

I hope this helps,
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation