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(**kwds)

Bases: HARK.ConsumptionSaving.ConsIndShockModel.IndShockConsumerType

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

See ConsumerParameters.init_pref_shock for a dictionary of the keywords that should be passed to the constructor.

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.

NOT YET IMPLEMENTED FOR THIS CLASS

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

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

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

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

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

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

Return type:

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
Returns:
Return type: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 IndShockConsumerType.reset_rng() to also reset elements of PrefShkDstn.

Parameters:None
Returns:
Return type:None
shock_vars_ = ['PermShk', 'TranShk', 'PrefShk']
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
update_pref_shock_process()

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(**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.

See init_kinky_pref for a dictionary of the keywords that should be passed to the constructor.

get_Rfree()

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
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
Returns:
Return type:none
class HARK.ConsumptionSaving.ConsPrefShockModel.ConsPrefShockSolver(solution_next, IncShkDstn, 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.

Parameters:
  • solution_next (ConsumerSolution) – The solution to the succeeding 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). 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.
get_points_for_interpolation(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.

make_vFunc(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:ValueFuncCRRA
use_points_for_interpolation(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, IncShkDstn, 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.

Parameters:
  • solution_next (ConsumerSolution) – The solution to the succeeding 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). 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.