bashtage/linearmodels

Encounter ValueError when using FamaMacBeth...

Cheungki opened this issue · 8 comments

Thanks for your attention. I got the error "ValueError: Model cannot be estimated. All blocks of time-series observations are rank
deficient, and so it is not possible to estimate any cross-sectional regressions." when using FamaMacBeth model to do regression on my own dataset.

Here is my codes:

df = pd.read_csv('result/Exreturn.csv', parse_dates=['Month'])
df['code'] = '000001'
df = df.set_index(['code', 'Month'])
mod = FamaMacBeth(df['Exreturn_Level_High'], sm.add_constant(df[['MKT', 'SMB', 'HML', 'RMW', 'CMA']]))

The dataset is organized as followed:
data

Thanks a lot:)

@Cheungki rank deficiency means that one of the independent variables can be written as a linear combination of other independent variables. I cannot investigate it properly without accessing your data, but based on my finance knowledge, my best guess would be that market portfolio (MKT) can be created using a combination of other portfolios. Is there any way you could share the data?

As @kapa112 said, it is really hard to tell without the data. Can you share the data somehow? The error indicates that you model is singular. When using FMB it must be the case that the X variables have some cross-sectional variation. This rules out some types of variables that only change with time (e.g., a dummy variable for the year). These are never needed since FMB behaves as-if time effects are included.

I got the same error too!
image
image
image

Do you variables that do not change in each cross section, for example, time dummy variables?

But I didn't add time dummy variables...
My dependent variable is annually_return, exog variables are risk_premium(traded_value), size, BE/ME, OP, INV and LL_industry(EBITDA)

like this
image

Is risk premium a linear function of the other variables? Or is risk premium only a function of the year?

Thanks a lot! That's the point! @bashtage