## many mistakes in my F-test part. help me please. thank you very much!

Occasional Contributor
Posts: 15

# many mistakes in my F-test part. help me please. thank you very much!

here is some explain about my question. I need some help. I am kind of following Fama French (1993). I have 50 portfolios. I have to run a time series regression of return of each portfolio on Rm-Rf, SMB, HML. To test 3 factor model of FF, I have to test whether the intercepts in each regression above are jointly significantly different from 0. To do that, the best way is to use Gibbons, Ross, Shanken (1989) test. First I calculate the covariance matrix of the 4 risk factors using proc corr and output the matrix using ods function. Then I calculate the covariance matrix of error terms using proc syslin - SUR. (I am not sure how big a system can proc syslin support) Finally, I use proc iml to calculate the GRS F-Stat. Thank you very much. Regards, Duong ********* Calculate mean and covariance matrix of 4 factors; data allreg;set allreg; if p1=0 and p2=0 and p3=0 then rif0=meanret-meanlilv; if p1=0 and p2=0 and p3=1 then rif1=meanret-meanlilv; if p1=0 and p2=0 and p3=2 then rif2=meanret-meanlilv; if p1=0 and p2=1 and p3=0 then rif3=meanret-meanlilv; if p1=0 and p2=1 and p3=1 then rif4=meanret-meanlilv; if p1=0 and p2=1 and p3=2 then rif5=meanret-meanlilv; if p1=0 and p2=2 and p3=0 then rif6=meanret-meanlilv; if p1=0 and p2=2 and p3=1 then rif7=meanret-meanlilv; if p1=0 and p2=2 and p3=2 then rif8=meanret-meanlilv; run; data b; yyyymm=199608; data a; %macro a(x); data a; set allreg; where rif&x^=.; keep rif&x yyyymm rmf smb hml liq; run; data b; merge a b; by yyyymm; run; %mend a; %a(0); %a(1); %a(2); %a(3); %a(4); %a(5); %a(6); %a(7); %a(8); run; /*data allreg;set allreg; drop meanret meanlilv; run; */ ods output Cov=fcov; ods output SimpleStats=fmean; proc corr data=b cov vardef=n; var rmf smb hml liq; run; data fcov; set fcov;  run; data fmean; set fmean; run; ********* Use SUR procedure to calculate the residual covariance matrix; proc syslin data=b sur vardef=n outest=parms; rank0: model rif0=rmf smb hml liq/covb; rank1: model rif1=rmf smb hml liq/covb; rank2: model rif2=rmf smb hml liq/covb; rank3: model rif3=rmf smb hml liq/covb; rank4: model rif4=rmf smb hml liq/covb; rank5: model rif5=rmf smb hml liq/covb; rank6: model rif6=rmf smb hml liq/covb; rank7: model rif7=rmf smb hml liq/covb; rank8: model rif8=rmf smb hml liq/covb; rank9: model rif9=rmf smb hml liq/covb; ods output InvCovResiduals=rinvcov; ods select InvCovResiduals; run; data parms; set parms (keep=_TYPE_ _MODEL_ Intercept); where _TYPE_='SUR'; proc print data=parms; title 'INTERCEPTS for 4-FACTOR REGRESSION'; data rinvcov; set rinvcov;    run; *** NOTE: rinvcov contains the inverse cov matrix of residuals; ********* Calculate GRS F-Statistics; /*************many mistakes in this part*/ proc iml; use fcov; read b  var _num_ into O; print O; invO=inv(O); ***Inverse Omega; print invO; use fmean; read b var _num_  into M; ***E(f); print M; tM=M`; ***Transpose E(f); print tM; tM_invO=tM*invO; print tM_invO; tM2_invO=tM_invO*M; print tM2_invO; Z=1+tM2_invO; invZ=inv(Z); use rinvcov; read b var _num_ into invS; print invS; use parms; read b var _num_ into A; print A; tA=A`; print tA; tA_invS=tA*invS; print tA_invS; tA2_invS=tA_invS*A; print tA2_invS; X=(T-N-K)/N; ***Need to plug in figure manually; F1=X*invZ*tA2_invS; print F1;

Discussion stats
• 0 replies
• 444 views
• 0 likes
• 1 in conversation