Dear all,
I currently have panel data in the following form:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double DealNumber float(date ret ret_rf mkt_rf smb hml rf)
128631020 690 .003883495 -.012116506 .0071 -.42 0 .016
128631020 691 .01934236 .0033423584 -.0007 .32 -.06 .016
128631020 692 .0037950664 -.012204934 .0108 -.6 -.28 .016
128631020 693 .02079395 .00479395 .0017 .04 -.03 .016
128631020 694 .002814815 -.013185186 .0035 -.04 .19 .016
128631020 695 -.01019353 -.02619353 -.001 .62 .05 .016
128631020 696 0 -.017 -.0049 .07 .1 .017
128631020 697 .0009701492 -.016029852 -.0032 .52 -.02 .017
128631020 699 -.004696936 -.021696936 .0003 -.24 .12 .017
128631020 700 .0037453184 -.013254683 -.0002 .43 -.21 .017
128631020 701 .02052239 .003522387 .0046 .07 -.36 .017
128631020 702 -.003656307 -.02065631 -.0093 .62 .08 .017
I want to compute (and add to my data) regression coefficients on each of the Fama-French factors by regressing ret_rf on mkt_rf smb and hml for each DealNumber (approximately 10,000, with 180 observations each). The coefficients computed should be saved as a new variable for each corresponding DealNumber. Is there a way to do this?
Best,
Stijn
I currently have panel data in the following form:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double DealNumber float(date ret ret_rf mkt_rf smb hml rf)
128631020 690 .003883495 -.012116506 .0071 -.42 0 .016
128631020 691 .01934236 .0033423584 -.0007 .32 -.06 .016
128631020 692 .0037950664 -.012204934 .0108 -.6 -.28 .016
128631020 693 .02079395 .00479395 .0017 .04 -.03 .016
128631020 694 .002814815 -.013185186 .0035 -.04 .19 .016
128631020 695 -.01019353 -.02619353 -.001 .62 .05 .016
128631020 696 0 -.017 -.0049 .07 .1 .017
128631020 697 .0009701492 -.016029852 -.0032 .52 -.02 .017
128631020 699 -.004696936 -.021696936 .0003 -.24 .12 .017
128631020 700 .0037453184 -.013254683 -.0002 .43 -.21 .017
128631020 701 .02052239 .003522387 .0046 .07 -.36 .017
128631020 702 -.003656307 -.02065631 -.0093 .62 .08 .017
I want to compute (and add to my data) regression coefficients on each of the Fama-French factors by regressing ret_rf on mkt_rf smb and hml for each DealNumber (approximately 10,000, with 180 observations each). The coefficients computed should be saved as a new variable for each corresponding DealNumber. Is there a way to do this?
Best,
Stijn
Comment