Skip to content

Fama-French should use multivariate regression #379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
twiecki opened this issue May 12, 2017 · 3 comments
Closed

Fama-French should use multivariate regression #379

twiecki opened this issue May 12, 2017 · 3 comments

Comments

@twiecki
Copy link
Contributor

twiecki commented May 12, 2017

https://github.com/quantopian/pyfolio/blob/master/pyfolio/timeseries.py#L563 shows we are using separate linear regressions which is problematic because the factors are confounded.

We should instead use multivariate regression: http://stackoverflow.com/questions/19991445/run-an-ols-regression-with-pandas-data-frame

CC @jlowin

@eigenfoo
Copy link
Contributor

This is a pretty serious bug. We need to get this fixed ASAP, especially given the work that is in the pipeline from #400 (i.e. the four-factor "post-Fama-French" alpha).

@jlowin
Copy link

jlowin commented Jul 13, 2017

Indeed -- this could dramatically affect the attribution numbers that @georgh0021 is working on

@eigenfoo eigenfoo self-assigned this Jul 31, 2017
@eigenfoo
Copy link
Contributor

eigenfoo commented Jul 31, 2017

It turns out that this is not as easy as I originally thought. We don't want a multivariate regression, we want a rolling multivariate regression. Pandas used to support this sort of thing with pd.stats.ols.MovingOLS, but that has unfortunately been deprecated.

A solution is described on StackOverflow, but annoyingly that also does not work. We will need to write our own rolling multivariate regression, using a for loop... I'll open a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants