BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KrisDeng
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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;

KrisDeng
Obsidian | Level 7
Thank you very much for your reply. I have adapted some of the codes. It certainly helps but I'm faced with the same errors in "variable depending on time" and something like " At 2SLS Iteration 1 convergence assumed" due to the BY group. Probably I am not informed and experienced enough, I will continue to look into this. Other than that, I'd appreciate it any further suggestions.
Rick_SAS
SAS Super FREQ

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1987 views
  • 0 likes
  • 2 in conversation