Skip to content

Commit

Permalink
use pounders
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlujan91 committed Feb 29, 2024
1 parent e40b88f commit a5c87ca
Show file tree
Hide file tree
Showing 30 changed files with 407 additions and 369 deletions.
41 changes: 32 additions & 9 deletions code/SCF_notebook.ipynb

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions code/do_all.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Run all of the plots and tables in EstimatingMicroDSOPs.
"""Run all of the plots and tables in EstimatingMicroDSOPs.
To execute, do the following on the Python command line:
Expand Down Expand Up @@ -46,29 +45,29 @@
still run.
"""

from estimark.estimation import estimate
from estimark.options import (
all_replications,
high_resource,
low_resource,
medium_resource,
)
from estimark.estimation import estimate


# Ask the user which replication to run, and run it:
def run_replication():
which_model = input(
"""Which model would you like to run?
[1] IndShockConsumerType
2 PortfolioConsumerType
3 BequestWarmGlowConsumerType
4 BequestWarmGlowPortfolioType
5 WealthPortfolioConsumerType \n\n"""
5 WealthPortfolioConsumerType \n\n""",
)

which_replication = input(
Expand All @@ -82,19 +81,19 @@ def run_replication():
4 all: ~40 min; output: all above.
q quit: exit without executing.\n\n"""
q quit: exit without executing.\n\n""",
)

subjective_markets = input(
"""Would you like to add subjective stock or labor market beliefs to the model?:
[1] No
2 Subjective Stock Market Beliefs
3 Subjective Labor Market Beliefs
4 Both\n\n"""
4 Both\n\n""",
)

replication_specs = {}
Expand Down
36 changes: 16 additions & 20 deletions code/estimark/agents.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Demonstrates an example estimation of microeconomic dynamic stochastic optimization
"""Demonstrates an example estimation of microeconomic dynamic stochastic optimization
problem, as described in Section 9 of Chris Carroll's EstimatingMicroDSOPs.pdf notes.
The estimation attempts to match the age-conditional wealth profile of simulated
consumers to the median wealth holdings of seven age groups in the 2004 SCF by
Expand All @@ -25,8 +24,7 @@

class TempConsumerType(AgentType):
def __init__(self, cycles=1, **kwds):
"""
Make a new consumer type.
"""Make a new consumer type.
Parameters
----------
Expand All @@ -38,6 +36,7 @@ def __init__(self, cycles=1, **kwds):
Returns
-------
None
"""
# Initialize a basic AgentType
super().__init__(cycles=cycles, **kwds)
Expand All @@ -50,8 +49,7 @@ def check_restrictions(self):
return None

def simBirth(self, which_agents):
"""
Alternate method for simulating initial states for simulated agents, drawing from a finite
"""Alternate method for simulating initial states for simulated agents, drawing from a finite
distribution. Used to overwrite IndShockConsumerType.simBirth, which uses lognormal distributions.
Parameters
Expand All @@ -62,6 +60,7 @@ def simBirth(self, which_agents):
Returns
-------
None
"""
# Get and store states for newly born agents
# Take directly from pre-specified distribution
Expand All @@ -72,19 +71,16 @@ def simBirth(self, which_agents):
self.t_age[which_agents] = 0
# Which period of the cycle each agents is currently in
self.t_cycle[which_agents] = 0
return None


class IndShkLifeCycleConsumerType(TempConsumerType, IndShockConsumerType):
"""
A very lightly edited version of IndShockConsumerType. Uses an alternate method of making new
"""A very lightly edited version of IndShockConsumerType. Uses an alternate method of making new
consumers and specifies DiscFac as being age-dependent. Called "temp" because only used here.
"""


class PortfolioLifeCycleConsumerType(TempConsumerType, PortfolioConsumerType):
"""
A very lightly edited version of PortfolioConsumerType. Uses an alternate method of making new
"""A very lightly edited version of PortfolioConsumerType. Uses an alternate method of making new
consumers and specifies DiscFac as being age-dependent. Called "temp" because only used here.
"""

Expand All @@ -94,19 +90,19 @@ def post_solve(self):


class BequestWarmGlowLifeCycleConsumerType(
TempConsumerType, BequestWarmGlowConsumerType
TempConsumerType,
BequestWarmGlowConsumerType,
):
"""
A very lightly edited version of BequestWarmGlowConsumerType. Uses an alternate method of making new
"""A very lightly edited version of BequestWarmGlowConsumerType. Uses an alternate method of making new
consumers and specifies DiscFac as being age-dependent. Called "temp" because only used here.
"""


class BequestWarmGlowLifeCyclePortfolioType(
TempConsumerType, BequestWarmGlowPortfolioType
TempConsumerType,
BequestWarmGlowPortfolioType,
):
"""
A very lightly edited version of BequestWarmGlowPortfolioType. Uses an alternate method of making new
"""A very lightly edited version of BequestWarmGlowPortfolioType. Uses an alternate method of making new
consumers and specifies DiscFac as being age-dependent. Called "temp" because only used here.
"""

Expand All @@ -116,9 +112,9 @@ def post_solve(self):


class WealthPortfolioLifeCycleConsumerType(
TempConsumerType, WealthPortfolioConsumerType
TempConsumerType,
WealthPortfolioConsumerType,
):
"""
A very lightly edited version of WealthPortfolioConsumerType. Uses an alternate method of making new
"""A very lightly edited version of WealthPortfolioConsumerType. Uses an alternate method of making new
consumers and specifies DiscFac as being age-dependent. Called "temp" because only used here.
"""
Loading

0 comments on commit a5c87ca

Please sign in to comment.