Hi,
I have a data of date, companies and monthly return. I downloaded the 5 factors from Fama and French website. I want to regress the following model:
r = alpha + beta*Mkt + s*SMB + h*HML + r*RMW + c*CMA + e
I want to get the estimated intercept (alpha), residuals (e) and the factors' parameters for EACH company.
I used prog reg and could get some results, but I do not know how to check so I tried to use proc model as well but failed. The system said there is some problems with the "test" variables depending on time so the results will not make sense (or something like that).
I would really appreciate it if you could tell me which method is correct, or any possible mistakes that I made, or at least how are they different.
Enclosed is the codes I wrote for 2 methods.
Any other suggestions would also be much appreciated.
proc reg data=I outest=I_result tableout;
by Fund;
C5: model R = Mkt HML SMB RMW CMA /acov;
ods output parameterestimates=I_result2;
run;
proc model data=I outparms=I_para;
endo R;
exog Mkt HML SMB RMW CMA;
instruments _exog_;
parms alpha beta s h r c;
R = alpha + beta*Mkt+ s*SMB + h*HML + r*RMW + c*CMA;
fit R / GMM Kernel=(BART,1,0) vardef=n;
test HML, SMB, RMW, CMA; *<-- errors are mostly here I guess, the other parts I follow the webpage of proc model quite closely;
run;
quit;
Thank you very much in advance!
Have a nice day.
In the CALL to PROC MODEL you are not using the BY statement, so that is probably why your results are different.
Here is some example code that displays the parameter estimates for some small data:
proc sort data=sashelp.class out=class; by sex; run;
ods graphics off;
proc reg data=class outest=I_result tableout;
by sex;
C5: model height = weight age /acov;
ods select ParameterEstimates;
run;
proc model data=class outparms=I_para;
by sex;
endo height;
exog weight age;
instruments _exog_;
parms alpha beta s;
Height = alpha + beta*weight+ s*age;
fit Height / GMM Kernel=(BART,1,0) vardef=n;
ods select ParameterEstimates;
run;
quit;
That said, the models you are running are not identical, so it is possible that the estimates might differ in the fourth or fifth decimal place.
Regarding the TEST statement, you need to specify the parameter names, not the variable names:
TEST alpha, beta, s, h, r, c;
In the CALL to PROC MODEL you are not using the BY statement, so that is probably why your results are different.
Here is some example code that displays the parameter estimates for some small data:
proc sort data=sashelp.class out=class; by sex; run;
ods graphics off;
proc reg data=class outest=I_result tableout;
by sex;
C5: model height = weight age /acov;
ods select ParameterEstimates;
run;
proc model data=class outparms=I_para;
by sex;
endo height;
exog weight age;
instruments _exog_;
parms alpha beta s;
Height = alpha + beta*weight+ s*age;
fit Height / GMM Kernel=(BART,1,0) vardef=n;
ods select ParameterEstimates;
run;
quit;
That said, the models you are running are not identical, so it is possible that the estimates might differ in the fourth or fifth decimal place.
Regarding the TEST statement, you need to specify the parameter names, not the variable names:
TEST alpha, beta, s, h, r, c;
The message
At 2SLS Iteration 1 convergence assumed because OBJECTIVE=5.752357E-27 is almost zero (<1E-12)
is not an error, it is a note. It is saying that the "Two-Stage Least Square (2SLS)" method does not need to iterate because the initial approximation already satisfies the convergence criterion.
Regarding which analysis is correct, it depends on your data and assumptions. PROC REG is appropriate when each observation is statistically independent. Time series procedures are more appropriate when the observations are serially correlated. That is the value at time t+1 is correlated)with the value at time t.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: