# ConsIndShockModel¶

Classes to solve canonical consumption-saving models with idiosyncratic shocks to income. All models here assume CRRA utility with geometric discounting, no bequest motive, and income shocks that are fully transitory or fully permanent.

It currently solves three types of models:
1. A very basic “perfect foresight” consumption-savings model with no uncertainty.
2. A consumption-savings model with risk over transitory and permanent income shocks.
3. The model described in (2), with an interest rate for debt that differs from the interest rate for savings.

See NARK https://HARK.githhub.io/Documentation/NARK for information on variable naming conventions. See HARK documentation for mathematical descriptions of the models being solved.

class HARK.ConsumptionSaving.ConsIndShockModel.ConsumerSolution(cFunc=None, vFunc=None, vPfunc=None, vPPfunc=None, mNrmMin=None, hNrm=None, MPCmin=None, MPCmax=None)

A class representing the solution of a single period of a consumption-saving problem. The solution must include a consumption function and marginal value function.

Here and elsewhere in the code, Nrm indicates that variables are normalized by permanent income.

Parameters: cFunc (function) – The consumption function for this period, defined over market resources: c = cFunc(m). vFunc (function) – The beginning-of-period value function for this period, defined over market resources: v = vFunc(m). vPfunc (function) – The beginning-of-period marginal value function for this period, defined over market resources: vP = vPfunc(m). vPPfunc (function) – The beginning-of-period marginal marginal value function for this period, defined over market resources: vPP = vPPfunc(m). mNrmMin (float) – The minimum allowable market resources for this period; the consump- tion function (etc) are undefined for m < mNrmMin. hNrm (float) – Human wealth after receiving income this period: PDV of all future income, ignoring mortality. MPCmin (float) – Infimum of the marginal propensity to consume this period. MPC –> MPCmin as m –> infinity. MPCmax (float) – Supremum of the marginal propensity to consume this period. MPC –> MPCmax as m –> mNrmMin.
append_solution(new_solution)

Appends one solution to another to create a ConsumerSolution whose attributes are lists. Used in ConsMarkovModel, where we append solutions conditional on a particular value of a Markov state to each other in order to get the entire solution.

Parameters: new_solution (ConsumerSolution) – The solution to a consumption-saving problem; each attribute is a list representing state-conditional values or functions. None
distance_criteria = ['vPfunc']
class HARK.ConsumptionSaving.ConsIndShockModel.ConsPerfForesightSolver(solution_next, DiscFac, LivPrb, CRRA, Rfree, PermGroFac, BoroCnstArt, MaxKinks)

A class for solving a one period perfect foresight consumption-saving problem. An instance of this class is created by the function solvePerfForesight in each period.

Parameters: solution_next (ConsumerSolution) – The solution to next period’s one-period problem. DiscFac (float) – Intertemporal discount factor for future utility. LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the next period. CRRA (float) – Coefficient of relative risk aversion. Rfree (float) – Risk free interest factor on end-of-period assets. PermGroFac (float) – Expected permanent income growth factor at the end of this period. BoroCnstArt (float or None) – Artificial borrowing constraint, as a multiple of permanent income. Can be None, indicating no artificial constraint. MaxKinks (int) – Maximum number of kink points to allow in the consumption function; additional points will be thrown out. Only relevant in infinite horizon model with artificial borrowing constraint.
add_mNrmStE(solution)

Finds market resources ratio at which ‘balanced growth’ is expected. This is the m ratio such that the expected growth rate of the M level matches the expected growth rate of permanent income. This value does not exist if the Growth Impatience Condition does not hold.

https://econ-ark.github.io/BufferStockTheory#Unique-Stable-Points

Parameters: solution (ConsumerSolution) – Solution to this period’s problem, which must have attribute cFunc. solution – Same solution that was passed, but now with the attribute mNrmStE ConsumerSolution
add_mNrmTrg(solution)

Finds value of (normalized) market resources m at which individual consumer expects m not to change. This will exist if the GICNrm holds.

https://econ-ark.github.io/BufferStockTheory#UniqueStablePoints

Parameters: solution (ConsumerSolution) – Solution to this period’s problem, which must have attribute cFunc. solution – Same solution that was passed, but now with the attribute mNrmStE. ConsumerSolution
add_stable_points(solution)

Checks necessary conditions for the existence of the individual steady state and target levels of market resources (see above). If the conditions are satisfied, computes and adds the stable points to the solution.

Parameters: solution (ConsumerSolution) – Solution to this period’s problem, which must have attribute cFunc. solution – Same solution that was provided, augmented with attributes mNrmStE and mNrmTrg, if they exist. ConsumerSolution
def_utility_funcs()

Defines CRRA utility function for this period (and its derivatives), saving them as attributes of self for other methods to use.

Parameters: None – None
def_value_funcs()
Defines the value and marginal value functions for this period. Uses the fact that for a perfect foresight CRRA utility problem, if the MPC in period t is $$\kappa_{t}$$, and relative risk aversion :math:
ho, then the inverse value vFuncNvrs has a
constant slope of :math:kappa_{t}^{-

ho/(1- ho)} and

vFuncNvrs has value of zero at the lower bound of market resources mNrmMin. See PerfForesightConsumerType.ipynb documentation notebook for a brief explanation and the links below for a fuller treatment.

None

None

make_cFunc_PF()

Makes the (linear) consumption function for this period.

Parameters: None – None
solve()

Solves the one period perfect foresight consumption-saving problem.

Parameters: None – solution – The solution to this period’s problem. ConsumerSolution
class HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSetup(solution_next, IncShkDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

A superclass for solvers of one period consumption-saving problems with constant relative risk aversion utility and permanent and transitory shocks to income. Has methods to set up but not solve the one period problem.

Parameters: solution_next (ConsumerSolution) – The solution to next period’s one period problem. IncShkDstn (distribution.Distribution) – A discrete approximation to the income process between the period being solved and the one immediately following (in solution_next). LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period. DiscFac (float) – Intertemporal discount factor for future utility. CRRA (float) – Coefficient of relative risk aversion. Rfree (float) – Risk free interest factor on end-of-period assets. PermGroFac (float) – Expected permanent income growth factor at the end of this period. BoroCnstArt (float or None) – Borrowing constraint for the minimum allowable assets to end the period with. If it is less than the natural borrowing constraint, then it is irrelevant; BoroCnstArt=None indicates no artificial bor- rowing constraint. aXtraGrid (np.array) – Array of “extra” end-of-period asset values– assets above the absolute minimum acceptable level. vFuncBool (boolean) – An indicator for whether the value function should be computed and included in the reported solution. CubicBool (boolean) – An indicator for whether the solver should use cubic or linear inter- polation.
def_BoroCnst(BoroCnstArt)

Defines the constrained portion of the consumption function as cFuncNowCnst, an attribute of self. Uses the artificial and natural borrowing constraints.

Parameters: BoroCnstArt (float or None) – Borrowing constraint for the minimum allowable assets to end the period with. If it is less than the natural borrowing constraint, then it is irrelevant; BoroCnstArt=None indicates no artificial bor- rowing constraint. none
def_utility_funcs()

Defines CRRA utility function for this period (and its derivatives, and their inverses), saving them as attributes of self for other methods to use.

Parameters: none – none
prepare_to_solve()

Perform preparatory work before calculating the unconstrained consumption function.

Parameters: none – none
set_and_update_values(solution_next, IncShkDstn, LivPrb, DiscFac)

Unpacks some of the inputs (and calculates simple objects based on them), storing the results in self for use by other methods. These include: income shocks and probabilities, next period’s marginal value function (etc), the probability of getting the worst income shock next period, the patience factor, human wealth, and the bounding MPCs.

Parameters: solution_next (ConsumerSolution) – The solution to next period’s one period problem. IncShkDstn (distribution.DiscreteDistribution) – A DiscreteDistribution with a pmf and two point value arrays in X, order: permanent shocks, transitory shocks. LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period. DiscFac (float) – Intertemporal discount factor for future utility. None
class HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolverBasic(solution_next, IncShkDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

This class solves a single period of a standard consumption-saving problem, using linear interpolation and without the ability to calculate the value function. ConsIndShockSolver inherits from this class and adds the ability to perform cubic interpolation and to calculate the value function.

Note that this class does not have its own initializing method. It initial- izes the same problem in the same way as ConsIndShockSetup, from which it inherits.

add_MPC_and_human_wealth(solution)

Take a solution and add human wealth and the bounding MPCs to it.

Parameters: solution (ConsumerSolution) – The solution to this period’s consumption-saving problem. Returns – ---------- – solution – The solution to this period’s consumption-saving problem, but now with human wealth and the bounding MPCs.
add_stable_points(solution)

Checks necessary conditions for the existence of the individual steady state and target levels of market resources (see above). If the conditions are satisfied, computes and adds the stable points to the solution.

Parameters: solution (ConsumerSolution) – Solution to this period’s problem, which must have attribute cFunc. solution – Same solution that was passed, but now with attributes mNrmStE and mNrmTrg, if they exist. ConsumerSolution
calc_EndOfPrdvP()

Calculate end-of-period marginal value of assets at each point in aNrmNow. Does so by taking a weighted sum of next period marginal values across income shocks (in a preconstructed grid self.mNrmNext).

Parameters: none – EndOfPrdvP – A 1D array of end-of-period marginal value of assets np.array
get_points_for_interpolation(EndOfPrdvP, aNrmNow)

Finds interpolation points (c,m) for the consumption function.

Parameters: EndOfPrdvP (np.array) – Array of end-of-period marginal values. aNrmNow (np.array) – Array of end-of-period asset values that yield the marginal values in EndOfPrdvP. c_for_interpolation (np.array) – Consumption points for interpolation. m_for_interpolation (np.array) – Corresponding market resource points for interpolation.
m_nrm_next(shocks, a_nrm)

Computes normalized market resources of the next period from income shocks and current normalized market resources.

Parameters: shocks ([float]) – Permanent and transitory income shock levels. a_nrm (float) – Normalized market assets this period normalized market resources in the next period float
make_basic_solution(EndOfPrdvP, aNrm, interpolator)

Given end of period assets and end of period marginal value, construct the basic solution for this period.

Parameters: EndOfPrdvP (np.array) – Array of end-of-period marginal values. aNrm (np.array) – Array of end-of-period asset values that yield the marginal values in EndOfPrdvP. interpolator (function) – A function that constructs and returns a consumption function. solution_now – The solution to this period’s consumption-saving problem, with a consumption function, marginal value function, and minimum m. ConsumerSolution
make_linear_cFunc(mNrm, cNrm)

Makes a linear interpolation to represent the (unconstrained) consumption function.

Parameters: mNrm (np.array) – Corresponding market resource points for interpolation. cNrm (np.array) – Consumption points for interpolation. cFuncUnc – The unconstrained consumption function for this period. LinearInterp
prepare_to_calc_EndOfPrdvP()

Prepare to calculate end-of-period marginal value by creating an array of market resources that the agent could have next period, considering the grid of end-of-period assets and the distribution of shocks he might experience next period.

Parameters: none – aNrmNow – A 1D array of end-of-period assets; also stored as attribute of self. np.array
solve()

Solves a one period consumption saving problem with risky income.

Parameters: None – solution – The solution to the one period problem. ConsumerSolution
use_points_for_interpolation(cNrm, mNrm, interpolator)

Constructs a basic solution for this period, including the consumption function and marginal value function.

Parameters: cNrm (np.array) – (Normalized) consumption points for interpolation. mNrm (np.array) – (Normalized) corresponding market resource points for interpolation. interpolator (function) – A function that constructs and returns a consumption function. solution_now – The solution to this period’s consumption-saving problem, with a consumption function, marginal value function, and minimum m. ConsumerSolution
class HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolver(solution_next, IncShkDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

This class solves a single period of a standard consumption-saving problem. It inherits from ConsIndShockSolverBasic, adding the ability to perform cubic interpolation and to calculate the value function.

add_vFunc(solution, EndOfPrdvP)

Creates the value function for this period and adds it to the solution.

Parameters: solution (ConsumerSolution) – The solution to this single period problem, likely including the consumption function, marginal value function, etc. EndOfPrdvP (np.array) – Array of end-of-period marginal value of assets corresponding to the asset values in self.aNrmNow. solution – The single period solution passed as an input, but now with the value function (defined over market resources m) as an attribute. ConsumerSolution
add_vPPfunc(solution)

Adds the marginal marginal value function to an existing solution, so that the next solver can evaluate vPP and thus use cubic interpolation.

Parameters: solution (ConsumerSolution) – The solution to this single period problem, which must include the consumption function. solution – The same solution passed as input, but with the marginal marginal value function for this period added as the attribute vPPfunc. ConsumerSolution
make_EndOfPrdvFunc(EndOfPrdvP)

Construct the end-of-period value function for this period, storing it as an attribute of self for use by other methods.

Parameters: EndOfPrdvP (np.array) – Array of end-of-period marginal value of assets corresponding to the asset values in self.aNrmNow. none
make_cubic_cFunc(mNrm, cNrm)

Makes a cubic spline interpolation of the unconstrained consumption function for this period.

Parameters: mNrm (np.array) – Corresponding market resource points for interpolation. cNrm (np.array) – Consumption points for interpolation. cFuncUnc – The unconstrained consumption function for this period. CubicInterp
make_vFunc(solution)

Creates the value function for this period, defined over market resources m. self must have the attribute EndOfPrdvFunc in order to execute.

Parameters: solution (ConsumerSolution) – The solution to this single period problem, which must include the consumption function. vFuncNow – A representation of the value function for this period, defined over normalized market resources m: v = vFuncNow(m). ValueFuncCRRA
solve()

Solves the single period consumption-saving problem using the method of endogenous gridpoints. Solution includes a consumption function cFunc (using cubic or linear splines), a marginal value function vPfunc, a min- imum acceptable level of normalized market resources mNrmMin, normalized human wealth hNrm, and bounding MPCs MPCmin and MPCmax. It might also have a value function vFunc and marginal marginal value function vPPfunc.

Parameters: none – solution – The solution to the single period consumption-saving problem. ConsumerSolution
class HARK.ConsumptionSaving.ConsIndShockModel.ConsKinkedRsolver(solution_next, IncShkDstn, LivPrb, DiscFac, CRRA, Rboro, Rsave, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

A class to solve a single period consumption-saving problem where the interest rate on debt differs from the interest rate on savings. Inherits from ConsIndShockSolver, with nearly identical inputs and outputs. The key diff- erence is that Rfree is replaced by Rsave (a>0) and Rboro (a<0). The solver can handle Rboro == Rsave, which makes it identical to ConsIndShocksolver, but it terminates immediately if Rboro < Rsave, as this has a different solution.

Parameters: solution_next (ConsumerSolution) – The solution to next period’s one period problem. IncShkDstn (distribution.Distribution) – A discrete approximation to the income process between the period being solved and the one immediately following (in solution_next). LivPrb (float) – Survival probability; likelihood of being alive at the beginning of the succeeding period. DiscFac (float) – Intertemporal discount factor for future utility. CRRA (float) – Coefficient of relative risk aversion. Rboro (float) – Interest factor on assets between this period and the succeeding period when assets are negative. Rsave (float) – Interest factor on assets between this period and the succeeding period when assets are positive. PermGroFac (float) – Expected permanent income growth factor at the end of this period. BoroCnstArt (float or None) – Borrowing constraint for the minimum allowable assets to end the period with. If it is less than the natural borrowing constraint, then it is irrelevant; BoroCnstArt=None indicates no artificial bor- rowing constraint. aXtraGrid (np.array) – Array of “extra” end-of-period asset values– assets above the absolute minimum acceptable level. vFuncBool (boolean) – An indicator for whether the value function should be computed and included in the reported solution. CubicBool (boolean) – An indicator for whether the solver should use cubic or linear inter- polation.
add_stable_points(solution)

TODO: Placeholder method for a possible future implementation of stable points in the kinked R model. For now it simply serves to override ConsIndShock’s method, which does not apply here given the multiple interest rates.

Discusson: - The target and steady state should exist under the same conditions

as in ConsIndShock.
• The ConsIndShock code as it stands can not be directly applied because it assumes that R is a constant, and in this model R depends on the level of wealth.
• After allowing for wealth-depending interest rates, the existing

code might work without modification to add the stable points. If not, it should be possible to find these values by checking within three distinct intervals:

• From h_min to the lower kink.
• From the lower kink to the upper kink
• From the upper kink to infinity.

the stable points must be in one of these regions.

make_cubic_cFunc(mNrm, cNrm)

Makes a cubic spline interpolation that contains the kink of the unconstrained consumption function for this period.

Parameters: mNrm (np.array) – Corresponding market resource points for interpolation. cNrm (np.array) – Consumption points for interpolation. cFuncUnc – The unconstrained consumption function for this period. CubicInterp
prepare_to_calc_EndOfPrdvP()

Prepare to calculate end-of-period marginal value by creating an array of market resources that the agent could have next period, considering the grid of end-of-period assets and the distribution of shocks he might experience next period. This differs from the baseline case because different savings choices yield different interest rates.

Parameters: none – aNrmNow – A 1D array of end-of-period assets; also stored as attribute of self. np.array
class HARK.ConsumptionSaving.ConsIndShockModel.PerfForesightConsumerType(verbose=1, quiet=False, **kwds)

A perfect foresight consumer type who has no uncertainty other than mortality. His problem is defined by a coefficient of relative risk aversion, intertemporal discount factor, interest factor, an artificial borrowing constraint (maybe) and time sequences of the permanent income growth rate and survival probability.

cFunc_terminal_ = <HARK.interpolation.LinearInterp object>
check_AIC(verbose=None)

Evaluate and report on the Absolute Impatience Condition

check_FHWC(verbose=None)

Evaluate and report on the Finite Human Wealth Condition

check_GICRaw(verbose=None)

Evaluate and report on the Growth Impatience Condition for the Perfect Foresight model

check_RIC(verbose=None)

Evaluate and report on the Return Impatience Condition

check_condition(name, test, messages, verbose, verbose_messages=None)

Checks one condition.

Parameters: name (string) – Name for the condition. test (function(self -> boolean)) – A function (of self) which tests the condition messages (dict{boolean : string}) – A dictiomary with boolean keys containing values for messages to print if the condition is true or false. verbose_messages (dict{boolean : string}) – (Optional) A dictiomary with boolean keys containing values for messages to print if the condition is true or false under verbose printing.
check_conditions(verbose=None)

This method checks whether the instance’s type satisfies the Absolute Impatience Condition (AIC), the Return Impatience Condition (RIC), the Finite Human Wealth Condition (FHWC), the perfect foresight model’s Growth Impatience Condition (GICRaw) and Perfect Foresight Finite Value of Autarky Condition (FVACPF). Depending on the configuration of parameter values, some combination of these conditions must be satisfied in order for the problem to have a nondegenerate solution. To check which conditions are required, in the verbose mode a reference to the relevant theoretical literature is made.

Parameters: verbose (boolean) – Specifies different levels of verbosity of feedback. When False, it only reports whether the instance’s type fails to satisfy a particular condition. When True, it reports all results, i.e. the factor values for all conditions. None
check_restrictions()

A method to check that various restrictions are met for the model class.

get_Rfree()

Returns an array of size self.AgentCount with self.Rfree in every entry.

Parameters: None – RfreeNow – Array of size self.AgentCount with risk free interest rate for each agent. np.array
get_controls()

Calculates consumption for each consumer of this type using the consumption functions.

Parameters: None – None
get_poststates()

Calculates end-of-period assets for each consumer of this type.

Parameters: None – None
get_shocks()

Finds permanent and transitory income “shocks” for each agent this period. As this is a perfect foresight model, there are no stochastic shocks: PermShkNow = PermGroFac for each agent (according to their t_cycle) and TranShkNow = 1.0 for all agents.

Parameters: None – None
initialize_sim()

Prepares this AgentType for a new simulation. Resets the internal random number generator, makes initial states for all agents (using sim_birth), clears histories of tracked variables.

Parameters: None – None
pre_solve()

A method that is run immediately before the model is solved, to check inputs or to prepare the terminal solution, perhaps.

Parameters: none – none
shock_vars_ = []
sim_birth(which_agents)

Makes new consumers for the given indices. Initialized variables include aNrm and pLvl, as well as time variables t_age and t_cycle. Normalized assets and permanent income levels are drawn from lognormal distributions given by aNrmInitMean and aNrmInitStd (etc).

Parameters: which_agents (np.array(Bool)) – Boolean array of size self.AgentCount indicating which agents should be “born”. None
sim_death()

Determines which agents die this period and must be replaced. Uses the sequence in LivPrb to determine survival probabilities for each agent.

Parameters: None – which_agents – Boolean array of size AgentCount indicating which agents die. np.array(bool)
solution_terminal_ = <HARK.ConsumptionSaving.ConsIndShockModel.ConsumerSolution object>
state_vars = ['pLvl', 'PlvlAgg', 'bNrm', 'mNrm', 'aNrm', 'aLvl']
time_inv_ = ['CRRA', 'DiscFac', 'MaxKinks', 'BoroCnstArt']
time_vary_ = ['LivPrb', 'PermGroFac']
transition()
Parameters: None – to match dolo spec ([Eventually,) – endogenous_prev, controls, exogenous, parameters] (exogenous_prev,) – endogenous_state – Tuple with new values of the endogenous states ()
unpack_cFunc()

DEPRECATED: Use solution.unpack(‘cFunc’) instead. “Unpacks” the consumption functions into their own field for easier access. After the model has been solved, the consumption functions reside in the attribute cFunc of each element of ConsumerType.solution. This method creates a (time varying) attribute cFunc that contains a list of consumption functions. :param none:

Returns: none
update_Rfree()

Determines whether Rfree is time-varying or fixed.

Parameters: None – None
update_solution_terminal()

Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes.

Parameters: none – none
vFunc_terminal_ = <HARK.interpolation.LinearInterp object>
class HARK.ConsumptionSaving.ConsIndShockModel.IndShockConsumerType(verbose=1, quiet=False, **kwds)

A consumer type with idiosyncratic shocks to permanent and transitory income. His problem is defined by a sequence of income distributions, survival prob- abilities, and permanent income growth rates, as well as time invariant values for risk aversion, discount factor, the interest rate, the grid of end-of- period assets, and an artificial borrowing constraint.

Parameters: cycles (int) – Number of times the sequence of periods should be solved.
Ex_Mtp1_over_Ex_Ptp1(mNrm)
Ex_mtp1(mNrm)
calc_bounding_values()

Calculate human wealth plus minimum and maximum MPC in an infinite horizon model with only one period repeated indefinitely. Store results as attributes of self. Human wealth is the present discounted value of expected future income after receiving income this period, ignoring mort- ality (because your income matters to you only if you are still alive). The maximum MPC is the limit of the MPC as m –> mNrmMin. The minimum MPC is the limit of the MPC as m –> infty.

Parameters: None – None
calc_stable_points()

If the problem is one that satisfies the conditions required for target ratios of different variables to permanent income to exist, and has been solved to within the self-defined tolerance, this method calculates the target values of market resources, consumption, and assets.

Parameters: None – None
check_FVAC(verbose=None)

Evaluate and report on the Finite Value of Autarky Condition Hyperlink to paper: [url]/#Autarky-Value

check_GICAggLivPrb(verbose=None)
check_GICNrm(verbose=None)

Check Individual Growth Patience Factor.

check_WRIC(verbose=None)

Evaluate and report on the Weak Return Impatience Condition [url]/#WRPF modified to incorporate LivPrb

check_conditions(verbose=None)

This method checks whether the instance’s type satisfies the Absolute Impatience Condition (AIC), Weak Return Impatience Condition (WRIC), Finite Human Wealth Condition (FHWC) and Finite Value of Autarky Condition (FVAC). When combinations of these conditions are satisfied, the solution to the problem exhibits different characteristics. (For an exposition of the conditions, see https://econ-ark.github.io/BufferStockTheory/)

Parameters: verbose (boolean) – Specifies different levels of verbosity of feedback. When False, it only reports whether the instance’s type fails to satisfy a particular condition. When True, it reports all results, i.e. the factor values for all conditions. None
construct_lognormal_income_process_unemployment()

Generates a list of discrete approximations to the income process for each life period, from end of life to beginning of life. Permanent shocks are mean one lognormally distributed with standard deviation PermShkStd[t] during the working life, and degenerate at 1 in the retirement period. Transitory shocks are mean one lognormally distributed with a point mass at IncUnemp with probability UnempPrb while working; they are mean one with a point mass at IncUnempRet with probability UnempPrbRet. Retirement occurs after t=T_retire periods of working.

Note 1: All time in this function runs forward, from t=0 to t=T

Note 2: All parameters are passed as attributes of the input parameters.

PermShkStd : [float]
List of standard deviations in log permanent income uncertainty during the agent’s life.
PermShkCount : int
The number of approximation points to be used in the discrete approxima- tion to the permanent income shock distribution.
TranShkStd : [float]
List of standard deviations in log transitory income uncertainty during the agent’s life.
TranShkCount : int
The number of approximation points to be used in the discrete approxima- tion to the permanent income shock distribution.
UnempPrb : float or [float]
The probability of becoming unemployed during the working period.
UnempPrbRet : float or None
The probability of not receiving typical retirement income when retired.
T_retire : int
The index value for the final working period in the agent’s life. If T_retire <= 0 then there is no retirement.
IncUnemp : float or [float]
IncUnempRet : float or None
Transitory income received while “unemployed” when retired.
T_cycle : int
Total number of non-terminal periods in the consumer’s sequence of periods.
Returns: IncShkDstn ([distribution.Distribution]) – A list with T_cycle elements, each of which is a discrete approximation to the income process in a period. PermShkDstn ([[distribution.Distributiony]]) – A list with T_cycle elements, each of which a discrete approximation to the permanent income shocks. TranShkDstn ([[distribution.Distribution]]) – A list with T_cycle elements, each of which a discrete approximation to the transitory income shocks.
get_shocks()

Gets permanent and transitory income shocks for this period. Samples from IncShkDstn for each period in the cycle.

Parameters: NewbornTransShk (boolean, optional) – Whether Newborns have transitory shock. The default is False. None
make_euler_error_func(mMax=100, approx_inc_dstn=True)

Creates a “normalized Euler error” function for this instance, mapping from market resources to “consumption error per dollar of consumption.” Stores result in attribute eulerErrorFunc as an interpolated function. Has option to use approximate income distribution stored in self.IncShkDstn or to use a (temporary) very dense approximation.

Only works on (one period) infinite horizon models at this time, will be generalized later.

Parameters: mMax (float) – Maximum normalized market resources for the Euler error function. approx_inc_dstn (Boolean) – Indicator for whether to use the approximate discrete income distri- bution stored in self.IncShkDstn, or to use a very accurate discrete approximation instead. When True, uses approximation in IncShkDstn; when False, makes and uses a very dense approximation. None

Notes

This method is not used by any other code in the library. Rather, it is here for expository and benchmarking purposes.

pre_solve()

A method that is run immediately before the model is solved, to check inputs or to prepare the terminal solution, perhaps.

Parameters: none – none
reset_rng()

Reset the RNG behavior of this type. This method is called automatically by initialize_sim(), ensuring that each simulation run uses the same sequence of random shocks; this is necessary for structural estimation to work. This method extends AgentType.reset_rng() to also reset elements of IncShkDstn.

Parameters: None – None
shock_vars_ = ['PermShk', 'TranShk']
time_inv_ = ['CRRA', 'DiscFac', 'BoroCnstArt', 'BoroCnstArt', 'vFuncBool', 'CubicBool']
update()

Update the income process, the assets grid, and the terminal solution.

Parameters: None – None
update_assets_grid()

Updates this agent’s end-of-period assets grid by constructing a multi- exponentially spaced grid of aXtra values.

Parameters: none – none
update_income_process()

Updates this agent’s income process based on his own attributes.

Parameters: none – Returns – ----------- – none –
class HARK.ConsumptionSaving.ConsIndShockModel.KinkedRconsumerType(**kwds)

A consumer type that faces idiosyncratic shocks to income and has a different interest factor on saving vs borrowing. Extends IndShockConsumerType, with very small changes. Solver for this class is currently only compatible with linear spline interpolation.

Same parameters as AgentType.

calc_bounding_values()

Calculate human wealth plus minimum and maximum MPC in an infinite horizon model with only one period repeated indefinitely. Store results as attributes of self. Human wealth is the present discounted value of expected future income after receiving income this period, ignoring mort- ality. The maximum MPC is the limit of the MPC as m –> mNrmMin. The minimum MPC is the limit of the MPC as m –> infty. This version deals with the different interest rates on borrowing vs saving.

Parameters: None – None
check_conditions()

This method checks whether the instance’s type satisfies the Absolute Impatience Condition (AIC), the Return Impatience Condition (RIC), the Growth Impatience Condition (GICRaw), the Normalized Growth Impatience Condition (GIC-Nrm), the Weak Return Impatience Condition (WRIC), the Finite Human Wealth Condition (FHWC) and the Finite Value of Autarky Condition (FVAC). To check which conditions are relevant to the model at hand, a reference to the relevant theoretical literature is made.

Parameters: None – None
get_Rfree()

Returns an array of size self.AgentCount with self.Rboro or self.Rsave in each entry, based on whether self.aNrmNow >< 0.

Parameters: None – RfreeNow – Array of size self.AgentCount with risk free interest rate for each agent. np.array
make_euler_error_func(mMax=100, approx_inc_dstn=True)

Creates a “normalized Euler error” function for this instance, mapping from market resources to “consumption error per dollar of consumption.” Stores result in attribute eulerErrorFunc as an interpolated function. Has option to use approximate income distribution stored in self.IncShkDstn or to use a (temporary) very dense approximation.

SHOULD BE INHERITED FROM ConsIndShockModel

Parameters: mMax (float) – Maximum normalized market resources for the Euler error function. approx_inc_dstn (Boolean) – Indicator for whether to use the approximate discrete income distri- bution stored in self.IncShkDstn, or to use a very accurate discrete approximation instead. When True, uses approximation in IncShkDstn; when False, makes and uses a very dense approximation. None

Notes

This method is not used by any other code in the library. Rather, it is here for expository and benchmarking purposes.

pre_solve()

A method that is run immediately before the model is solved, to check inputs or to prepare the terminal solution, perhaps.

Parameters: none – none
time_inv_ = ['CRRA', 'DiscFac', 'BoroCnstArt', 'BoroCnstArt', 'vFuncBool', 'CubicBool', 'Rboro', 'Rsave']