Skip to content

Commit

Permalink
Merge pull request #1347 from sbenthall/i1346
Browse files Browse the repository at this point in the history
perfect foresight model data
  • Loading branch information
sbenthall authored Sep 27, 2023
2 parents da30b24 + 2744310 commit 3ec3404
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
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:
"""
Should go in different model support module.
"""

def __init__(self, args):
pass
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)
}
}

0 comments on commit 3ec3404

Please sign in to comment.