Skip to content
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

Fama-French alpha beta #182

Closed
wants to merge 28 commits into from

Conversation

sbussmann
Copy link
Contributor

Adds Fama-French benchmark to alpha and beta plots in Bayesian tear sheet.

Not currently functional. Line 106:
start = pm.find_MAP(fmin=sp.optimize.fmin_powell)

fails with the following TypeError:
TypeError: Ambiguous name: beta - please check the names of the inputs of your function for duplicates.

I might need some help to debug this one.

twiecki and others added 15 commits October 16, 2015 16:26
Posterior PDF for log(sigma) and log(nu).  Also plots the stochastic
volatility on top of the returns.
Explain the 8th and 9th rows in the Bayesian ipython notebook
demonstrating the tear sheet.

Also, a few grammatical edits to the rest of the Bayesian notebook.

Reset spy.csv
Add a line to gitignore so that new notebook checkpoints are ignored.
Time to complete each model and plot is printed as each task is
completed.
Stochastic volatility model takes as much time to run as rest of models
combined, so turn it off by default.
Use only the most recent 400 days of returns.
I wasn’t quite finished running the Bayesian IPython notebook when I
last pushed, apparently.
df_train is unchanged if the user wants to run the stochastic
volatility model.
Linear regression to obtain initial guesses for alpha and beta is
failing due to NaNs present in the benchmark data.
I think this generalization of alpha_beta to regress on multiple betas
should work, but I haven’t tested it at all yet.  Will do so in a few
hours.
Getting a TypeError when executing start =
pm.find_MAP(fmin=sp.optimize.fmin_powell).
alpha beta plot uses S&P500 by default, but users can specify
benchmark_rets=“Fama-French” to show alpha and betas for Fama-French
risk factors instead.
@sbussmann
Copy link
Contributor Author

Fama-French model can be used as a benchmark for alpha beta plots in the Bayesian tear sheet. I think this code is ready to be implemented on quantopian:master.

@@ -2,6 +2,12 @@

These are new features and improvements of note in each release.

## v0.3 (TBA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some problems with this branch not being up-to-date. Maybe redo this PR off of a clean master, or try rebasing.

@twiecki
Copy link
Contributor

twiecki commented Nov 2, 2015

Looks great @sbussmann (but see minor comments). The main issue are the git problems so you might have to start from a fresh master with this.

Linear regression to obtain initial guesses for alpha and beta is
failing due to NaNs present in the benchmark data.
I think this generalization of alpha_beta to regress on multiple betas
should work, but I haven’t tested it at all yet.  Will do so in a few
hours.
Getting a TypeError when executing start =
pm.find_MAP(fmin=sp.optimize.fmin_powell).
alpha beta plot uses S&P500 by default, but users can specify
benchmark_rets=“Fama-French” to show alpha and betas for Fama-French
risk factors instead.
…a-french-alpha-beta

Conflicts:
	pyfolio/bayesian.py
	pyfolio/examples/bayesian.ipynb
	pyfolio/tears.py
@sbussmann
Copy link
Contributor Author

I brought this branch up to date with quantopian:master and addressed the minor comments. Hope it's in good shape now!

elif benchmark_rets == 'Fama-French':
fama_french = True
rolling_window = utils.APPROX_BDAYS_PER_MONTH * 6
benchmark_rets = timeseries.rolling_fama_french(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twiecki twiecki mentioned this pull request Nov 9, 2015
@twiecki
Copy link
Contributor

twiecki commented Nov 9, 2015

Closing in favor of #200.

@twiecki twiecki closed this Nov 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants