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

vFunc and vPPfunc are sometimes Null Functions #1452

Closed
DominicWC opened this issue Jun 10, 2024 · 6 comments
Closed

vFunc and vPPfunc are sometimes Null Functions #1452

DominicWC opened this issue Jun 10, 2024 · 6 comments

Comments

@DominicWC
Copy link
Collaborator

Describe the bug
If PerfForesightConsumerType or IndShockConsumerType are solved, their solution contains a function 'vPPfunc' with the type HARK.utilities.NullFunc. This function can't be plotted. This is likely an issue in several other models.

For IndShockConsumerType specifically, vFunc is also a Null Function.

To Reproduce

from HARK.ConsumptionSaving.ConsIndShockModel import IndShockConsumerType
from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType
agenta=IndShockConsumerType()
#agenta.cycles=0 #optional, these are here to show that whether the solution is a finite or infinite horizon doesn't matter
agenta.solve()
agentb=PerfForesightConsumerType()
#agentb.cycles=0 #optional, these are here to show that whether the solution is a finite or infinite horizon doesn't matter
agentb.solve()
print(agenta.solution[0].vFunc)
print(agenta.solution[0].vPPfunc)
print(agentb.solution[0].vPPfunc)
  • OS: Windows 10
  • Econ-ARK and Python: version 0.15.0, python 3.11 and 3.12
@DominicWC DominicWC changed the title vFunc and vPPfunc are sometimes Null Function vFunc and vPPfunc are sometimes Null Functions Jun 10, 2024
@alanlujan91
Copy link
Member

vFunc requires vFuncBool = True and vPPfunc requires CubicBool = True

@DominicWC
Copy link
Collaborator Author

DominicWC commented Jun 11, 2024

That fixes the IndShockConsumerType. The PerfForesightConsumerType is still returning a null function for vPPfunc though.

@mnwhite
Copy link
Contributor

mnwhite commented Jun 11, 2024 via email

@alanlujan91
Copy link
Member

@mnwhite should it throw an AttributeError then? "You tried to set an attribute that is not applicable to this setting."

@mnwhite
Copy link
Contributor

mnwhite commented Jun 11, 2024 via email

@DominicWC
Copy link
Collaborator Author

It seems like this is working as intended. I'll stick something about this in the documentation.

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

No branches or pull requests

3 participants