BookmarkSubscribeRSS Feed
abu1977
Calcite | Level 5
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)

where:
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;
quit;

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


/*Problem:*/
/* 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;
run;



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

/*Problem*/

/* 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;
run;

/*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.*/

/*Problem*/

/*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 ;
sumofcoeff_2=0.00164;
one_sumofcoeff_1= (1+sumofcoeff_1);
Sq_one_sumofcoeff_1= (one_sumofcoeff_1)*(one_sumofcoeff_1) ;
Sq_sumofcoeff_2= (sumofcoeff_2) * (sumofcoeff_2);
y1=0.00000556;
y2=.438;
sigma_wx= (Sq_sumofcoeff_2)* y2;
sigma_w= sigma_wx+ (Sq_one_sumofcoeff_1) * y1;
rsquare= sigma_wx/sigma_w;
run;


/*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
1 REPLY 1
statsplank
Calcite | Level 5
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):

data1;
.................
call symput("sumofcoeff_1",sumofcoeff_1);
call symput("sumofcoeff_2",sumofcoeff_2);
.................
run;

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

I hope this helps,
Olga

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 1418 views
  • 0 likes
  • 2 in conversation