Page 5 of 11

Re: Fama-MacBeth regression

Posted: Mon Jul 28, 2014 9:33 am
by metrix
I thought that this line

Code: Select all

equation {%subcsavg}.ls(cov=hac) avgrets c betag

I have change it by this code (Ref: EViews 8 command ref pp 382 Panel LS Options)

Code: Select all

equation {%subcsavg}.ls(wgt=cxsur) avgrets c betag

but an error message appear.
I don't know what to say :| thanks for the help.

Re: Fama-MacBeth regression

Posted: Mon Jul 28, 2014 10:01 am
by EViews Gareth
You don't have a panel.

Re: Fama-MacBeth regression

Posted: Mon Jul 28, 2014 10:19 am
by metrix
no idea :oops: , can you help me.

Re: Fama-MacBeth regression

Posted: Mon Jul 28, 2014 10:31 am
by EViews Gareth
EViews Gareth wrote:Looks like the subroutine FMB is the part that does the calculations. The line:

Code: Select all

   rowplace(g, @transpose(@inverse(@transpose(design) * design) * @transpose(design) * retvec), j)

is the one that performs OLS and puts the row of coefficients into the matrix g. Just change that line to do whatever calculation you want, instead of OLS.

Re: Fama-MacBeth regression

Posted: Fri Aug 01, 2014 2:14 pm
by metrix
thanks for your help Mr Gareth.

Re: Fama-MacBeth regression

Posted: Sun Aug 03, 2014 12:01 pm
by mick1987
Hi, I would like some tips on how to modify the fama-macbeth code such that I also get the R squared of the regression. Thanks in advance!

Re: Fama-MacBeth regression

Posted: Sun Aug 03, 2014 2:18 pm
by EViews Gareth
Which regression?

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 12:35 am
by mick1987
The second regression where the cross-sectional regression is done.

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 4:23 am
by EViews Gareth
It isn't currently covered by the add-in. As mentioned a few posts above, there is a single subroutine that currently performs the least squares regression (and does so using matrix objects rather than the built-in estimation routines). You would have to modify that subroutine to also calculate, and store, the R-squared.

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 5:42 am
by mick1987
Thanks. I have tried to understand how the rolling add-in function in eviews works and also tried to implement it. Do you think I can apply the same method as in the roll code for the add-in?

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 5:53 am
by mick1987
Sorry for the diffusing question.. what I'm asking about is that the roll add-in function reports the r squares.. can I use their way to get the r square incorporated into the fama-macbeth add-in??

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 5:57 am
by mick1987
Also I have a question regarding the second table output from the add-in function, are the betas reported in table 2 average betas from the first regression?

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 8:53 am
by Maverick
Hi, I also need to incorporate r square into the code. I understand the first part of the fmb subprogram, but not the following part of the operation in the program:

@transpose(@inverse(@transpose(design) * design) _
* @transpose(design) * retvec)

If someone can help me understand this part it would be really appreciated! Thanks in advance! Also I would like to know if this sign: _ has a meaning in the code?

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 8:58 am
by Maverick
Also it would be nice to understand the purpose of design=1 in the below code?

matrix(n_p, n_f + 1) design = 1

Re: Fama-MacBeth regression

Posted: Mon Aug 04, 2014 9:30 am
by EViews Rebecca
mick1987 wrote:Also I have a question regarding the second table output from the add-in function, are the betas reported in table 2 average betas from the first regression?


They are betas from a second regression that use the betas from the first timeseries regression as regressors. See equation 4 in the documentation for more details.