ConsIndShockModel

Classes to solve canonical consumption-savings models with idiosyncratic shocks to income. All models here assume CRRA utility with geometric discounting, no bequest motive, and income shocks 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)

Bases: HARK.core.HARKobject

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.

appendSolution(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.
Returns:
Return type:None
distance_criteria = ['vPfunc']
class HARK.ConsumptionSaving.ConsIndShockModel.ValueFunc(vFuncNvrs, CRRA)

Bases: HARK.core.HARKobject

A class for representing a value function. The underlying interpolation is in the space of (m,u_inv(v)); this class “re-curves” to the value function.

distance_criteria = ['func', 'CRRA']
class HARK.ConsumptionSaving.ConsIndShockModel.MargValueFunc(cFunc, CRRA)

Bases: HARK.core.HARKobject

A class for representing a marginal value function in models where the standard envelope condition of v’(m) = u’(c(m)) holds (with CRRA utility).

derivative(m)

Evaluate the derivative of the marginal value function at given levels of market resources m; this is the marginal marginal value function.

Parameters:m (float or np.array) – Market resources (normalized by permanent income) whose marginal marginal value is to be found.
Returns:vPP – Marginal marginal lifetime value of beginning this period with market resources m; has same size as input m.
Return type:float or np.array
distance_criteria = ['cFunc', 'CRRA']
class HARK.ConsumptionSaving.ConsIndShockModel.MargMargValueFunc(cFunc, CRRA)

Bases: HARK.core.HARKobject

A class for representing a marginal marginal value function in models where the standard envelope condition of v’(m) = u’(c(m)) holds (with CRRA utility).

distance_criteria = ['cFunc', 'CRRA']
class HARK.ConsumptionSaving.ConsIndShockModel.ConsPerfForesightSolver(solution_next, DiscFac, LivPrb, CRRA, Rfree, PermGroFac, BoroCnstArt, MaxKinks)

Bases: HARK.core.HARKobject

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.

addSSmNrm(solution)

Finds steady state (normalized) market resources and adds it to the solution. This is the level of market resources such that the expectation of market resources in the next period is unchanged. This value doesn’t necessarily exist.

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

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

Parameters:None
Returns:
Return type:None
defValueFuncs()
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.

https://econ.jhu.edu/people/ccarroll/public/lecturenotes/consumption/PerfForesightCRRA/#vFuncAnalytical https://econ.jhu.edu/people/ccarroll/SolvingMicroDSOPs/#vFuncPF

None

None

makePFcFunc()

Makes the (linear) consumption function for this period.

Parameters:None
Returns:
Return type:None
solve()

Solves the one period perfect foresight consumption-saving problem.

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

Bases: HARK.ConsumptionSaving.ConsIndShockModel.ConsPerfForesightSolver

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.

defBoroCnst(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.
Returns:
Return type:none
defUtilityFuncs()

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
Returns:
Return type:none
prepareToSolve()

Perform preparatory work before calculating the unconstrained consumption function.

Parameters:none
Returns:
Return type:none
setAndUpdateValues(solution_next, IncomeDstn, 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.
  • IncomeDstn (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.
Returns:

Return type:

None

class HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolverBasic(solution_next, IncomeDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSetup

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.

addMPCandHumanWealth(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.
calcEndOfPrdvP()

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
Returns:EndOfPrdvP – A 1D array of end-of-period marginal value of assets
Return type:np.array
getPointsForInterpolation(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.
Returns:

  • c_for_interpolation (np.array) – Consumption points for interpolation.
  • m_for_interpolation (np.array) – Corresponding market resource points for interpolation.

makeBasicSolution(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.
Returns:

solution_now – The solution to this period’s consumption-saving problem, with a consumption function, marginal value function, and minimum m.

Return type:

ConsumerSolution

makeLinearcFunc(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.
Returns:

cFuncUnc – The unconstrained consumption function for this period.

Return type:

LinearInterp

prepareToCalcEndOfPrdvP()

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
Returns:aNrmNow – A 1D array of end-of-period assets; also stored as attribute of self.
Return type:np.array
solve()

Solves a one period consumption saving problem with risky income.

Parameters:None
Returns:solution – The solution to the one period problem.
Return type:ConsumerSolution
usePointsForInterpolation(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.
Returns:

solution_now – The solution to this period’s consumption-saving problem, with a consumption function, marginal value function, and minimum m.

Return type:

ConsumerSolution

class HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolver(solution_next, IncomeDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolverBasic

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.

addvFunc(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.
Returns:

solution – The single period solution passed as an input, but now with the value function (defined over market resources m) as an attribute.

Return type:

ConsumerSolution

addvPPfunc(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.
Returns:solution – The same solution passed as input, but with the marginal marginal value function for this period added as the attribute vPPfunc.
Return type:ConsumerSolution
makeCubiccFunc(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.
Returns:

cFuncUnc – The unconstrained consumption function for this period.

Return type:

CubicInterp

makeEndOfPrdvFunc(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.
Returns:
Return type:none
makevFunc(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.
Returns:vFuncNow – A representation of the value function for this period, defined over normalized market resources m: v = vFuncNow(m).
Return type:ValueFunc
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
Returns:solution – The solution to the single period consumption-saving problem.
Return type:ConsumerSolution
class HARK.ConsumptionSaving.ConsIndShockModel.ConsKinkedRsolver(solution_next, IncomeDstn, LivPrb, DiscFac, CRRA, Rboro, Rsave, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolver

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.

makeCubiccFunc(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.
Returns:

cFuncUnc – The unconstrained consumption function for this period.

Return type:

CubicInterp

prepareToCalcEndOfPrdvP()

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
Returns:aNrmNow – A 1D array of end-of-period assets; also stored as attribute of self.
Return type:np.array
class HARK.ConsumptionSaving.ConsIndShockModel.PerfForesightConsumerType(cycles=1, verbose=1, quiet=False, **kwds)

Bases: HARK.core.AgentType

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>
checkAIC(verbose=None)

Evaluate and report on the Absolute Impatience Condition

checkCondition(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.
checkConditions(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) and the perfect foresight model’s version of the Finite Value of the Growth Impatience Condition (GICPF) and 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.
Returns:
Return type:None
checkFHWC(verbose=None)

Evaluate and report on the Finite Human Wealth Condition

checkGICPF(verbose=None)

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

checkRIC(verbose=None)

Evaluate and report on the Return Impatience Condition

checkRestrictions()

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

getControls()

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

Parameters:None
Returns:
Return type:None
getPostStates()

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

Parameters:None
Returns:
Return type:None
getRfree()

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

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

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
Returns:
Return type:None
initializeSim()

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

Parameters:None
Returns:
Return type:None
preSolve()

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

Parameters:none
Returns:
Return type:none
shock_vars_ = []
simBirth(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”.
Returns:
Return type:None
simDeath()

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

Parameters:None
Returns:which_agents – Boolean array of size AgentCount indicating which agents die.
Return type:np.array(bool)
solution_terminal_ = <HARK.ConsumptionSaving.ConsIndShockModel.ConsumerSolution object>
state_vars = ['pLvlNow', 'PlvlAggNow', 'bNrmNow', 'mNrmNow', 'aNrmNow']
time_inv_ = ['CRRA', 'Rfree', 'DiscFac', 'MaxKinks', 'BoroCnstArt']
time_vary_ = ['LivPrb', 'PermGroFac']
transition()
Parameters:
  • None
  • to match dolo spec ([Eventually,) –
  • endogenous_prev, controls, exogenous, parameters] (exogenous_prev,) –
Returns:

endogenous_state – Tuple with new values of the endogenous states

Return type:

()

unpackcFunc()

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:
Return type:none
updateSolutionTerminal()

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

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

Bases: HARK.ConsumptionSaving.ConsIndShockModel.PerfForesightConsumerType

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.

Ex_Mtp1_over_Ex_Ptp1(mRat)
Ex_mtp1(mRat)
calcBoundingValues()

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
Returns:
Return type:None
calcTargets()

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
Returns:
Return type:None
checkCIGAgg(verbose=None)
checkConditions(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 http://econ.jhu.edu/people/ccarroll/papers/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.
Returns:
Return type:None
checkFVAC(verbose=None)

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

checkGICInd(verbose=None)

Check Individual Growth Impatience Factor.

checkWRIC(verbose=None)

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

constructLognormalIncomeProcessUnemployment()

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
The probability of becoming unemployed during the working period.
UnempPrbRet : float
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
Transitory income received when unemployed.
IncUnempRet : float
Transitory income received while “unemployed” when retired.
T_cycle : int
Total number of non-terminal periods in the consumer’s sequence of periods.
Returns:
  • IncomeDstn ([[np.array]]) – A list with T_cycle elements, each of which is a list of three arrays representing a discrete approximation to the income process in a period. Order: probabilities, permanent shocks, transitory shocks.
  • PermShkDstn ([[np.array]]) – A list with T_cycle elements, each of which is a list of two arrays representing a discrete approximation to the permanent income shocks.
  • TranShkDstn ([[np.array]]) – A list with T_cycle elements, each of which is a list of two arrays representing a discrete approximation to the transitory income shocks.
getShocks()

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

Parameters:None
Returns:
Return type:None
makeEulerErrorFunc(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.IncomeDstn 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.IncomeDstn[0], or to use a very accurate discrete approximation instead. When True, uses approximation in IncomeDstn; when False, makes and uses a very dense approximation.
Returns:

Return type:

None

preSolve()

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

Parameters:none
Returns:
Return type:none
resetRNG()

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

Parameters:None
Returns:
Return type:None
shock_vars_ = ['PermShkNow', 'TranShkNow']
time_inv_ = ['CRRA', 'Rfree', 'DiscFac', 'BoroCnstArt', 'BoroCnstArt', 'vFuncBool', 'CubicBool']
update()

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

Parameters:None
Returns:
Return type:None
updateAssetsGrid()

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

Parameters:none
Returns:
Return type:none
updateIncomeProcess()

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

Parameters:
  • none
  • Returns
  • -----------
  • none
class HARK.ConsumptionSaving.ConsIndShockModel.KinkedRconsumerType(cycles=1, **kwds)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.IndShockConsumerType

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.

calcBoundingValues()

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
Returns:
Return type:None
checkConditions()

This method checks whether the instance’s type satisfies the Absolute Impatience Condition (AIC), the Return Impatience Condition (RIC), the Growth Impatience Condition (GIC), 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
Returns:
Return type:None
getRfree()

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

Parameters:None
Returns:RfreeNow – Array of size self.AgentCount with risk free interest rate for each agent.
Return type:np.array
makeEulerErrorFunc(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.IncomeDstn 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.IncomeDstn[0], or to use a very accurate discrete approximation instead. When True, uses approximation in IncomeDstn; when False, makes and uses a very dense approximation.
Returns:

Return type:

None

preSolve()

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

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