## Fama-MacBeth regression

Moderators: EViews Gareth, EViews Moderator, EViews Esther

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

### Re: Fama-MacBeth regression

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.
Attachments
figur111.png (45.84 KiB) Viewed 5616 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12299
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Fama-MacBeth regression

You don't have a panel.

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

### Re: Fama-MacBeth regression

no idea , can you help me.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12299
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Fama-MacBeth regression

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.

metrix
Posts: 57
Joined: Sun Dec 08, 2013 9:15 am

### Re: Fama-MacBeth regression

thanks for your help Mr Gareth.

mick1987
Posts: 5
Joined: Sat Aug 02, 2014 9:31 am

### Re: Fama-MacBeth regression

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!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12299
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Fama-MacBeth regression

Which regression?

mick1987
Posts: 5
Joined: Sat Aug 02, 2014 9:31 am

### Re: Fama-MacBeth regression

The second regression where the cross-sectional regression is done.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12299
Joined: Tue Sep 16, 2008 5:38 pm

### Re: Fama-MacBeth regression

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.

mick1987
Posts: 5
Joined: Sat Aug 02, 2014 9:31 am

### Re: Fama-MacBeth regression

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?

mick1987
Posts: 5
Joined: Sat Aug 02, 2014 9:31 am

### Re: Fama-MacBeth regression

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??

mick1987
Posts: 5
Joined: Sat Aug 02, 2014 9:31 am

### Re: Fama-MacBeth regression

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?

Maverick
Posts: 8
Joined: Sun Aug 03, 2014 12:09 pm

### Re: Fama-MacBeth regression

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?

Maverick
Posts: 8
Joined: Sun Aug 03, 2014 12:09 pm

### Re: Fama-MacBeth regression

Also it would be nice to understand the purpose of design=1 in the below code?

matrix(n_p, n_f + 1) design = 1

EViews Rebecca
EViews Developer
Posts: 96
Joined: Thu Apr 18, 2013 8:37 am

### Re: Fama-MacBeth regression

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.