two fund rf fix - #139
Merged
Merged
two fund rf fix#139
Conversation
The tangent portfolio depends on the risk-free rate, but the two-fund
section defined it as V^-1 mu / b (the r_f = 0 case) while the one-fund
section defined it as V^-1 (mu - r_f 1) / (b - a r_f). Same symbol, two
different portfolios, and the mixing coefficient psi = a (c - b r*) / d
was only correct for the first.
Mixing w_tan(r_f) with that psi returns weights that sum to one and lie
on the frontier, so the obvious checks pass, but at the return
r* + (r* - r_min) (r_f - r_f') / (r_min - r_f)
rather than at r*. The error vanishes at r* = r_min and diverges as
r_f -> r_min. The TODO this replaces prescribed exactly that recipe.
Everything is now written for general r_f: w_tan(r_f), r_tan, sigma_tan,
and psi(r_f), with the r_f terms shown cancelling in the closed form for
w*, which is the form to implement.
Also fixes sigma_tan^2 in the one-fund section, where the middle
expression had a plain Euclidean norm over a quadratic form and did not
equal the right-hand side it was set equal to.
Verified numerically: psi(r_f) reproduces the target return for every
r_f, and the mismatch error matches the expression above exactly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HbjLTzvQcA82ZiV9eFR5TF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subset of the fixes from this PR:
that one may be abandoned because it has some unfocused discussion added by Claude.