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

perfect foresight model data #1347

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Release Date: TBD
- Fixes bug in the calc_jacobian method. [#1342](https://github.com/econ-ark/HARK/pull/1342)
- Fixes bug that prevented risky-asset consumer types from working with time-varying interest rates `Rfree`. [1343](https://github.com/econ-ark/HARK/pull/1343)
- Overhauls and expands condition checking for the ConsIndShock model [#1294](https://github.com/econ-ark/HARK/pull/1294). Condition values and a description of their interpretation is stored in the bilt dictionary of IndShockConsumerType.
- Creates a `models/` directory with Python model configurations for perfect foresight and Fisher 2-period models. [1347](https://github.com/econ-ark/HARK/pull/1347)

### 0.13.0

Expand Down
11 changes: 11 additions & 0 deletions HARK/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
Tools for crafting models.
"""

class Control:

Check warning on line 5 in HARK/model.py

View check run for this annotation

Codecov / codecov/patch

HARK/model.py#L5

Added line #L5 was not covered by tests
"""
Should go in different model support module.
"""

def __init__(self, args):
pass

Check warning on line 11 in HARK/model.py

View check run for this annotation

Codecov / codecov/patch

HARK/model.py#L10-L11

Added lines #L10 - L11 were not covered by tests
30 changes: 30 additions & 0 deletions HARK/models/fisher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
A model file for a Fisher 2-period consumption problem.
"""

from HARK.distribution import Bernoulli
from HARK.model import Control

# This way of distributing parameters across the scope is clunky
# Can be handled better if parsed from a YAML file, probably
# But it would be better to have a more graceful Python version as well.
CRRA = 2.0,

model = {
'shocks' : {},
'parameters' : {
'DiscFac' : 0.96,
'CRRA' : CRRA,
'Rfree' : 1.03,
'y' : [1.0, 1.0],
'BoroCnstArt' : None,
},
'dynamics' : {
'm' : lambda Rfree, a, y : Rfree * a + y,
'c' : Control(['m']),
'a' : lambda m, c : m - c
},
'reward' : {
'u' : lambda c : c ** (1 - CRRA) / (1 - CRRA)
}
}
32 changes: 32 additions & 0 deletions HARK/models/perfect_foresight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from HARK.distribution import Bernoulli
from HARK.model import Control

# This way of distributing parameters across the scope is clunky
# Can be handled better if parsed from a YAML file, probably
# But it would be better to have a more graceful Python version as well.
CRRA = 2.0,
LivPrb = 0.98

model = {
'shocks' : {
'live' : Bernoulli(p=LivPrb),
},
'parameters' : {
'DiscFac' : 0.96,
'CRRA' : CRRA,
'Rfree' : 1.03,
'LivPrb' : LivPrb,
'PermGroFac' : 1.01,
'BoroCnstArt' : None,
},
'dynamics' : {
'm' : lambda Rfree, a, y : Rfree * a + y,
'c' : Control(['m']),
'y' : lambda p : p,
'p' : lambda PermGroFac, p: PermGroFac * p,
'a' : lambda m, c : m - c
},
'reward' : {
'u' : lambda c : c ** (1 - CRRA) / (1 - CRRA)
}
}