I am performing a 2-step Fama and Macbeth regression on the liniear equation:
Dispersionitm = a + B1(BiasAitm) + B2(Skewnessitm) + B3(BiasMitm) + e"itm
Step 1: obtaining the estimated Beta's/factor loadings as regression coefficients:
statsby _b _se, by(endofmonth fyear) clear : reg dispersionLiuIMT BiasALiu SkewnessIMTLiu BiasM
(running regress on estimation sample)
command: regress dispersionLiuIMT BiasALiu SkewnessIMTLiu BiasM
by: endofmonth fyear
"For step 2 I computed T cross-sectional regressions of the returns on the
m estimates. Each regression uses the same return/dispersion from the firrst step, because now the goal is the exposure
of the n returns to the Beta factor loadings over time on the linear equation":
Dispersionitm = y + y1(B1) + y2(B2) +y3(B3) + e"itm
Step 2: obtaining the estimated Gamma's y as regression coefficients:
statsby _b _se, by(endofmonth fyear) clear : xtreg dispersionLiuIMT _b_BiasALiu _b_SkewnessIMTLiu _b_BiasM, ml
> e
(running xtreg on estimation sample)
command: xtreg dispersionLiuIMT _b_BiasALiu _b_SkewnessIMTLiu _b_BiasM, mle
by: endofmonth fyear
The results example are presented below, only the bolted variables names have non-zero numbers!
endofmonth fyear dispersionLiuIMT_b_b_BiasALiu _stat_2 dispersionLiuIMT_b_b_BiasM dispersionLiuIMT_b_cons sigma_u_b_cons sigma_e_b_cons dispersionLiuIMT_se_b_BiasALiu _stat_8 dispersionLiuIMT_se_b_BiasM dispersionLiuIMT_se_cons sigma_u_se_cons sigma_e_se_cons
518 2002 0 0 0 .2249191 0 .3937621 0 0 0 .0696079 0 .0492201
518 2003 0 0 0 .0909385 0 .275176 0 0 0 .010972 0 .0077583
518 2004 0 0 0 .0407122 0 .0422358 0 0 0 .0072434 0 .0051218
519 2002 0 0 0 .2862591 0 .5057945 0 0 0 .1103727 0 .0780446
519 2003 0 0 0 .0988489 0 .2996225 0 0 0 .0110744 0 .0078307
519 2004 0 0 0 .0491841 0 .0594261 0 0 0 .0090624 0 .0064081
Does anyone know how to obtain the gamma's? because the statsby option does not seem to work for the xtreg to obtain the gamma's!
I came across: http://www.kellogg.northwestern.edu/...rogramming.htm
Fama-MacBeth Standard Errors
Stata does not contain a routine for estimating the coefficients and standard errors by Fama-MacBeth (that I know of), but I have written an ado file which you can download. The ado file fm.adoruns a cross-sectional regression for each year in the data set. The program allows you to specify a by variable for Fama-MacBeth. Thus if in stead of running T cross-sectional regressions, you could run N time series regressions by specifying the firm identifier as the byfm( ) variable. If the option is not specified, it uses the time variable (as set by the tsset comment) as the by variable. The program is also now compatible with the outreg procedure.
part of the ado-file:
* ----------------- Calculate the coefficients for indep vars -------------------;
tokenize `varlist'; /* this puts varlist in to the macros `1' `2' etc */
macro shift; /* drops first arguement and shifts the rest up one */
local i = 1;
* loop as long as macro `1' is not empty;
while "`1'" ~= "" {;
quietly sum b_`1';
local b`i' = r(mean);
matrix coef[1,`i']= r(mean); /* save the slope coefficients in matrix coef */
matrix vc[`i',`i']= (r(sd)/sqrt(r(N)))^2; /* save the variances in matrix vc */
macro shift;
local i = `i' + 1;
};
* ------------------------ Now calculate the constant ----------------------------;
quietly sum b_cons;
local bcons = r(mean);
local nreg_ = r(N); /* nreg_ saves the number of regressions run */
* save the slope coefficient in matrix coef;
matrix coef[1,`i']= r(mean); /* save the slope coefficients in matrix coef */
matrix vc[`i',`i']= (r(sd)/sqrt(r(N)))^2; /* save the variances in matrix vc */
drop _all;
use junk_fm;
erase junk_fm.dta;
Dispersionitm = a + B1(BiasAitm) + B2(Skewnessitm) + B3(BiasMitm) + e"itm
Step 1: obtaining the estimated Beta's/factor loadings as regression coefficients:
statsby _b _se, by(endofmonth fyear) clear : reg dispersionLiuIMT BiasALiu SkewnessIMTLiu BiasM
(running regress on estimation sample)
command: regress dispersionLiuIMT BiasALiu SkewnessIMTLiu BiasM
by: endofmonth fyear
"For step 2 I computed T cross-sectional regressions of the returns on the
m estimates. Each regression uses the same return/dispersion from the firrst step, because now the goal is the exposure
of the n returns to the Beta factor loadings over time on the linear equation":
Dispersionitm = y + y1(B1) + y2(B2) +y3(B3) + e"itm
Step 2: obtaining the estimated Gamma's y as regression coefficients:
statsby _b _se, by(endofmonth fyear) clear : xtreg dispersionLiuIMT _b_BiasALiu _b_SkewnessIMTLiu _b_BiasM, ml
> e
(running xtreg on estimation sample)
command: xtreg dispersionLiuIMT _b_BiasALiu _b_SkewnessIMTLiu _b_BiasM, mle
by: endofmonth fyear
The results example are presented below, only the bolted variables names have non-zero numbers!
endofmonth fyear dispersionLiuIMT_b_b_BiasALiu _stat_2 dispersionLiuIMT_b_b_BiasM dispersionLiuIMT_b_cons sigma_u_b_cons sigma_e_b_cons dispersionLiuIMT_se_b_BiasALiu _stat_8 dispersionLiuIMT_se_b_BiasM dispersionLiuIMT_se_cons sigma_u_se_cons sigma_e_se_cons
518 2002 0 0 0 .2249191 0 .3937621 0 0 0 .0696079 0 .0492201
518 2003 0 0 0 .0909385 0 .275176 0 0 0 .010972 0 .0077583
518 2004 0 0 0 .0407122 0 .0422358 0 0 0 .0072434 0 .0051218
519 2002 0 0 0 .2862591 0 .5057945 0 0 0 .1103727 0 .0780446
519 2003 0 0 0 .0988489 0 .2996225 0 0 0 .0110744 0 .0078307
519 2004 0 0 0 .0491841 0 .0594261 0 0 0 .0090624 0 .0064081
Does anyone know how to obtain the gamma's? because the statsby option does not seem to work for the xtreg to obtain the gamma's!
I came across: http://www.kellogg.northwestern.edu/...rogramming.htm
Fama-MacBeth Standard Errors
Stata does not contain a routine for estimating the coefficients and standard errors by Fama-MacBeth (that I know of), but I have written an ado file which you can download. The ado file fm.adoruns a cross-sectional regression for each year in the data set. The program allows you to specify a by variable for Fama-MacBeth. Thus if in stead of running T cross-sectional regressions, you could run N time series regressions by specifying the firm identifier as the byfm( ) variable. If the option is not specified, it uses the time variable (as set by the tsset comment) as the by variable. The program is also now compatible with the outreg procedure.
part of the ado-file:
* ----------------- Calculate the coefficients for indep vars -------------------;
tokenize `varlist'; /* this puts varlist in to the macros `1' `2' etc */
macro shift; /* drops first arguement and shifts the rest up one */
local i = 1;
* loop as long as macro `1' is not empty;
while "`1'" ~= "" {;
quietly sum b_`1';
local b`i' = r(mean);
matrix coef[1,`i']= r(mean); /* save the slope coefficients in matrix coef */
matrix vc[`i',`i']= (r(sd)/sqrt(r(N)))^2; /* save the variances in matrix vc */
macro shift;
local i = `i' + 1;
};
* ------------------------ Now calculate the constant ----------------------------;
quietly sum b_cons;
local bcons = r(mean);
local nreg_ = r(N); /* nreg_ saves the number of regressions run */
* save the slope coefficient in matrix coef;
matrix coef[1,`i']= r(mean); /* save the slope coefficients in matrix coef */
matrix vc[`i',`i']= (r(sd)/sqrt(r(N)))^2; /* save the variances in matrix vc */
drop _all;
use junk_fm;
erase junk_fm.dta;