HARK.ConsumptionSaving.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.ConsKinkyPrefSolver(solution_next, IncomeDstn, PrefShkDstn, LivPrb, DiscFac, CRRA, Rboro, Rsave, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

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.

class HARK.ConsumptionSaving.ConsPrefShockModel.ConsPrefShockSolver(solution_next, IncomeDstn, PrefShkDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

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.KinkyPrefConsumerType(cycles=1, time_flow=True, **kwds)

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.

class HARK.ConsumptionSaving.ConsPrefShockModel.PrefShockConsumerType(cycles=1, time_flow=True, **kwds)

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

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

Solves a single period of a consumption-saving model with preference shocks to marginal utility and a different interest rate on saving vs borrowing. Problem is solved using the method of endogenous gridpoints.

Parameters:
  • solution_next (ConsumerSolution) – The solution to the succeeding one period problem.
  • IncomeDstn ([np.array]) – A list containing three arrays of floats, representing a discrete approximation to the income process between the period being solved and the one immediately following (in solution_next). Order: event probabilities, permanent shocks, transitory shocks.
  • PrefShkDstn ([np.array]) – Discrete distribution of the multiplicative utility shifter. Order: probabilities, preference shocks.
  • 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.
  • PermGroGac (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.
Returns:

solution – The solution to the single period consumption-saving problem. Includes a consumption function cFunc (using linear splines), a marginal value function vPfunc, a minimum acceptable level of normalized market re- sources mNrmMin, normalized human wealth hNrm, and bounding MPCs MPCmin and MPCmax. It might also have a value function vFunc. The consumption function is defined over normalized market resources and the preference shock, c = cFunc(m,PrefShk), but the (marginal) value function is defined unconditionally on the shock, just before it is revealed.

Return type:

ConsumerSolution

HARK.ConsumptionSaving.ConsPrefShockModel.solveConsPrefShock(solution_next, IncomeDstn, PrefShkDstn, LivPrb, DiscFac, CRRA, Rfree, PermGroFac, BoroCnstArt, aXtraGrid, vFuncBool, CubicBool)

Solves a single period of a consumption-saving model with preference shocks to marginal utility. Problem is solved using the method of endogenous gridpoints.

Parameters:
  • solution_next (ConsumerSolution) – The solution to the succeeding one period problem.
  • IncomeDstn ([np.array]) – A list containing three arrays of floats, representing a discrete approximation to the income process between the period being solved and the one immediately following (in solution_next). Order: event probabilities, permanent shocks, transitory shocks.
  • PrefShkDstn ([np.array]) – Discrete distribution of the multiplicative utility shifter. Order: probabilities, preference shocks.
  • 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.
  • PermGroGac (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.
Returns:

solution – The solution to the single period consumption-saving problem. Includes a consumption function cFunc (using linear splines), a marginal value function vPfunc, a minimum acceptable level of normalized market re- sources mNrmMin, normalized human wealth hNrm, and bounding MPCs MPCmin and MPCmax. It might also have a value function vFunc. The consumption function is defined over normalized market resources and the preference shock, c = cFunc(m,PrefShk), but the (marginal) value function is defined unconditionally on the shock, just before it is revealed.

Return type:

ConsumerSolution