-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
IndexError when solving ConsPortfolioModel #1376
Comments
The key bit is at the very bottom, pointing to line 681's use of
np.argwhere. I haven't looked at the code around it, but my guess of what's
going on there is that it's looking for the optimal portfolio share, and it
does so with the following algorithm:
0) As long as the FOCs at share=0 and share=1 don't point to a corner
solution...
1) Evaluate the FOC for share at a bunch of values between 0 and 1, and
take the sign +/-
2) We want the FOC to be zero, which happens "between" + and -
3) Look for indices where the sign of the FOC flips from + to -
4) Grab the first one of those (there should only ever be one)
It's failing because np.argwhere is returning an empty set, so trying to
grab the first element breaks. This *shouldn't* happen, because by the fact
that we got into this section of code, we have FOC > 0 at 0 and FOC < 0 at
1, so a change in sign *has to* happen somewhere. I suspect the problem is
PermGroFac = [0.0], which is an unexpected value in any of our models. It
says that between any periods t and t+1, permanent income should be
multiplied by zero: the agent earns labor income in one period and one
period only. That means that projecting next period's mNrmNext = Rfree *
aNrmNow / (PermGroFac * PermShk) = inf everywhere. That's problematic and
will cause unexpected behavior.
…On Thu, Feb 1, 2024 at 11:03 AM Sebastian Benthall ***@***.***> wrote:
Trying to solve SequentialPortfolioConsumerType with the following
parameters changed from the default:
CRRA=6.0,
DiscFac=0.9,
RiskyAvg=1.08,
RiskyStd=0.20,
PermShkStd=[0.1],
PermGroFac=[0.00],
UnempPrb=0.01
agent = SequentialPortfolioConsumerType(**agent_parameters)
agent.solve()
Results in this rather ugly and uninformative error:
https://gist.github.com/sbenthall/efc4e2610b2a2fe6590d12abf49b78b4
Looks like there's no well-defined optimal share value?
There probably should be a better error message for this.
—
Reply to this email directly, view it on GitHub
<#1376>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADKRAFOAUEWJYTU36RUKMFLYRO4FFAVCNFSM6AAAAABCVFHAQCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYTEOBWG4YDKNI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Oh, the problem is On the other hand, I put that value in by mistake while playing around with things, and discovering the problem would have been easier with a more informative error. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to solve SequentialPortfolioConsumerType with the following parameters changed from the default:
Results in this rather ugly and uninformative error:
https://gist.github.com/sbenthall/efc4e2610b2a2fe6590d12abf49b78b4
Looks like there's no well-defined optimal share value?
There probably should be a better error message for this.
The text was updated successfully, but these errors were encountered: