Fama Macbeth Regression in Python (Pandas or Statsmodels)

后端 未结 3 1307
南笙
南笙 2020-12-09 06:32

Econometric Backgroud

Fama Macbeth regression refers to a procedure to run regression for panel data (where there are N different individua

3条回答
  •  佛祖请我去吃肉
    2020-12-09 06:36

    A quick and dirty solution to solve the problem and continue using the same thing you were using.

    It worked for me.

    def fmreg(data,formula):
        return smf.ols(formula,data=data).fit().params[:]
    
    res = df.groupby('date').apply(fmreg,'ret~var1+var2+var3')
    

提交回复
热议问题