Skip to content

Commit

Permalink
Merge pull request #908 from sbenthall/i842
Browse files Browse the repository at this point in the history
moves constructor documentation from __init__ to class string, see #842
  • Loading branch information
sbenthall authored Jan 14, 2021
2 parents 98da4de + 41b8522 commit decc281
Show file tree
Hide file tree
Showing 13 changed files with 911 additions and 1,322 deletions.
1 change: 1 addition & 0 deletions Documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Release Data: TBD
* Centralizes the definition of value, marginal value, and marginal marginal value functions that use inverse-space
interpolation for problems with CRRA utility. See [#888](https://github.com/econ-ark/HARK/pull/888).
* MarkovProcess class (#902)[https://github.com/econ-ark/HARK/pull/902]
* Corrects location of constructor documentation to class string for Sphinx rendering (#908)[https://github.com/econ-ark/HARK/pull/908]

#### Minor Changes

Expand Down
156 changes: 55 additions & 101 deletions HARK/ConsumptionSaving/ConsAggShockModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,28 +1791,20 @@ class CobbDouglasEconomy(Market):
Note: The current implementation assumes a constant labor supply, but
this will be generalized in the future.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
"""

def __init__(self, agents=None, tolerance=0.0001, act_T=1200, **kwds):
"""
Make a new instance of CobbDouglasEconomy by filling in attributes
specific to this kind of market.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
Returns
-------
None
"""
agents = agents if agents is not None else list()
params = init_cobb_douglas.copy()
params["sow_vars"] = [
Expand Down Expand Up @@ -2120,27 +2112,20 @@ class SmallOpenEconomy(Market):
A class for representing a small open economy, where the wage rate and interest rate are
exogenously determined by some "global" rate. However, the economy is still subject to
aggregate productivity shocks.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
"""

def __init__(self, agents=None, tolerance=0.0001, act_T=1000, **kwds):
"""
Make a new instance of SmallOpenEconomy by filling in attributes specific to this kind of market.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
Returns
-------
None
"""
agents = agents if agents is not None else list()
Market.__init__(
self,
Expand Down Expand Up @@ -2343,6 +2328,16 @@ class CobbDouglasMarkovEconomy(CobbDouglasEconomy):
state for the "macroeconomy", so that the shock distribution and aggregate
productivity growth factor can vary over time.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
"""

def __init__(
Expand All @@ -2362,25 +2357,6 @@ def __init__(
],
**kwds
):
"""
Make a new instance of CobbDouglasMarkovEconomy by filling in attributes
specific to this kind of market.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
Returns
-------
None
"""
agents = agents if agents is not None else list()
params = init_mrkv_cobb_douglas.copy()
params.update(kwds)
Expand Down Expand Up @@ -2789,28 +2765,20 @@ class KrusellSmithEconomy(Market):
This model replicates the one presented in the JPE article "Income and Wealth
Heterogeneity in the Macroeconomy", with its default parameters set to match
those in the paper.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
"""

def __init__(self, agents=None, tolerance=0.0001, **kwds):
"""
Make a new instance of KrusellSmithEconomy by filling in attributes
specific to this kind of market.
Parameters
----------
agents : [ConsumerType]
List of types of consumers that live in this economy.
tolerance: float
Minimum acceptable distance between "dynamic rules" to consider the
solution process converged. Distance depends on intercept and slope
of the log-linear "next capital ratio" function.
act_T : int
Number of periods to simulate when making a history of of the market.
Returns
-------
None
"""
agents = agents if agents is not None else list()
params = deepcopy(init_KS_economy)
params.update(kwds)
Expand Down Expand Up @@ -3106,23 +3074,16 @@ class AggregateSavingRule(HARKobject):
"""
A class to represent agent beliefs about aggregate saving at the end of this period (AaggNow) as
a function of (normalized) aggregate market resources at the beginning of the period (MaggNow).
Parameters
----------
intercept : float
Intercept of the log-linear capital evolution rule.
slope : float
Slope of the log-linear capital evolution rule.
"""

def __init__(self, intercept, slope):
"""
Make a new instance of CapitalEvoRule.
Parameters
----------
intercept : float
Intercept of the log-linear capital evolution rule.
slope : float
Slope of the log-linear capital evolution rule.
Returns
-------
new instance of CapitalEvoRule
"""
self.intercept = intercept
self.slope = slope
self.distance_criteria = ["slope", "intercept"]
Expand All @@ -3147,20 +3108,13 @@ def __call__(self, Mnow):
class AggShocksDynamicRule(HARKobject):
"""
Just a container class for passing the dynamic rule in the aggregate shocks model to agents.
Parameters
----------
AFunc : CapitalEvoRule
Aggregate savings as a function of aggregate market resources.
"""

def __init__(self, AFunc):
"""
Make a new instance of CapDynamicRule.
Parameters
----------
AFunc : CapitalEvoRule
Aggregate savings as a function of aggregate market resources.
Returns
-------
None
"""
self.AFunc = AFunc
self.distance_criteria = ["AFunc"]
Loading

0 comments on commit decc281

Please sign in to comment.