ConsPrefShockModel

Extensions to ConsIndShockModel concerning models with preference shocks. It currently only two models:

  1. An extension of ConsIndShock, but with an iid lognormal multiplicative shock each period.
  2. A combination of (1) and ConsKinkedR, demonstrating how to construct a new model by inheriting from multiple classes.
class HARK.ConsumptionSaving.ConsPrefShockModel.PrefShockConsumerType(cycles=1, **kwds)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.IndShockConsumerType

A class for representing consumers who experience multiplicative shocks to utility each period, specified as iid lognormal.

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.

NOT YET IMPLEMENTED FOR THIS CLASS

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

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

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

Gets permanent and transitory income shocks for this period as well as preference shocks.

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.

NOT YET IMPLEMENTED FOR THIS CLASS

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 IndShockConsumerType.resetRNG() to also reset elements of PrefShkDstn.

Parameters:None
Returns:
Return type:None
shock_vars_ = ['PermShkNow', 'TranShkNow', 'PrefShkNow']
update()

Updates the assets grid, income process, terminal period solution, and preference shock process. A very slight extension of IndShockConsumerType.update() for the preference shock model.

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

Make a discrete preference shock structure for each period in the cycle for this agent type, storing them as attributes of self for use in the solution (and other methods).

Parameters:none
Returns:
Return type:none
class HARK.ConsumptionSaving.ConsPrefShockModel.KinkyPrefConsumerType(cycles=1, **kwds)

Bases: HARK.ConsumptionSaving.ConsPrefShockModel.PrefShockConsumerType, HARK.ConsumptionSaving.ConsIndShockModel.KinkedRconsumerType

A class for representing consumers who experience multiplicative shocks to utility each period, specified as iid lognormal and different interest rates on borrowing vs saving.

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
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
class HARK.ConsumptionSaving.ConsPrefShockModel.ConsPrefShockSolver(solution_next, IncomeDstn, PrefShkDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.ConsIndShockSolver

A class for solving the one period consumption-saving problem with risky income (permanent and transitory shocks) and multiplicative shocks to utility each period.

getPointsForInterpolation(EndOfPrdvP, aNrmNow)

Find endogenous interpolation points for each asset point and each discrete preference shock.

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.

makevFunc(solution)

Make the beginning-of-period value function (unconditional on the shock).

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
usePointsForInterpolation(cNrm, mNrm, interpolator)

Make a basic solution object with a consumption function and marginal value function (unconditional on the preference shock).

Parameters:
  • cNrm (np.array) – Consumption points for interpolation.
  • mNrm (np.array) – 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.ConsPrefShockModel.ConsKinkyPrefSolver(solution_next, IncomeDstn, PrefShkDstn, LivPrb, DiscFac, CRRA, Rboro, Rsave, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

Bases: HARK.ConsumptionSaving.ConsPrefShockModel.ConsPrefShockSolver, HARK.ConsumptionSaving.ConsIndShockModel.ConsKinkedRsolver

A class for solving the one period consumption-saving problem with risky income (permanent and transitory shocks), multiplicative shocks to utility each period, and a different interest rate on saving vs borrowing.