ConsMedModel#

Consumption-saving models that also include medical spending.

class HARK.ConsumptionSaving.ConsMedModel.MedShockConsumerType(**kwds)#

Bases: PersistentShockConsumerType

A class to represent agents who consume two goods: ordinary composite consumption and medical care; both goods yield CRRAutility, and the coefficients on the goods might be different. Agents expect to receive shocks to permanent and transitory income as well as multiplicative shocks to utility from medical care.

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

Parameters:

cycles (int) – Number of times the sequence of periods should be solved.

get_controls()#

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

Parameters:

None

Return type:

None

get_poststates()#

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

Parameters:

None

Return type:

None

get_shocks()#

Gets permanent and transitory income shocks for this period as well as medical need shocks and the price of medical care.

Parameters:

None

Return type:

None

pre_solve()#

Method that is run automatically just before solution by backward iteration. Solves the (trivial) terminal period and does a quick check on the borrowing constraint and MaxKinks attribute (only relevant in constrained, infinite horizon problems).

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 PersistentShockConsumerType.reset_rng() to also reset elements of MedShkDstn.

Parameters:

None

Return type:

None

shock_vars_ = ['PermShk', 'TranShk', 'MedShk']#
state_vars = ['pLvl', 'mLvl', 'aLvl', 'mLvl']#
update()#

Update the income process, the assets grid, the permanent income grid, the medical shock distribution, and the terminal solution.

Parameters:

None

Return type:

None

update_med_shock_process()#

Constructs discrete distributions of medical preference shocks for each period in the cycle. Distributions are saved as attribute MedShkDstn, which is added to time_vary.

Parameters:

None

Return type:

None

update_pLvlGrid()#

Update the grid of permanent income levels. Currently only works for infinite horizon models (cycles=0) and lifecycle models (cycles=1). Not clear what to do about cycles>1. Identical to version in persistent shocks model, but pLvl=0 is manually added to the grid (because there is no closed form lower-bounding cFunc for pLvl=0).

Parameters:

None

Return type:

None

update_solution_terminal()#

Update the terminal period solution for this type. Similar to other models, optimal behavior involves spending all available market resources; however, the agent must split his resources between consumption and medical care.

Parameters:
  • None

  • Returns

  • --------

  • None

class HARK.ConsumptionSaving.ConsMedModel.MedShockPolicyFunc(xFunc, xLvlGrid, MedShkGrid, MedPrice, CRRAcon, CRRAmed, xLvlCubicBool=False, MedShkCubicBool=False)#

Bases: MetricObject

Class for representing the policy function in the medical shocks model: opt- imal consumption and medical care for given market resources, permanent income, and medical need shock. Always obeys Con + MedPrice*Med = optimal spending.

Parameters:
  • xFunc (function) – Optimal total spending as a function of market resources, permanent income, and the medical need shock.

  • xLvlGrid (np.array) – 1D array of total expenditure levels.

  • MedShkGrid (np.array) – 1D array of medical shocks.

  • MedPrice (float) – Relative price of a unit of medical care.

  • CRRAcon (float) – Coefficient of relative risk aversion for consumption.

  • CRRAmed (float) – Coefficient of relative risk aversion for medical care.

  • xLvlCubicBool (boolean) – Indicator for whether cubic spline interpolation (rather than linear) should be used in the xLvl dimension.

  • MedShkCubicBool (boolean) – Indicator for whether bicubic interpolation should be used; only operative when xLvlCubicBool=True.

derivativeX(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption and medical care with respect to market resources at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

  • dcdm (np.array) – Derivative of consumption with respect to market resources for each point in (xLvl,MedShk).

  • dMeddm (np.array) – Derivative of medical care with respect to market resources for each point in (xLvl,MedShk).

derivativeY(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption and medical care with respect to permanent income at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

  • dcdp (np.array) – Derivative of consumption with respect to permanent income for each point in (xLvl,MedShk).

  • dMeddp (np.array) – Derivative of medical care with respect to permanent income for each point in (xLvl,MedShk).

derivativeZ(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption and medical care with respect to medical need shock at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

  • dcdShk (np.array) – Derivative of consumption with respect to medical need for each point in (xLvl,MedShk).

  • dMeddShk (np.array) – Derivative of medical care with respect to medical need for each point in (xLvl,MedShk).

distance_criteria = ['xFunc', 'cFunc', 'MedPrice']#
class HARK.ConsumptionSaving.ConsMedModel.MedThruXfunc(xFunc, cFunc, MedPrice)#

Bases: MetricObject

Class for representing medical care function derived from total expenditure and consumption.

Parameters:
  • xFunc (function) – Optimal total spending as a function of market resources, permanent income, and the medical need shock.

  • cFunc (function) – Optimal consumption as a function of total spending and the medical need shock.

  • MedPrice (float) – Relative price of a unit of medical care.

derivativeX(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption and medical care with respect to market resources at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

  • dcdm (np.array) – Derivative of consumption with respect to market resources for each point in (xLvl,MedShk).

  • dMeddm (np.array) – Derivative of medical care with respect to market resources for each point in (xLvl,MedShk).

derivativeY(mLvl, pLvl, MedShk)#

Evaluate the derivative of medical care with respect to permanent income at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

dMeddp – Derivative of medical care with respect to permanent income for each point in (xLvl,MedShk).

Return type:

np.array

derivativeZ(mLvl, pLvl, MedShk)#

Evaluate the derivative of medical care with respect to medical need shock at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

dMeddShk – Derivative of medical care with respect to medical need for each point in (xLvl,MedShk).

Return type:

np.array

distance_criteria = ['xFunc', 'cFunc', 'MedPrice']#
class HARK.ConsumptionSaving.ConsMedModel.cThruXfunc(xFunc, cFunc)#

Bases: MetricObject

Class for representing consumption function derived from total expenditure and consumption.

Parameters:
  • xFunc (function) – Optimal total spending as a function of market resources, permanent income, and the medical need shock.

  • cFunc (function) – Optimal consumption as a function of total spending and the medical need shock.

derivativeX(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption with respect to market resources at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

dcdm – Derivative of consumption with respect to market resources for each point in (xLvl,MedShk).

Return type:

np.array

derivativeY(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption and medical care with respect to permanent income at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

dcdp – Derivative of consumption with respect to permanent income for each point in (xLvl,MedShk).

Return type:

np.array

derivativeZ(mLvl, pLvl, MedShk)#

Evaluate the derivative of consumption and medical care with respect to medical need shock at given levels of market resources, permanent income, and medical need shocks.

Parameters:
  • mLvl (np.array) – Market resource levels.

  • pLvl (np.array) – Permanent income levels; should be same size as mLvl.

  • MedShk (np.array) – Medical need shocks; should be same size as mLvl.

Returns:

dcdShk – Derivative of consumption with respect to medical need for each point in (xLvl,MedShk).

Return type:

np.array

distance_criteria = ['xFunc', 'cFunc']#