Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
Attachment:
fm.ado
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: Fama-MacBeth regression
From
"Francis, Richard N" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: RE: Fama-MacBeth regression
Date
Fri, 3 Jan 2014 18:40:10 +0000
Adrian,
Attached is the Stata code for the FM regression.
Code is from Mitch Petersen (http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/se_programming.htm).
Good luck!
Rick Francis
Associate Professor
Department of Accounting
College of Business Administration
University of Texas at El Paso
500 W. University Avenue
El Paso, TX 79968
Office: 915-747-7953
FAX: 915-747-8618
Email: [email protected]
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Adrian Stork
Sent: Friday, January 03, 2014 11:23 AM
To: [email protected]
Subject: st: Fama-MacBeth regression
Dear all
I'm trying to run a second-pass cross-sectional regression which is part of what finance researchers call a Fama-MacBeth regression.
I managed to get the beta-coefficients from the first-pass regression but now I'm stuck at the second-pass CSR.
So my dataset looks currently like this (time period starts in 1987m7 and ends 2012m12):
________________portfolios________________________
_________________coefficients__________________________
date2 exsize_1 exsize_2 exsize_3 exbm_1 exbm_2 exbm_3 betaexsize_1 betaexsize_2 betaexsize_3 betaexbm_1 betaexbm_2 betaexbm_3
.... etc.
1989m6 .31 3.41 3.10 2.83 2.25 1.02 .64 .68 .67 .63 .76 .65
1989m7 1.16 1.85 4.93 9.40 3.31 4.65 .64 .68 .67 .63 .76 .65
1989m8 2.45 2.94 6.85 4.50 3.82 4.76 .64 .68 .67 .63 .76 .65
1989m9 -.60 1.38 -1.56 2.69 -.72 -1.38 .64 .68 .67 .63 .76 .65
1989m10 -1.46 -1.41 -.89 .11 -1.25 1.89 .64 .68 .67 .63 .76 .65
etc.
Now I need to regress at each individual month all the portfolios against the their estimated coefficient.
But that is exactly what I'm not able to manage. In the end there should be one figure at each time period t which corresponds to the new coefficient from the individual cross-sectional regressions As you can see I merely added the prefix "beta" for the coefficients with respect to its portfolio.
The best I could come with is the following:
.ds ex*
.forval i=330/635{
.foreach v of varlist `r(varlist)' {
. regress `v' beta`v' if date2==`i'
. gen lambda`v' = _b[beta`v']
.}
.}
but here the error message is "insufficient observations" although all obsevations are nonmissing.
I know there is a code from Kellog University
(http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/fm.ado)
but that does not include the first pass regression and brings me to the same point. Also I want to understand the entire procedure and follow my results.
Thus, does anyone have an idea how to retrieve the second pass regression coefficients (the beta coefficient in the second pass regression is perfectly fine and enough - no need for the constant or the residuals right now).
I guess reshaping the dataset might also be an alternative beginning compared to the code I wrote above.
Best,
Adrian
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
Description: fm.ado